Conflict between GPIOs used by bootloader vs. SDMMC
Posted: Mon Aug 30, 2021 7:30 pm
I've got a SparkFun ESP32 Thing (1st gen) on a breadboard wired up to a microSD card using 4-bit SDMMC. The wiring is as directed by comments in the IDF example: GPIOs 15, 14, 2, 4, 12, 13 connect to CMD, CLK, D0, D1, D2, D3 respectively. And I've added external 10K pullups to all but CLK, as per the multiple warnings in the file.
The damn thing is not flashable in this state -- uploading the first block of flash always fails with one of multiple fatal errors. In desperation I pulled the wires out and tried again, and was able to flash it. Then I had to fit the wires back in again, power up again, and watch my program run. This is not sustainable as a development cycle.
It looks like the problem is that GPIOs 2, 12 and 15 are monitored by the bootloader and change its behavior. These are exactly the same pins used by SDMMC! Pulling them up as required for SDMMC disables the bootloader (pin 2), and for good measure also tells it to use the wrong flash voltage (pin 12).
Is there any workaround for this? Like, can I tell IDF's SDMMC library to use different pins? (And if so, that kind of begs the question of why Espressif chose default pins that conflict so badly with the bootloader.)
Thanks,
--Jens
PS: To get it into bootloader mode at all I have to press both buttons then release Reset, at the exact right instant while the flasher is trying to connect, while pressing my belly button with the other hand. I used this exact board in 2018 and did not have this problem; maybe something's changed with IDF's flasher in the meantime?
The damn thing is not flashable in this state -- uploading the first block of flash always fails with one of multiple fatal errors. In desperation I pulled the wires out and tried again, and was able to flash it. Then I had to fit the wires back in again, power up again, and watch my program run. This is not sustainable as a development cycle.
It looks like the problem is that GPIOs 2, 12 and 15 are monitored by the bootloader and change its behavior. These are exactly the same pins used by SDMMC! Pulling them up as required for SDMMC disables the bootloader (pin 2), and for good measure also tells it to use the wrong flash voltage (pin 12).
Is there any workaround for this? Like, can I tell IDF's SDMMC library to use different pins? (And if so, that kind of begs the question of why Espressif chose default pins that conflict so badly with the bootloader.)
Thanks,
--Jens
PS: To get it into bootloader mode at all I have to press both buttons then release Reset, at the exact right instant while the flasher is trying to connect, while pressing my belly button with the other hand. I used this exact board in 2018 and did not have this problem; maybe something's changed with IDF's flasher in the meantime?