You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
v5.4.0
Espressif SoC revision.
ESP32-S3 (v0.2)
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
PowerShell
Development Kit.
LilyGo T-Dongle
Power Supply used.
USB
What is the expected behavior?
When combining the SDMMC driver and the Button driver and no sdcard inserted I expect the sdcard to fail, and the button(on GPIO0) to continue to work. What I expect to happen is the initialization function copies GPIO_NUM_NC for unused D[7-1] pins depending on the width of the TF card slot, or that the deinit_slot routines account for width and only deinit pins they used.
What is the actual behavior?
After the SDCARD fails to detect the GPIO pin is re-verted to some uninitialized state and the button no longer works.
What appears to be happening is that the SDMMC fails to find a card and so it enters a state of de-initializing the card slot.
(See: sdmmc_host_deinit_slot_internal ). However this does not consider the width of the slot specified, nor does the initialization copy the config data for non-connected pins across resulting in potentially all of the unused D7-D1 pins being defaulted to 0 and re-initializing the GPIO0 pin (at best).
#if SOC_SDMMC_USE_GPIO_MATRIX
if (use_gpio_matrix) {
/* Save pin configuration for this slot */
slot_gpio->clk = slot_config->clk;
slot_gpio->cmd = slot_config->cmd;
slot_gpio->d0 = slot_config->d0;
...
then at de-initialization ALL pins are de-initialized causing whatever value was in the slot_gpio->d#n to be put back onto the pin state.
for (size_t i = 0; i < (sizeof(gpio->val) / (sizeof(gpio->val[0]))); i++) {
gpio_pin_num = gpio->val[i];
if (gpio_pin_num != GPIO_NUM_NC && GPIO_IS_VALID_GPIO(gpio_pin_num)) {
gpio_reset_pin(gpio_pin_num);
}
}
This conflicted on the LillyGo T-Dongle when the button is in use as its on GPIO0. Fortunately it seems the structure is initialized to zero, but I could guess there are case it could contain random corrupted values.
Steps to reproduce.
Setup a design to contain button and sdmmc components
Initialize the button and driver
Flash the board, but leave the sdcard out of the socket (no card installed)
Wait for the design to fail to find the card
Try to use the button - it will show "button pin low" as it has now been re-initialized by the failing sdcard
...
Debug Logs.
None, as you have to visually see the button not functioning
More Information.
Attached is the workaround I put into the sdmmc_host,c
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
GPIO0 (button in my case) re-initialized when sdmmc component fails to find valid card
GPIO0 (button in my case) re-initialized when sdmmc component fails to find valid card (IDFGH-14570)
Feb 4, 2025
Answers checklist.
IDF version.
v5.4.0
Espressif SoC revision.
ESP32-S3 (v0.2)
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
PowerShell
Development Kit.
LilyGo T-Dongle
Power Supply used.
USB
What is the expected behavior?
When combining the SDMMC driver and the Button driver and no sdcard inserted I expect the sdcard to fail, and the button(on GPIO0) to continue to work. What I expect to happen is the initialization function copies GPIO_NUM_NC for unused D[7-1] pins depending on the width of the TF card slot, or that the deinit_slot routines account for width and only deinit pins they used.
What is the actual behavior?
After the SDCARD fails to detect the GPIO pin is re-verted to some uninitialized state and the button no longer works.
What appears to be happening is that the SDMMC fails to find a card and so it enters a state of de-initializing the card slot.
(See: sdmmc_host_deinit_slot_internal ). However this does not consider the width of the slot specified, nor does the initialization copy the config data for non-connected pins across resulting in potentially all of the unused D7-D1 pins being defaulted to 0 and re-initializing the GPIO0 pin (at best).
See file:
https://github.com/espressif/esp-idf/blob/master/components/esp_driver_sdmmc/src/sdmmc_host.c
Initialization
then at de-initialization ALL pins are de-initialized causing whatever value was in the slot_gpio->d#n to be put back onto the pin state.
This conflicted on the LillyGo T-Dongle when the button is in use as its on GPIO0. Fortunately it seems the structure is initialized to zero, but I could guess there are case it could contain random corrupted values.
Steps to reproduce.
...
Debug Logs.
More Information.
Attached is the workaround I put into the sdmmc_host,c
The text was updated successfully, but these errors were encountered: