A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Alberto2022
Posts: 5
Joined: Mon Sep 19, 2022 11:50 am

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Postby Alberto2022 » Mon Sep 19, 2022 1:21 pm

Hi,

I'm woking on a project with a custom board based on ESP32, I attach the schematics project. When I try to load the program into the board, I get the following error:
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header.
I'm using an USB to UART converter, connecting the TX pin converter to RX custom board and RX pin to TX, both GNDs are also connected. In order to make the board enter to boot mode, I connect GPIO0 and GPIO2 directly to GND, but I can't load the program anyway.

Board is powered through Ethernet cable PoE correctly and I think connections are correct. Can someone help me?

Thanks,
Alberto
Attachments
schematics.pdf
(166.95 KiB) Downloaded 115 times

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

Re: A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Postby ESP_Sprite » Tue Sep 20, 2022 12:33 am

For one, the NCP161 can only deliver 450mA, which is a bit on the low side, be mindful that if you run into brownout issues, that may be an issue. That shouldn't stop you from being able to program the chip, though.

Basic tests: Is your 3.3V line active and stable? Can you scope out the 40MHz crystal, is it oscillating? Can you use a standard terminal on your serial-to-USB converter, see if there is any bootup chatter when you reset the ESP32?

Alberto2022
Posts: 5
Joined: Mon Sep 19, 2022 11:50 am

Re: A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Postby Alberto2022 » Wed Sep 21, 2022 10:27 am

Hi,

Thanks for reply. The 3.3V line is stable as shown here:
IMG_20220920_095948.jpg
IMG_20220920_095948.jpg (268.1 KiB) Viewed 2037 times
40 MHz crystal seems to be oscillating too:
IMG_20220920_104343.jpg
IMG_20220920_104343.jpg (321.11 KiB) Viewed 2037 times
Related to your last question, I'm not able to use a standard terminal on my serial-to-USB converter unfortunately.

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

Re: A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Postby ESP_Sprite » Thu Sep 22, 2022 12:58 am

You sure that's actually a 40MHz signal? From the picture, it could just as well be noise.

How do you mean ''Im not able to use a standard terminal on my serial-to-USB converter unfortunately.'? Simply download something like putty or teraterm, point it at the serial port the ESP32 is on, set it to 115200 baud, 8 data bits, no parity, one stop bit, and see if you get something when you reset the chip.

Alberto2022
Posts: 5
Joined: Mon Sep 19, 2022 11:50 am

Re: A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Postby Alberto2022 » Fri Sep 23, 2022 7:32 am

You're right, crystal signal seems to be noise. That's the cleanest signal I could obtain, but that's not a 40 Mhz frequency signal:
IMG_20220922_081327.jpg
IMG_20220922_081327.jpg (728.8 KiB) Viewed 1973 times
To use the standard terminal, I've implemented this setup:
setup.jpg
setup.jpg (1.13 MiB) Viewed 1973 times
I use USB to UART converter (left) to flash the custom board. To see the messages in Putty, I used an ESP32 development board (right) to see which messages are received from custom board (I used an ESP32 instead of another converter because I don't have more converters). For this, I connect TX USB to UART converter to RX custom board, and TX board to RX ESP32.

When I open Putty, I don't receive any message from custom board, only messages that come from ESP32, because when I press enable button in order to work as a converter any message is displayed.
putty.png
putty.png (63.61 KiB) Viewed 1973 times

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

Re: A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Postby ESP_Sprite » Sat Sep 24, 2022 1:23 am

Well, without 40MHz, you're not gonna get much serial output. Also, why are you using both an ESP32 as well as an USB-to-serial converter? If you connect the USB-serial to the UART0 RX and TX pins on your custom board, you should be able to use that both as a terminal as well as a programmer.

However, you need to figure out why the chip isn't generating a clock. Looking at your schematic again, it looks like at least your reset circuit is not according to the datasheet/hardware reference manual: I'd expect an 10K to 3.3V and a 100nf-1uf capacitor to ground connected to the CHIP_PU pin. Without this, the ESP32 should still start to work if you manually press the reset button, though.

Alberto2022
Posts: 5
Joined: Mon Sep 19, 2022 11:50 am

Re: A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Postby Alberto2022 » Mon Sep 26, 2022 7:40 am

I'm using both ESP32 and USB-to-serial converter because if I only use converter I can't make it work as a programmer and terminal. As putty is using the converter port, if I try to flash the program CPU can't access converter port because it is already opened:

serial.serialutil.SerialException: could not open port 'COM5': PermissionError(13, 'Acceso denegado.', None, 5)

Anyway, if I open putty connecting only converter and custom board no message is displayed.

I pressed the reset button but I still can't flash the program. I measured the other clocks signal and they all look like the one I attached previously, same frequency. In this case I think I'm just measuring noise and I'm not able to measure clock signal correctly. The PCB design was validated before in previous manufacturings and code configuration hasn't changed, but probably I'm missing something. If it can help, I also attach the project folder.

Thanks.
Attachments
DigitalReaderV1.zip
(49.12 KiB) Downloaded 110 times

Alberto2022
Posts: 5
Joined: Mon Sep 19, 2022 11:50 am

Re: A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Postby Alberto2022 » Tue Sep 27, 2022 12:20 pm

I’ve been able to upload the firmware to the custom board, there was a problem with a diode. When I open serial monitor to see messages, I see there is a problem with ESP32 and LAN8742:
ETH_error.png
ETH_error.png (6.45 KiB) Viewed 1758 times
Do you know why this happens? Maybe a hardware issue?

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

Re: A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Postby ESP_Sprite » Wed Sep 28, 2022 12:19 am

Suggest you start a new topic for that.

Who is online

Users browsing this forum: No registered users and 113 guests