ESP32-C3: Using GPIO19 with internal pull-down
Posted: Sun Apr 10, 2022 1:39 am
Hi there!
I'm trying to use GPIO19 as a general purpose pin. The manual mentions that USB_SERIAL_JTAG_DP_PULLUP bit controls the pull-up resistor. Though it is not clear if an application needs to perform this update explicitly or not.
For reference I'm explicitly trying to configure the GPIO pin as a pull-down:
Left floating after configuration gpio_get_level(19) always returns 1 and it acts as a pull-up.
There is another topic related to this at: viewtopic.php?t=22256 however that seems to imply that clearing USB_DEVICE_USB_PAD_ENABLE is sufficient. This did not work for me.
As a note, USB_SERIAL_JTAG_USB_PAD_ENABLE is cleared via gpio_config indirectly, so it's unclear if this is just an out-of-date reference.
I figured that this is still a configuration issue on my side since the correct bit isn't being reset so I added:
after gpio_config() and it now works as expected.
I've resolved the issue in my code, but would like to understand if this is indeed something that needs to be explicitly done by the application or if gpio_config() should update the USB_SERIAL_JTAG_DP_PULLUP bit depending on the gpio_config_t configuration?
Thank you!
Daniel
I'm trying to use GPIO19 as a general purpose pin. The manual mentions that USB_SERIAL_JTAG_DP_PULLUP bit controls the pull-up resistor. Though it is not clear if an application needs to perform this update explicitly or not.
For reference I'm explicitly trying to configure the GPIO pin as a pull-down:
Code: Select all
gpio_config_t io_conf = {};
io_conf.intr_type = GPIO_INTR_ANYEDGE;
io_conf.pin_bit_mask = 1 << 19;
io_conf.mode = GPIO_MODE_INPUT;
io_conf.pull_up_en = 0;
io_conf.pull_down_en = 1;
gpio_config(&io_conf);
There is another topic related to this at: viewtopic.php?t=22256 however that seems to imply that clearing USB_DEVICE_USB_PAD_ENABLE is sufficient. This did not work for me.
As a note, USB_SERIAL_JTAG_USB_PAD_ENABLE is cleared via gpio_config indirectly, so it's unclear if this is just an out-of-date reference.
I figured that this is still a configuration issue on my side since the correct bit isn't being reset so I added:
Code: Select all
CLEAR_PERI_REG_MASK(USB_SERIAL_JTAG_CONF0_REG, USB_SERIAL_JTAG_DP_PULLUP);
I've resolved the issue in my code, but would like to understand if this is indeed something that needs to be explicitly done by the application or if gpio_config() should update the USB_SERIAL_JTAG_DP_PULLUP bit depending on the gpio_config_t configuration?
Thank you!
Daniel