arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.2k stars 4.81k forks source link

S26i - New? and "fatal error occurred: Timed out waiting for packet header" error #5382

Closed neirbomn closed 5 years ago

neirbomn commented 5 years ago

I started to post issue on esptool but believe it's more appropriate here due to last observation. I don't know if there's anything in it.

Sorry the details below are long but it saves me going over old ground! I know what the error means but I don't know why I'm getting it or how to troubleshoot any further with the S26. Any help gratefully received.

Full esptool.py command line as run:

Various... Using an FT232 (spec here)

$ esptool.py --p /dev/cu.usbserial-AL00M1ON erase_flash

and also

$ esptool.py --p /dev/tty.usbserial-AL00M1ON erase_flash

Using Freetronics USB to Serial ATmega16u2 MCU. (Specs here-ish)

$ esptool.py --p /dev/tty.usbmodem1411 erase_flash

Full output from esptool.py (please copy and paste all lines of output)

Using an FT232

esptool.py v2.6
Found 2 serial ports
Serial port /dev/cu.usbserial-AL00M1ON
Connecting........_____....._____....._____....._____....._____....._____....._____
/dev/cu.usbserial-AL00M1ON failed to connect: Failed to connect to Espressif device: Timed out waiting for packet header

Only change with ATmega16u2 MCU is port name change.

What is the expected behaviour?

Successful erasing of flash memory

Do you have any other information from investigating this?

