Use SPICLK as GPIO15 on ESP32-C3
Posted: Wed Dec 07, 2022 2:01 pm
I am working on a custom board using the ESP32-C3FH4 (embedded flash) and I need to drive PIN22 (SPICLK) as a GPIO.
This should be assigned to GPIO15.
I use the following code to set it as a GPIO, output and high level.
I do this configuration only once at the beginning of my app_main.
The app is configured for the right platform.
When I power-up my device I see that the pin is low and sometimes I see some activity on it that looks like an SPI clock (should be set at 40Mhz and I can't get a very clear signal).
Am I missing some steps in GPIO configuration for this specific pin?
I used the same code on ESP32-C3-devkit-1 (apart from the iomux call) on other pins that are GPIOs by default and had no issues.
This should be assigned to GPIO15.
I use the following code to set it as a GPIO, output and high level.
Code: Select all
const gpio_config_t gpio_config = {.pin_bit_mask = BIT(15),
.mode = GPIO_MODE_OUTPUT,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_DISABLE};
gpio_config(&gpio_config);
gpio_set_direction(GPIO_NUM_15, GPIO_MODE_OUTPUT);
gpio_set_level(GPIO_NUM_15, 1);
gpio_iomux_out(GPIO_NUM_15, FUNC_SPICLK_GPIO15, false);
gpio_hold_dis(GPIO_NUM_15);
The app is configured for the right platform.
When I power-up my device I see that the pin is low and sometimes I see some activity on it that looks like an SPI clock (should be set at 40Mhz and I can't get a very clear signal).
Am I missing some steps in GPIO configuration for this specific pin?
I used the same code on ESP32-C3-devkit-1 (apart from the iomux call) on other pins that are GPIOs by default and had no issues.