Airrohr flasher: failed to connect to espressif device: timed out waiting for packethead

hello everyone, im new to the sensor Community and i have a problem with my SDS011. when i press upload in the airrohr flasher i get the message: failed to connect to espressif device: timed out waiting for packethead. board: n/a (com4) firmware software: latest_en.bin. does anyone know what to do? thanks!

Check the following:

  1. Software has enough rights to use connection port. Run under admin user if needed.
  2. Change USB cable for a shorter one.
  3. Try another computer to flash NodeMCU

The firmware flasher is supposed to flash the ESP8266 not the SDS011. The cable as to be a real data one (most of the time the short cables are) not a cable to charge the battery. Did you install the CH341 driver ?

yes i installed the CH341 driver and i use a short cable (not a cable to charge a battery). when i try to flash the ESP8266 it does say its connecting but then i get the same message. i run it under admin user but that also dint work.

greetings, i am having the same problem, chip detection works but the firmware flash always fails with the timeout error. i have tried at least a dozen of different usb cables and two computers, on one of them i tried also on windows just to be sure and it does the very same…can it be a problem with the board itself? is there any blinking leds supposed to come up during operation? so far only one, blue, flashes once very quickly when you connect the board and then nothing…any suggestions are appreciated

Maybe it is a new kind of ESP8266 (is it really exactly this microcontroller?) and you have to press the RST and FLASH buttons at some points as we had to do in the past. It would explain the timeout error of @uovobw.

Alternatively you can use the Arduino IDE. Without flashing with it you could firstly monitor the COM port to see what happens when the board is plugged to the computer (but close the SC flasher app to avoid COM conflict).

Another solution: you can use the instruction “screen” in the terminal.

List the COM ports to identify the one of the ESP8266:

ls /dev/tty.* (it should looks like that...)

Open the port:

screen /dev/tty.wchusbserialfa140 9600 (should be the right bauds)

When in screen try to press RST and FLASH (there you be an order) to know how toput the board in flashing mod. You should see a message “flash mode activated” or something like that. I can’t remember exactly.

Then get the name of the opened screen instruction:

screen -ls

Close the screen (you must stop it before doing anything else, for example open the flasher or the IDE) :

screen -X -S 7210.ttys000.MacBook quit (the name will not be the same)

There is also a kind of generic app to flash the esp8266 but I can’t find it anymore in the internet. I succeeded to flash with it once.

i have checked again and the chip is indeed ESP8266 as displayed on the code:

Connecting....
Detecting chip type...ERROR:root:Unhandled exception
Traceback (most recent call last):
  File "/home/nrz/airrohr-firmware-flasher/airrohrFlasher/utils.py", line 32, in run
  File "/home/nrz/airrohr-firmware-flasher/airrohr-flasher.py", line 310, in flash_board
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 95, in inner
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 606, in flash_defl_begin
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 338, in check_command
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 316, in command
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 261, in read
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 1796, in slip_reader
esptool.FatalError: Timed out waiting for packet content
 ESP8266
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Compressed 563920 bytes to 399630...
Connecting....
Detecting chip type...ERROR:root:Unhandled exception
Traceback (most recent call last):
  File "/home/nrz/airrohr-firmware-flasher/airrohrFlasher/utils.py", line 32, in run
  File "/home/nrz/airrohr-firmware-flasher/airrohr-flasher.py", line 310, in flash_board
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 95, in inner
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 606, in flash_defl_begin
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 338, in check_command
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 316, in command
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 261, in read
  File "/home/nrz/.local/lib/python3.6/site-packages/esptool.py", line 1796, in slip_reader
esptool.FatalError: Timed out waiting for packet content

i have pushed the two buttons on the board for about 10 seconds, nothing happened execpt for a fast flash of the blue led once after i let go. still get the error.

How did you get this logs ? With the IDE. If 2 instances of apps are opened on the same COM port it can’t work.

I will explain the hard way…

Looks for esptool.py in your computer and write the fullpath somewhere.
Then in terminal:

sudo python <PATH TO>/esptool.py --baud 921600 --port /dev/tty.SLAB_USBtoUART  (IF IT IS THE PORT NAME) write_flash -fm dio 0x00000 <PATH TO>/latest.bin (OUR FIRMWARE)

Try also with python3 if it is not working. But before close the COM port of the ESP8266 and all the apps which could try to open it. It should work without pressing the buttons.

Verify that the boards is recognized and get the name with:

ls /dev/tty.* 

before launching the main instruction.

We will succeed!
Send me all the results in terminal.

you are 100% correct, i did not explain myself correctly, i apologize. i will describe the full procedure.

i have no esptool installed, i’m only using the file downloaded from Index of /airrohr/flashing-tool and specifically the one for ubuntu 18.04, md5sum ae023f9c72a428cce4dc5e8f4fb24f7a