Here is what I have checked (with two separate Sonoff S26s purchased from iTead):

  1. Continuity test of all Dupont cables used. All pass.
  2. Each gives the expected behaviour when powered on (though I haven't configured or paired with eweLink app).
  3. Pressing the button on the case of each switches the relay.
  4. On ESP board (disconnected from mains power) - soldering the tested Dupont cables either on solder pads (or Jx joints to mainboard) powers on device. LED behaviour as expected.
  5. Power cycling S26 with GPIO0 grounded causes LED to remain unlit (expected behaviour).
  6. The momentary button on board has been suspect for others so have bypassed button and grounded across solder points for button. When powered without grounding GPIO0, grounding the wire causes red LED to come on, and when held in place green LED changes sequence of blinks to indicate readiness for pairing. Grounding during power cycle produces same behaviour as when pressing button.
  7. I have used esptool.py -p /dev/cu.*** and esptool.py -p /dev/tty.*** where *** depends on USB to serial device being used to try and erase flash.
  8. The FT232 supplies 5V power (I know as it fried an ESP-01 and caught me out a year or two ago) even though it has a 3.3V switch this is just for the logic. Power remains at 5V. For this device I attached at Vin and GND on the DS117 Voltage regulator. The Vout is 3.3V exactly. I have tried this on a USB powered hub as well as the MacBook and used a separate USB phone charger for power from a NodeMCU board (500mA max current from 5V pin) with common ground with the FT232 or ATmega16u2 MCU.
  9. Using an Adafruit Huzzah, esptool reads, writes and erases as expected.
  10. Using an ESP-01 FTDI adapter and an ESP-01, reads, writes and erases as expected.
  11. I have tried at various baud rates (115200 etc... includng 74880 and 9600) to no avail using esptool.

Is there any other information you can think of which will help us?

The Sonoff S26s (I bought 5 and now wish I hadn't!) have a sticker on the relay which says the unit is an S26I (capital i). I note all in the S26 section ONLY have S26 on them (or I may be clutching at straws!).

Jason2866 commented 5 years ago

You are not in flash mode. Have you connected GPIO 0 before you power it with 3.3V and connecting USB serial adapter to PC?

neirbomn commented 5 years ago

You are not in flash mode. Have you connected GPIO 0 before you power it with 3.3V and connecting USB serial adapter to PC?

Thanks for your response. I have flashed plenty of ESP8266 chips. These are proving somewhat stubborn. I'm aware what the error means and I have tried to rule out all obvious things. I can confirm USB Serial adapter is connected to MacBook when attempting to flash and yes GPIO0 is grounded when powering on.

From my initial post:

Power cycling S26 with GPIO0 grounded causes LED to remain unlit (expected behaviour). The momentary button on board has been suspect for others so have bypassed button and grounded across solder points for button. When powered without grounding GPIO0, grounding the wire causes red LED to come on, and when held in place green LED changes sequence of blinks to indicate readiness for pairing. Grounding during power cycle produces same behaviour as when pressing button.

I was under the impression power cycling the device with GPIO0 grounded and the LED being unlit was a good indication that it was in flash mode for S26 but aware that this error commonly means it isn't.

Could there be anything in this observation?

The Sonoff S26s (I bought 5 and now wish I hadn't!) have a sticker on the relay which says the unit is an S26I (capital i). I note all in the S26 section here ONLY have S26 on them (or I may be clutching at straws!).

Jason2866 commented 5 years ago

Green led blinking sounds weired... It looks like something prevents to ground Gpio 0. Do you can upload some photos? Is there anything else connected to GPIO 0 on the board?

Jason2866 commented 5 years ago

If it is similar to this https://github.com/arendst/Sonoff-Tasmota/issues/2808#issuecomment-419665963 you can desolder the ESP daughter board and try to flash it without anything else connected

neirbomn commented 5 years ago

I have already done this too, see my comments at end of thread.

Green LED blinking only occurs when you power device and then ground. This is the expected behaviour to pair if you wanted to use the eweLink app.

neirbomn commented 5 years ago

I will try one more device but I am waiting on some more flux to arrive to ensure I have good joints. I am going to video the whole process and will post the link here showing each and every check I've made along the way. If I get success I will say so and close issue. I just am struggling to see what I'm doing wrong.

ascillato2 commented 5 years ago

Please, when you have time, tell us if that works for you. Thanks. If you need further assistant, please find us in the Tasmota Support Chat. Thanks

Support Information

See Wiki for more information. See Chat for more user experience.

neirbomn commented 5 years ago

@ascillato2 On yet another device... the procedure I am using doesn't flash the device. Video of the procedure used is here.

I would be very grateful if anyone can help me get to the bottom of this.

Jason2866 commented 5 years ago

I can see no error in your flash process. Esptool.py is the reliable tool for flashing. Could you make good photos (front and rear side) of the Esp daugtherboard? Maybe something is connected to rx and tx lines from esp. This would explain the behaviour. You could measure tx and rx against gnd and 3.3V (not powered) how many kOhms you have here

neirbomn commented 5 years ago

Ok - here they are... Front of board.

Back of board.

Nothing much happening on the back of the board just the flash memory.

Jason2866 commented 5 years ago

image Measure if chip pin25 goes to ERX and if pin26 goes to ETX Between ETX to GND or 3.3V should be high ohm. Same for ERX

neirbomn commented 5 years ago

Both show 0 ohm between pin of ESP and the relevant solder pad meaning they are connected. Both show high between ETX -> GND (and 3.3V) and RTX -> GND (and 3.3V).

To eliminate the USB to serial device as a possible weak link, I have ordered a Sparkfun Beefy 3 to try the flashing procedure. I am starting to think the issue is not on the board but further up the chain. If ESPtool can't reach the S26 due to an error with the USB to serial device would I receive the Timed out waiting for packet header error?

Jason2866 commented 5 years ago

What are you are doing would have been my suggestion too. i am thinking that your setup doesnt work with this device (why i dont know...) so buying a know to be good USB - serial is one point the other trying a different PC I see no reason why it shouldnt be possible to flash....

neirbomn commented 5 years ago

I'm pleased to report that after obtaining the Sparkfun Beefy that I have successfully flashed the S26. I had previously tried installing FTDI drivers on their website. In addition to buying this FTDI, I also uninstalled these in case there were conflicts between the Apple drivers and the FTDI drivers. Which one of these was responsible I'm not sure but I can now flash the devices! Yay!