USB Programming without FTDI works on Devkit, not PCBA

stantheman286
Posts: 7
Joined: Fri Aug 05, 2022 4:04 pm

USB Programming without FTDI works on Devkit, not PCBA

Postby stantheman286 » Fri Aug 05, 2022 4:18 pm

Hi all,

I'm using the ESP32-C3-MINI-1-N4 on a custom PCBA. Before designing the board, I used the ESP32-C3-DevKitM-1 devkit to prove out USB serial programming. From what I read, it's possible to program via USB using either 1) a USB-to-serial converter chip (FTDI) or 2) directly connecting to USB. Most of what I've seen describes scenario #1, so to test out my theory I removed the FTDI chip on the devkit and connected resistors R1 and R4 so that USB was directly connected to the ESP32. Using the direct method, I was able to program the devkit automically no problem without any need for manual entry into the bootloader (i.e. using a button).

When we received our board, the ESP32 would constantly restart and the USB connection kept dropping. This happened even with a large power supply and all IOs disconnected from peripherals. Eventually, I found out if I used the manual bootloader entry (i.e. hold down BOOT/IO9 then reset or hold down EN) the ESP32 would boot and USB worked. I could then program our board.

From what I read on https://docs.espressif.com/projects/esp ... ction.html, it seems that the auto programming should only work if you have the USB-to-serial converter connected to the control lines (DTR/RTS):
In general, you should have no problems with the official Espressif development boards. However, esptool.py is not able to reset your hardware automatically in the following cases:

- Your hardware does not have the DTR and RTS lines connected to GPIO9 and EN (CHIP_PU)
- The DTR and RTS lines are configured differently
- There are no such serial control lines at all

My question is, if that's true, why can I program the devkit automatically without the FTDI chip + control lines, but I cannot do the same on my custom PCBA? Is there a fuse or firmware setting I'm missing?

Cheers,
Matt

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

Re: USB Programming without FTDI works on Devkit, not PCBA

Postby ESP_Sprite » Sat Aug 06, 2022 1:13 am

Auto programming does work, but what you're seeing likely stems from a quirk of integrating the USB-serial-JTAG device into the ESP32: in an unprogrammed chip/module, the ESP32 will boot loop every few seconds because it tries to boot (but fails) from flash. That unfortunately also resets the USB connection, and depending on the OS running on the attached computer, can make it hard to program the device. That only happens the very first time, though; as soon as there's something executable in flash, you should be able to use the auto-programming feature without issue.

stantheman286
Posts: 7
Joined: Fri Aug 05, 2022 4:04 pm

Re: USB Programming without FTDI works on Devkit, not PCBA

Postby stantheman286 » Sat Aug 06, 2022 3:52 pm

Thanks ESP_Sprite, I found that to be true when I fully erased the devkit and the boot loop occured there as well. It's a bummer that's an issue, but I think we can live with that.

As for the auto programming portion, I found that esptool wasn't auto detecting my chip, so it was setting

Code: Select all

default_reset
instead of

Code: Select all

usb_reset
for the before flash command. When I forced that on, the programming worked fine. I have a message out to Platform IO (which I'm using) since it's seems their using an older IDF version that doesn't support usb_reset in the menuconfig, though esptool supports it.

Thanks again!
Matt

Who is online

Users browsing this forum: No registered users and 76 guests