Unable to program/Boot loop custom ESP32-C3-MINI board

TheRideMaker
Posts: 5
Joined: Tue Apr 05, 2022 10:58 pm

Unable to program/Boot loop custom ESP32-C3-MINI board

Postby TheRideMaker » Tue Apr 05, 2022 11:20 pm

Hi everyone, I'm currently tryin to develop a custom board based on the super compact ESP32-C3-MINI-1-N4.

This is (or it should be, at least) an improved version of another board of mine, based on ESP32-WROOM-32 that was tested and working.

I wanted to make a smaller board, with USB charge functionality. Board programming should happen via RX/TX pins, I am using an external USB to TTL converter, that worked fine with the wroom board.
If you are wondering why am I not using USB to directly program the board by putting the converting onboard, it was a matter of size constraints that I had to follow. I know, having usb for power only is pretty dumb but hey, it is what it is :D this is just a proto board anyway.

What I'm experiencing here is a boot loop that does not let me program the board.
The power elements (load sharing P-MOSfet, USB charge circuit) comes from a Adafruit Feather board, while all the remaining elements are the same from the wroom board, which works perfectly fine.

I assembled both my boards with JLCPCB service, now that i got the C3 one i'm trying to upload my code but the loop is preventing me to do so. It's a 3.3V board.

I'm working in Arduino IDE
ArduinoConfig.png
ArduinoConfig.png (11.98 KiB) Viewed 11001 times
When I try to upload a basic test sketch I get connection failures

Code: Select all

A fatal error occurred: Failed to connect to ESP32-C3: Invalid head of packet (0x**)
The serial monitor is simply spamming "invalid header: 0xffffffff" messages and restarts

Code: Select all

01:10:48.528 -> Build:Feb  7 2021
01:10:48.528 -> rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
01:10:51.134 -> invalid header: 0xffffffff
01:10:51.134 -> invalid header: 0xffffffff
[...]
01:10:51.134 -> invalid header: 0xffffffff
01:10:51.134 -> invalid header: 0xffffffff
01:10:49.831 -> invalid heade⸮ESP-ROM:esp32c3-api1-20210207
01:10:49.831 -> Build:Feb  7 2021
01:10:49.831 -> rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
01:10:49.831 -> Saved PC:0x4004d1f8
01:10:51.134 -> invalid header: 0xffffffff
01:10:51.134 -> invalid header: 0xffffffff
[...]
01:10:51.134 -> invalid header: 0xffffffff
01:10:51.134 -> invalid header: 0xffffffff
01:10:51.134 -> invalid heade⸮ESP-ROM:esp32c3-api1-20210207
01:10:51.134 -> Build:Feb  7 2021
01:10:51.134 -> rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
01:10:51.134 -> Saved PC:0x4004d1f8
01:10:51.134 -> invalid header: 0xffffffff
01:10:51.134 -> invalid header: 0xffffffff
[...]
01:10:51.134 -> invalid header: 0xffffffff
01:10:51.134 -> invalid header: 0xffffffff
01:10:51.460 -> invalid he⸮ESP-ROM:esp32c3-api1-20210207
01:10:51.460 -> Build:Feb  7 2021
01:10:51.460 -> rst:0x10 (RTCWDT_RTC_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
01:10:51.460 -> invalid header: 0xffffffff
01:10:51.506 -> invalid header: 0xffffffff
01:10:51.506 -> invalid header: 0xffffffff
Here is my schematic
Schematic_V2.png
Schematic_V2.png (93.1 KiB) Viewed 11001 times
I really have no idea of what's happening here, the WROOM board was fresh and working out of the factory.

Any help would be appreciated, thanks everyone.

ESP_Sprite
Posts: 9583
Joined: Thu Nov 26, 2015 4:08 am

Re: Unable to program/Boot loop custom ESP32-C3-MINI board

Postby ESP_Sprite » Wed Apr 06, 2022 12:06 am

So, em, the C3 has a built-in USB-to-serial-JTAG converter... you just had to hook up the data lines to GPIO18/19 pins and you would have a completely integrated programmer. May still be worth looking at for V2.

And you may need a V2, as the C3 uses GPIO9 to get into download mode, not GPIO0.Try to ground GPIO9 and try programming again, pretty sure that will work.

TheRideMaker
Posts: 5
Joined: Tue Apr 05, 2022 10:58 pm

Re: Unable to program/Boot loop custom ESP32-C3-MINI board

Postby TheRideMaker » Wed Apr 06, 2022 7:40 am

ESP_Sprite wrote:
Wed Apr 06, 2022 12:06 am
So, em, the C3 has a built-in USB-to-serial-JTAG converter... you just had to hook up the data lines to GPIO18/19 pins and you would have a completely integrated programmer. May still be worth looking at for V2.

And you may need a V2, as the C3 uses GPIO9 to get into download mode, not GPIO0.Try to ground GPIO9 and try programming again, pretty sure that will work.
Ok, let's add a +1 to my dumb counter for this PROG GPIO error :D
What do you mean with "v2"? I did not find multiple versions for the C3-MINI- module on JLCPCB catalog.

Do you (or anyone else) see any other flaw on my circuit? Should I open another post for circuit review? This may be off-topic here

I do understand that i can't get into PROG mode with my current PROG button, but I still don't understand why the board is constantly resetting.

Code: Select all

01:10:51.134 -> rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
01:10:51.460 -> rst:0x10 (RTCWDT_RTC_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
where can I get more informations about these messages?

Regarding the JTAG converter, would it let me program the board via Arduino IDE too? I sticked to the UART programming as it's the only one I've ever used and that worked on my previous board.

Thank you

ESP_Minatel
Posts: 364
Joined: Mon Jan 04, 2021 2:06 pm

Re: Unable to program/Boot loop custom ESP32-C3-MINI board

Postby ESP_Minatel » Wed Apr 06, 2022 8:20 am

Hi,

Your board looks similar to one I've created, the Rust Board.

This board uses the embedded USB for flashing and debugging. For the first time, you need to enter into BOOT MODE manually by the GPIO9 to GND (use a pulldown resistor!) and reset the C3. After that, you need to flash and manually reset again.
For the second time flashing, you don't need to do it manually anymore.

Please take a look at the schematics I shared and compare them to yours.

TheRideMaker
Posts: 5
Joined: Tue Apr 05, 2022 10:58 pm

Re: Unable to program/Boot loop custom ESP32-C3-MINI board

Postby TheRideMaker » Wed Apr 06, 2022 8:32 am

ESP_Minatel wrote:
Wed Apr 06, 2022 8:20 am
Hi,

Your board looks similar to one I've created, the Rust Board.

This board uses the embedded USB for flashing and debugging. For the first time, you need to enter into BOOT MODE manually by the GPIO9 to GND (use a pulldown resistor!) and reset the C3. After that, you need to flash and manually reset again.
For the second time flashing, you don't need to do it manually anymore.

Please take a look at the schematics I shared and compare them to yours.
Hi, thank you for your reply, I will definitely check your schematics for improvements!
Are you able to program the board via Arduino IDE?

ESP_Minatel
Posts: 364
Joined: Mon Jan 04, 2021 2:06 pm

Re: Unable to program/Boot loop custom ESP32-C3-MINI board

Postby ESP_Minatel » Wed Apr 06, 2022 12:07 pm

Yes. You need just to select the right option in the Arduino IDE menu.

USB CDC Docs

ESP_Sprite
Posts: 9583
Joined: Thu Nov 26, 2015 4:08 am

Re: Unable to program/Boot loop custom ESP32-C3-MINI board

Postby ESP_Sprite » Wed Apr 06, 2022 12:52 pm

TheRideMaker wrote:
Wed Apr 06, 2022 7:40 am
What do you mean with "v2"? I did not find multiple versions for the C3-MINI- module on JLCPCB catalog.
I mean V2, as in, version two of the board that you're going to make. (Assuming you're going to respin it instead of bodging the corrections in and calling it a day.)
I do understand that i can't get into PROG mode with my current PROG button, but I still don't understand why the board is constantly resetting.

There's nothing in your flash, but if GPIO9 is high, the ESP32 tries to boot from there anyway. So it tries, fails, then gets reset by one of the two watchdogs, tries again, fails etc.

TheRideMaker
Posts: 5
Joined: Tue Apr 05, 2022 10:58 pm

Re: Unable to program/Boot loop custom ESP32-C3-MINI board

Postby TheRideMaker » Wed Apr 06, 2022 5:36 pm

ESP_Sprite wrote:
Wed Apr 06, 2022 12:52 pm
I mean V2, as in, version two of the board that you're going to make. (Assuming you're going to respin it instead of bodging the corrections in and calling it a day.)
Ah yes, I will re-design a correct and improved version.
ESP_Sprite wrote:
Wed Apr 06, 2022 12:52 pm
There's nothing in your flash, but if GPIO9 is high, the ESP32 tries to boot from there anyway. So it tries, fails, then gets reset by one of the two watchdogs, tries again, fails etc.
Ah I see. Got It, thank you.