i connect the board, assembled as per instructions here Sensor Community (using a number of cables, almost a dozen of them) and i get a single quick flash of the blue led.

next, after chmodding it, i run the command:

./airRohr-firmware-flasher-0.3.2-Ubuntu_18.04_amd64

from the home of the user on my system (that is part of the dialout group, since the permissions of the /dev/ttyUSB0 device that gets created at device connection are

crw-rw---- 1 root dialout 

as expected)

when the tool comes up with the same window displayed on the guide linked above, i press the update button (after selecting the latest_en.bin file in the dropdown) and get the log i posted in my last post.

just to make sure i’m not slowly going crazy, i have installed the python esptool inside a virtualenv for my local user, using the python3 -m venv /home/USER/esptool path and then installing the esptool as specified on their page, with pip install esptool. This gives me the current path to the tool as

/home/USER/esptool/bin/esptool.py

i can then run the command you specified above from within the virtualenv

(esptool) USER@user:~$ sudo /home/USER/esptool/bin/esptool.py --baud 921600 --port /dev/ttyUSB0 write_flash -fm dio 0x00000 /home/USER/latest_en.bin

where the USER is my user, the ttyUSB0 comes from device that gets created upon device connection and i get the following log:

sudo /home/USER/esptool/bin/esptool.py --baud 921600 --port /dev/ttyUSB0 write_flash -fm dio 0x00000 /home/USER/latest_en.bin 
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: THE_MAC_ADDRESS
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600

A fatal error occurred: Timed out waiting for packet header

i have tried this with at least 5 usb cables among the most promising ones.

i think the issue comes from either the chip or the code, but my serial-fu is weak :slight_smile:
thanks a lot for your time and patience, saludos

It is incredible! There is basically a problem with the chip (I already experienced hard to flash board but not like that). Has something already been loaded in the ESP8266 before ? My last suggestion : you do some physical connection for both the buttons. It should be pin 0 and pin 2 (Check the datasheet, I am not sure, or maybe with a small condensator for the flash) which has to be connected to ground. You do 2 shunts and play the python tool again. I already succeeded to do this with a dying ESP32. There also should be some direct RX TX, that you can use with a USB2TTL. I hate it when electronical stuff resist to people…

that’s where my expertise completely ends, i have no idea what you mean with “physical connection for both the buttons” and “You do 2 shunts”. i am bit wary of fiddling with the device physically as i have zero eletrical experience…

You take some dupont cables (the small cables with the black connectors) and plug the pin of a GPIO (a pin with a number) and a GND pin! The buttons do exactly the same. Do you have a USB2TTL dongle (the usb stick given with an SDS011 for example)? The problem can be a cut line somewhere in the PCB.

sorry for being a bit dense, i want to make sure i got this correctly. i currently have a number of other wires that run from the board itself to the sensor, can i use one of those or do i need a different one?
what words do i need to look at on the datasheet to get the correct gpio pins? once i have “shunted” those two pins i’m supposed to connect the board via usb to my pc and then run the flash software, right? then, if/when the flash succeeds, i can remove that cable and i should be set, correct?
many thanks for your patience

EDIT: i forgot to mention, i’m going away for business starting tomorrow and i’ll be back on the 31st, so until then i doubt i’ll be able to do this procedure, so if i stop replying i’m not dead, just abroad.

Actually I found the flasher.exe:

https://github.com/nodemcu/nodemcu-flasher/blob/master/Win64/Release/ESP8266Flasher.exe

You could also try with it.

As the sensor does not work:
1- remove all the cable and start over with the ESP only.
2- connect the pins like this:


This should force the flash mode.
3-connect the ESP to the USB and monitor what it tells. It should be something like “flash mode ready…” If not make a connection like this once (connect and disconnect) to reset (don’t touch the first connection):

You should see “Reset…” and then “flash mode ready…” in the monitor.

4-When the flash mode is activated try to flash with the esptool.py
5-Remove the first connection.

Oh oh… I put a picture of the V2 not the V3

and i’m back!
thanks @pjg for the detailed howto, i think i have performed all the steps correctly but i still am unable to elicit any response from the board or flash it. is there any way i can change it to another board and/or run the sensor on a raspberry pi/odroid? i have an odroid that is just sitting there doing nothing, i might try to connect the pins on that gpio board and see if i can get it to work? do you think it would be too complex?
thanks again for your time!

AAAAAARGH! i made it to flash correctly, it was just a matter of disconnecting all the sensors cables, powering it on with the “flash” button pressed, then powering it off and reconnecting it to the usb. it flashed like a charm in a few seconds.

now i’ve been waiting for the network name specified at Sensor Community to pop up, but that is a matter for another thread. thanks a lot in the meantime!

2 Likes

Gott sei Dank !
Dieu merci !
:slight_smile:
You’re welcome!