ESP32-C3 can't leave Download Mode
Posted: Thu Aug 10, 2023 7:07 am
Dear All,
I'm tasked with programming a whole bunch of custom ESP32-C3-MINI-1 boards. The board is equipped with a push-button on GPIO9. When pressed GPIO9 is pulled to GND.
The procedure goes as follows:
The push-button is held pressed, then the board is connected via its USB connector receiving power. Now the push button is released. The USBs data lines are connected to the USB-JTAG-Serial interface for the ESP32-C3.
The ESP is now in Download Mode, as GPIO9 was LOW during power-on. Now I'm using the esptool.py to program my firmware image.
The next step is causing me some headache. I need the freshly programmed code to run on the ESP in order to do some QA checks. After the reset by the esptool (--after hard_reset) the ESP starts again in Download Mode which is obviously not what I want.
The Technical Referance manual states in Section 7.1:
Now I tried the following which does not work as expected:
I uploaded a tiny program into RAM (esptool.py load_ram) that causes a RTC watchdog reset which should cause the strapping PINs to be re-evaluated und thus allow the ESP to start into SPI Boot Mode.
Here is the output of the USB-CDC UART after uploading mit in-RAM code:
My code prints dots (.) in a loop while waiting for the RTC WDT to cause a system reset. Now, the reset reason confirms, that the WDT worked as intended. But why is the strapping PINs still at 0x5? It really should be 0xd (SPI Flash Boot).
If I power-cycle the ESP that it stats in Flash Boot (BOOT:0xd), so the level of GPIO9 is not the issue.
Thanks for reading all this and thanks for your help.
tl;dr:
Why are GPIO_STRAPPING stuck at the power-on values even after a RTCWDT_SYS_RST? Manual says rtc watchdog reset causes the strapping PINs to be read on RTCWDT_SYS_RST.
I'm tasked with programming a whole bunch of custom ESP32-C3-MINI-1 boards. The board is equipped with a push-button on GPIO9. When pressed GPIO9 is pulled to GND.
The procedure goes as follows:
The push-button is held pressed, then the board is connected via its USB connector receiving power. Now the push button is released. The USBs data lines are connected to the USB-JTAG-Serial interface for the ESP32-C3.
The ESP is now in Download Mode, as GPIO9 was LOW during power-on. Now I'm using the esptool.py to program my firmware image.
The next step is causing me some headache. I need the freshly programmed code to run on the ESP in order to do some QA checks. After the reset by the esptool (--after hard_reset) the ESP starts again in Download Mode which is obviously not what I want.
The Technical Referance manual states in Section 7.1:
So it becomes clear, that the reset executed by the esptool does not cause the strapping PINs to be re-evaluated. Power-cycling the board works but is not an option, as it would require a manual intervention.During power-on reset, RTC watchdog reset, brownout reset, analog super watchdog reset, and crystal clock
glitch detection reset (see Chapter 6 Reset and Clock), hardware captures samples and stores the voltage level of
strapping pins as strapping bit of “0” or “1” in latches, and holds these bits until the chip is powered down or shut
down. Software can read the latch status (strapping value) from GPIO_STRAPPING.
Now I tried the following which does not work as expected:
I uploaded a tiny program into RAM (esptool.py load_ram) that causes a RTC watchdog reset which should cause the strapping PINs to be re-evaluated und thus allow the ESP to start into SPI Boot Mode.
Here is the output of the USB-CDC UART after uploading mit in-RAM code:
Code: Select all
............................................ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x9 (RTCWDT_SYS_RST),boot:0x5 (DOWNLOAD(USB/UART0/1))
Saved PC:0x4004c0d4
waiting for download
If I power-cycle the ESP that it stats in Flash Boot (BOOT:0xd), so the level of GPIO9 is not the issue.
Thanks for reading all this and thanks for your help.
tl;dr:
Why are GPIO_STRAPPING stuck at the power-on values even after a RTCWDT_SYS_RST? Manual says rtc watchdog reset causes the strapping PINs to be read on RTCWDT_SYS_RST.