I managed to enter download mode

Code: Select all

19:30:08.287 -> Build:Feb  7 2021
19:30:08.287 -> rst:0x1 (POWERON),boot:0x0 (USB_BOOT)
19:30:08.287 -> wait usb download
But I am still unable to connect to the board, now i get a timeout error.

Code: Select all

Failed to connect to ESP32-C3: Timed out waiting for packet header
Is my schematic that bad?

ESP_Sprite
Posts: 9583
Joined: Thu Nov 26, 2015 4:08 am

Re: Unable to program/Boot loop custom ESP32-C3-MINI board

Postby ESP_Sprite » Thu Apr 07, 2022 1:05 am

Code: Select all

19:30:08.287 -> rst:0x1 (POWERON),boot:0x0 (USB_BOOT)
That is the wrong download mode... from your schematic, you haven't connected the other bootstrap pins (gpio2 & 8) to anything either. You want to have pullups on both pins. Try forcing them high and try again.

TheRideMaker
Posts: 5
Joined: Tue Apr 05, 2022 10:58 pm

Re: Unable to program/Boot loop custom ESP32-C3-MINI board

Postby TheRideMaker » Tue Apr 12, 2022 4:27 pm

Hi, sorry for the late answer. Busy days.

Yes, by pulling the bootstrapping pins correctly I managed to enter the correct download mode and flash a test sketch.

It worked, thank you very much! I won't forget to properly double check the datasheet ever again.

I didn't find much on the datasheet about the download modes, if I were to use the indegrated jtag interface, would the download mode be the same used for uart programming?

I will make some improvements to my board and make a better, corrected version. Thank you very much for the help.

Who is online

Users browsing this forum: No registered users and 44 guests