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

rt2gaurav
Posts: 6
Joined: Tue Oct 19, 2021 3:59 pm

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

Postby rt2gaurav » Tue Oct 19, 2021 5:16 pm

I have a custom board where I am using an ESP32 Wroom module. I am not able to flash code via serial communication. I am using FTDI232 USB to UART for serial communication. I am able to get serial messages in my serial monitor which mean there is no issue in serial wires.

I have attached a capacitor and a pull up resistor on EN line. GPIO0 is also pulled to GND during flashing the code. Please see the attached rough schematic of my system and timing diagram for more information. I have jumped my EN and GPIO0 line from board to a breadboard where I am manually jumping the EN & GPIO 0 wires to GND. This is just to be sure that I am pulling down the signals while booting and there is no noise or sudden voltage fluctuation while toggling the signals.

For extra precaution I have also pulled up or pulled low other strapping pins as shown in schematic.

While uploading the code I pull down first GPIO 0 line and then EN line to GND and later when I see

Code: Select all

'Connecting........_____'
message on my Arduino IDE terminal I pull up the EN line and continue pressing the GPIO0 line to GND until the Arduino IDE display error message:

Code: Select all

'A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header'
I know I can enter my ESP32 into program mode as I see following message on my serial monitor. Whenever my GPIO 0 is low and then when I toggle the EN signal from 1 (high) to 0 (low) and then back to 1(high). It shows following message which is good

Code: Select all

'rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download'
I am not sure where I am doing mistake.
Attachments
IMG_3421.jpg
IMG_3421.jpg (2.06 MiB) Viewed 7886 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 » Wed Oct 20, 2021 1:36 am

Looks good, seems you have tested most variables. The only thing you didn't (couldn't) test is the Tx line of your serial adapter into the Rx of the ESP32. Are you sure that is connected properly and not shorted or anything?

rt2gaurav
Posts: 6
Joined: Tue Oct 19, 2021 3:59 pm

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

Postby rt2gaurav » Wed Oct 20, 2021 4:51 am

I am seeing the serial printouts on my terminal window which means that the Rx & Tx lines are correctly wired and works properly.

I have a SD card slot which is connected to GPIO12 which has pull up with 56K resistor on that line. I later removed that resistor to isolate the issue but I could get into boot mode before too when I had pull up resistor of 56K on GPIO12. After removing the pull up resistor I see similar output.

Since I was able to go into boot mode even with GPIO12 pulled high which shows that on reset GPIO0 has more priority than GPIO12 and thus it check if the GPIO0 is low on reset and goes into boot mode with caring GPIO12.

I am able to go into normal mode and boot mode with help of GPIO0 and EN line. Can you verify if the timing of the signal looks good as I am doing it manually. Does it have any strict timing restrain.

Thanks,

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 Oct 20, 2021 6:06 am

rt2gaurav wrote:
Wed Oct 20, 2021 4:51 am
I am seeing the serial printouts on my terminal window which means that the Rx & Tx lines are correctly wired and works properly.
That is evidence that the ESP32 TX is properly connected to the PCs RX. That says nothing about the connection between the ESP32 RX and the PCs TX line.
I am able to go into normal mode and boot mode with help of GPIO0 and EN line. Can you verify if the timing of the signal looks good as I am doing it manually. Does it have any strict timing restrain.
I think the actual timing restrictions are in the datasheet, but honestly: if you see the 'Waiting for download' on your terminal, you're doing it correctly.

Who is online

Users browsing this forum: homedad and 48 guests