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

lanegg
Posts: 12
Joined: Thu Jan 26, 2017 2:38 am

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

Postby lanegg » Thu Mar 16, 2017 8:16 pm

I am trying to get the Arduino IDE setup for a Adafruit ESP32 Dev Board and can't get the sketch to upload to the chip. I am just trying to use the Blink example sketch. I have held down the Boot button followed by pressing the EN button before/after clicking the upload button in the IDE. I have verified the correct port is in use and have set the baud rate to 115k instead of 921k as it defaulted to.

I am able to upload images compiled using make from the command line and also from Eclipse. Is it possible that the $PATH variable added for it, or the other copy of the ESP SDK to cause a conflict?

FWIW I am using a Win10 host OS running a Ubuntu VirtualBox VM. Everything should be latest as I just setup the Arduino IDE a few minutes ago.

The error I get is (I have verbose upload logs enabled):

Arduino: 1.8.1 (Linux), Board: "ESP32 Dev Module, 80MHz, 115200, None"

Sketch uses 115275 bytes (11%) of program storage space. Maximum is 1044464 bytes.
Global variables use 9480 bytes (3%) of dynamic memory, leaving 285432 bytes for local variables. Maximum is 294912 bytes.
/home/lane/Arduino/hardware/espressif/esp32/tools/esptool --chip esp32 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_freq 80m --flash_mode dio --flash_size 4MB 0x1000 /home/lane/Arduino/hardware/espressif/esp32/tools/sdk/bin/bootloader.bin 0x8000 /tmp/arduino_build_988194/sketch_mar16b.ino.partitions.bin 0xe000 /home/lane/Arduino/hardware/espressif/esp32/tools/partitions/boot_app0.bin 0x10000 /tmp/arduino_build_988194/sketch_mar16b.ino.bin
esptool.py v2.0-dev
Connecting...

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

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

lanegg
Posts: 12
Joined: Thu Jan 26, 2017 2:38 am

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

Postby lanegg » Thu Mar 16, 2017 8:55 pm

I shut down the Ubuntu VM and tried directly from the Win10 host and got the same error. However, I shut down Putty and all Arduino IDE instances then cycled the power on the board. I started the IDE and did not start Putty and things worked. I think Putty was causing a lock on the COM port that was being released when the Putty session was stopped. Similarly, I was using Minicom on the Ubuntu machine. Even though I was stopping Minicom before I tried to flash I think something was getting dinked in the process.

Anyone who stumbles on this, make sure all your serial terminals have been shutdown and the IDE is the first thing opened.

lanegg
Posts: 12
Joined: Thu Jan 26, 2017 2:38 am

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

Postby lanegg » Fri Mar 17, 2017 1:32 am

Spoke too early. I went out for dinner and upon my return and the dev board is back to the same error about timing out waiting for a packet header. I tried the above tricks with no luck this time.

Hans Dorn
Posts: 62
Joined: Tue Feb 21, 2017 2:21 am

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

Postby Hans Dorn » Fri Mar 17, 2017 2:49 am

Hi,

try editing the last line in your platform.txt, and add "--before esp32r0" to the esptool options.

If you're lucky, you won't have to push any buttons at all when uploading.
(Worked for me on the sparkfun board)



Code: Select all

tools.esptool.upload.pattern={cmd} --before esp32r0 --chip esp32 --port "{serial.port}" --baud {upload.speed} write_flash -z --flash_freq {build.flash_freq} --flash_mode {build.flash_mode} --flash_size {build.flash_size} 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader.bin" 0x8000 "{runtime.platform.path}/tools/sdk/bin/partitions_singleapp.bin" 0x10000 "{build.path}/{build.project_name}.bin"

bombix
Posts: 12
Joined: Fri Jan 20, 2017 12:56 pm

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

Postby bombix » Wed Mar 22, 2017 4:01 pm

Hi,

Im also having this problem.
I have an ESP-WROOM-32 Dev board.
When i try to upload some firmware i get:

Connecting...

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

My platform.txt file located in arduino/hardware/expressiff last lines are:

Code: Select all

tools.esptool.upload.protocol=esp32
tools.esptool.upload.params.verbose=
tools.esptool.upload.params.quiet=
tools.esptool.upload.pattern={cmd} --chip esp32 --port "{serial.port}" --baud {upload.speed}  --before default_reset --after hard_reset write_flash -z --flash_freq {build.flash_freq} --flash_mode {build.flash_mode} --flash_size {build.flash_size} 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x10000 "{build.path}/{build.project_name}.bin"
tools.esptool.upload.network_pattern={network_cmd} -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin"
I also tryed to keep the boot button pressed during the upload. The upload happens but then the esp reboots and looks like nothing was uploaded.

Thanks in advance

lanegg
Posts: 12
Joined: Thu Jan 26, 2017 2:38 am

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

Postby lanegg » Wed Mar 22, 2017 4:11 pm

The issue is timing related to when the publish command is issued and when the boot button is pressed. I haven't nailed down exactly when things needs to be pressed, but I have had okay luck if I press the boot button while Arduino IDE is in the process of compiling the sketch. Its not 100%, but it works most of the time.

bombix
Posts: 12
Joined: Fri Jan 20, 2017 12:56 pm

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

Postby bombix » Wed Mar 22, 2017 4:18 pm

Hi,

Thanks for the tips, but unfortunaly i could get it to work after some trying several times... :/
Any sugestions?

bombix
Posts: 12
Joined: Fri Jan 20, 2017 12:56 pm

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

Postby bombix » Wed Mar 22, 2017 4:50 pm

I manage to upload pressint boot right when arduino ide starts uploading.
But after it in teh serial port i get

Code: Select all

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0008,len:8
load:0x3fff0010,len:2016
load:0x40078000,len:7780
ho 0 tail 12 room 4
load:0x40080000,len:252
entry 0x40080034
Something isnt right...

lanegg
Posts: 12
Joined: Thu Jan 26, 2017 2:38 am

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

Postby lanegg » Wed Mar 22, 2017 5:17 pm

Try again with something like Blink. I think if an Arduino sketch seg faults you get that result and the core dump or stack trace is not piped to the terminal. At least one of the sketches I was trying had that behavior, and it was because something was crashing in the sketch.

bombix
Posts: 12
Joined: Fri Jan 20, 2017 12:56 pm

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

Postby bombix » Thu Mar 23, 2017 6:01 pm

Hi,

I manage to upload using platformIO.
Do you think is better to install a linux VM to use the esp32?

Thanks in advance

Who is online

Users browsing this forum: No registered users and 55 guests