Page 1 of 1

What will the ESP32-C3 first stage bootloader do if SPI Flash is empty/erased?

Posted: Mon Mar 06, 2023 8:34 pm
by JBHunterI
Haven't received any response to this question since I opened a [Github issue][https://github.com/espressif/esp32c3-di ... /issues/10] for it, so I thought I'd try asking here. A more finely worded version of this question is:

What will the ESP32-C3 first stage bootloader do if its (embedded or external SPI) application Flash is empty/erased/unitialized and the custom board external circuitry is designed to use the USB Serial/JTAG interface for debugging, not UART0 (which is used to interface to another device's UART or even not as a UART interface at all)?

Assuming these will have nothing programmed in application Flash, i.e their app Flash will be erased or contain garbage (correct?), how will the ESP32-C3's first stage bootloader, in ROM of chips that are coming straight off tape reels to be placed on a customer's custom board, know that the USB Serial/JTAG interface needs to be initialize and enabled/selected, instead of the default UART0, to program the customer's app? Is it through an eFuse? Or must the very first customer app be written to Flash (or a "production image loader" app written to SRAM) by communicating with the first stage bootloader through UART0 (at what baud/start/stop/parity settings)? Is there an Application Note describing such a production initialization process for ESP32-C3 chip/modules?

Re: What will the ESP32-C3 first stage bootloader do if SPI Flash is empty/erased?

Posted: Wed Mar 08, 2023 12:45 am
by ESP_Sprite
Yes, the ROM will initialize USB-serial-JTAG correctly and the boards can be programmed that way. Do notice that because of reliability issues, if no valid flash image is detected the RTC watchdog triggers (if memory serves) once every five seconds or so, re-initializing the USB peripheral; that can make getting the first program in there a bit tricky. If you want that to work for sure, pull GPIO9 down on reset; that puts the chip into download mode and stops the reset loop.