ESP32-ADF using SD-Card does not reboot on reset and cannot flash [solved]

Started by winfried, October 09, 2023, 10:30:25 PM

Previous topic - Next topic

winfried

Hello,

The problem is that GPIO-12 issue, which is a strapping pin with Pullup 10k, and  used for SD-Card:

#define SD_CS 21
#define SPI_MOSI 13
#define SPI_MISO 12
#define SPI_SCK 14

So if the SD-Card is active when reset, it is not put into high mode, either from SD or the SPI driver,  then the flash operating valued at boot and the setting of the internal LDO is set to 1.8V, but flash wants 3.3V. So iit does not boot from flash (console log):

rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff

The device has to be powered off and or the SD card removed, so it boots with the 3.3V mode.
This is annoying, especially when programming, since also flashing via serial is not possible until SD card is removed.

The questions:
  - Is this the right assumption ?
  - Any (easy) work around ?

mfG
 Winfried


---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

LubOlimex

QuoteThe problem is that GPIO-12 issue, which is a strapping pin with Pullup 10k

Which revision of ESP-ADF do you have? I am looking at the latest schematic for revision C and it seems the pull-up resistor R12 is not placed (marked as n.a in the schematic).
Technical support and documentation manager at Olimex

winfried

Quote from: LubOlimex on October 18, 2023, 09:46:44 AM
QuoteThe problem is that GPIO-12 issue, which is a strapping pin with Pullup 10k

Which revision of ESP-ADF do you have? I am looking at the latest schematic for revision C and it seems the pull-up resistor R12 is not placed (marked as n.a in the schematic).

Thanks for the correction, all my boards have Rev.C, and sorry, looked only at the kicad schematic [1], there it is not noted as n.a., but in the PDF schematics and looking at the boards, really it is not populated on the board, else they would not work.

Nevertheless, GPIO12 should have a defined LOW state at bootup, since it is a strapping pin and flash voltage set to 3.3V [2], but if SD-Card is active during a hard reset, the GPIO12 (MISO) Pin could be HIGH during reset, since Data CLK stops and stays so, I measured (on UEXT Pin7) it.

So the problem is still there, that in some situations, the board hangs and is not resetable
anymore, also via the USB-UART on board, without removing power or SD-Card.

mfg winfried

[1] https://github.com/OLIMEX/ESP32-ADF/blob/master/HARDWARE/ESP32-ADF%20Rev.C/ESP32-ADF_Rev_C.sch

[2] https://docs.espressif.com/projects/esptool/en/latest/esp32/advanced-topics/boot-mode-selection.html
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

winfried

In the meantime I implemented a sort of soft solution, to minimize the problem:

Add a soft_reset() function, which can be triggered by a button like GPIO34, which is pulled via 10k, also working as RTC_GPIO4 for wakeup after sleep and on UEXT or by an own command via WiFi, where the SD card is released and then does a reset with ESP.restart().  (Can be used before flashing and as reset button).
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

winfried

Just found a better solution: burning a efuse

There is an efuse for setting the flash voltage, so GPIO12 is not strapping anymore:

- https://docs.espressif.com/projects/esptool/en/latest/esp32/espefuse/set-flash-voltage-cmd.html

The drawback is, it cannot be undone, but cannot think that I exchange the flash anyway.

Will report back if this works.

mfg
  winfried
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

LubOlimex

Edit: I didn't see your comment about the efuse heh anyway.

It is possible to free GPIO12 by software means. This requires hard coding the fuses to 3.3V operation. This will free GPIO12, but it is irreversible, which is fine since the flash will never work at 1.8V. Read here:

https://docs.espressif.com/projects/esp-idf/en/v4.3/esp32/api-reference/peripherals/sd_pullup_requirements.html#strapping-conflicts-dat2

https://esp32.com/viewtopic.php?t=9426

Remember to do that while there is no SD card inserted.

We actually tested it and it seems to work fine. Here are two pictures my colleague took:

https://imgur.com/a/tGADyHB

After that the card seems to work after reboot without having to remove it. We are doing few tests still but let me know if that works for you.
Technical support and documentation manager at Olimex

winfried

Thanks for testing it, this solves the issue.
 
so I will do so on my 64 ESP32-ADF ;-).

mfG Winfried
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

LubOlimex

Excellent, I will try to mention this around the ESP32-ADF documents, so other people would have it easier to figure out.
Technical support and documentation manager at Olimex