Failed to connect to ESP32: Invalid head of packet ('6')

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

Failed to connect to ESP32: Invalid head of packet ('6')

Postby lanegg » Thu Jan 26, 2017 3:13 am

I just received a shiny new ESP32 Dev Board from Adafruit and am getting the above error when trying 'make flash' with the hello world getting started example.

The exact log output is:
lane@ESPDev:~/esp/esp-idf/examples/get-started/hello_world$ make flash
Flashing binaries to serial port /dev/ttyUSB0 (app at offset 0x10000)...
esptool.py v2.0-beta1
Connecting...........................................

A fatal error occurred: Failed to connect to ESP32: Invalid head of packet ('6')
/home/lane/esp/esp-idf/components/esptool_py/Makefile.projbuild:52: recipe for target 'flash' failed
make: *** [flash] Error 2

Everything is pretty much as defined following along with the tutorials. This is a brand new Virtual Box Ubuntu 16.04 VM (running on a Win10 host) built just for this purpose so other than apt update and the esp-idf tutorials its straight from the ISO.

I can connect to the device with minicom and I see UART/serial output when I RST the device so the USB port is okay. I did see some threads with folks having a similar issue with the REV1 boards. I confirmed I have the REV2 board. I also saw a thread saying to hold the EN button for 2 seconds for the REV2 boards. That made no difference for me (also the error was slightly different anyways).

Out of fear of bricking the new shiny I am punting. Can anyone offer some ideas of things to try?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Failed to connect to ESP32: Invalid head of packet ('6')

Postby kolban » Thu Jan 26, 2017 5:59 am

Howdy,
I too am running Ubuntu on Virtual Box on Windows 10 ... and I had the exact same issue. The solution (for me) was thankfully very simple.

Run "make menuconfig" and then navigate to "Serial flasher config". From there, find the entry labeled "Before flashing" and change the option to be "Reset with ESP32R0 Windows workaround".

Once done ... you might find it works as desired.

Good luck.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

js1234
Posts: 18
Joined: Thu Jan 26, 2017 1:16 pm

Re: Failed to connect to ESP32: Invalid head of packet ('6')

Postby js1234 » Thu Jan 26, 2017 1:34 pm

For me pressing the boot button on the board during the 'make flash' process helped. My error was ...Invalid head of packet(' ') i guess.

grisevg
Posts: 1
Joined: Thu Jan 26, 2017 3:29 pm

Re: Failed to connect to ESP32: Invalid head of packet ('6')

Postby grisevg » Thu Jan 26, 2017 3:36 pm

Looks like it's not Windows specific. I'm on a Mac and running IDF in Virtualbox.

I'm running Ubuntu 14.04 in Virtualbox on macOS Sierra 10.12 and had to install CP210x to get serial access to the device (Olimex dev kit board v2). Had the same issue, where I couldn't flash unless I manually put the board in download mode with buttons and disable reset before flash.

Setting "Before flashing" to "Reset with ESP32R0 Windows workaround" fixed it for me, now board resets into download mode automatically. No need to press any buttons, yay!

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

Re: Failed to connect to ESP32: Invalid head of packet ('6')

Postby lanegg » Thu Jan 26, 2017 11:35 pm

kolban wrote:Run "make menuconfig" and then navigate to "Serial flasher config". From there, find the entry labeled "Before flashing" and change the option to be "Reset with ESP32R0 Windows workaround".
Worked like a charm! Thanks!

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Failed to connect to ESP32: Invalid head of packet ('6')

Postby ESP_Angus » Fri Jan 27, 2017 12:45 am

Thanks kolban for helping lanegg figure this one out.

We're going to merge a workaround for this issue (which originally was thought to only affect Windows, but seems to sometimes affect people using VM guests on any host platform) into the default behaviour of esptool soon (thanks Marty!), so setting this option soon won't be necessary to get a successful flash.

thingsforhackers
Posts: 1
Joined: Thu Mar 02, 2017 6:19 pm

Re: Failed to connect to ESP32: Invalid head of packet ('6')

Postby thingsforhackers » Thu Mar 02, 2017 6:24 pm

Sorry to hijack the thread.

Just to say I had to enable "Reset with ESP32R0 Windows workaround" setting to get this to work on a bare metal linux (mint 18) install.

Cheers.

Who is online

Users browsing this forum: Google [Bot], LEDLIT1, MicroController and 290 guests