Failure to flash esp8285 solved

im trying to flash a esp8285 using a ttl (https://www.amazon.co.uk/gp/product/B07BBPX8B8/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1)

i keep getting A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header

i have tried wiring i00 to gnd of the ttl, i have tried disconnecting the i00 line from gnd a min after i have connected the usb, the ttl programmer is connected to the raspberry pi 3b+ i am running home assistant on. and am using the home assistant image from the offical download,

INFO Reading configuration /config/esphome/backlight.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d /config/esphome/backlight
Processing backlight (board: esp8285; framework: arduino; platform: [email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 2.20502.0 (2.5.2) 
 - tool-esptool 1.413.0 (4.13) 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - toolchain-xtensa 1.40802.2 (4.8.2)
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.2
|   |-- <ESP8266WiFi> 1.0
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
|-- <ESPAsyncWebServer-esphome> 1.2.6
|   |-- <ESPAsyncTCP-esphome> 1.2.2
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <DNSServer> 1.1.1
|   |-- <ESP8266WiFi> 1.0
Compiling /data/backlight/.pioenvs/backlight/src/main.cpp.o
Linking /data/backlight/.pioenvs/backlight/firmware.elf
Retrieving maximum program size /data/backlight/.pioenvs/backlight/firmware.elf
Checking size /data/backlight/.pioenvs/backlight/firmware.elf
Building /data/backlight/.pioenvs/backlight/firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=====     ]  45.1% (used 36908 bytes from 81920 bytes)
Flash: [====      ]  38.6% (used 394764 bytes from 1023984 bytes)
Creating BIN file "/data/backlight/.pioenvs/backlight/firmware.bin" using "/data/backlight/.pioenvs/backlight/firmware.elf"
========================= [SUCCESS] Took 16.67 seconds =========================
INFO Successfully compiled program.
INFO Running:  esptool.py --before default_reset --after hard_reset --baud 460800 --chip esp8266 --port /dev/ttyUSB0 write_flash 0x0 /data/backlight/.pioenvs/backlight/firmware.bin
esptool.py v2.8
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
INFO Upload with baud rate 460800 failed. Trying again with baud rate 115200.
INFO Running:  esptool.py --before default_reset --after hard_reset --baud 115200 --chip esp8266 --port /dev/ttyUSB0 write_flash 0x0 /data/backlight/.pioenvs/backlight/firmware.bin
esptool.py v2.8
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
esphome:
  name: backlight
  platform: ESP8266
  board: esp8285

wifi:
  ssid: "...."
  password: "......."

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Backlight Fallback Hotspot"
    password: "OhvbXqy2p66h"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "..."

ota:
  password: "....."

after plugging the usb in i get the rx and tx leds flash after a few seconds, i read that it means the ttl is working okay, while the uploader is trying to upload only the tx led flashes before it fails,

the fail message i get is program failed with code 2

Are you sure that is the right port?

Try plugging in the USB programmer, then tie GPIO 0 to ground, and then tapping the reset pin to Vcc to reboot the chip. Sometimes I’ve found that having GPIO 0 on ground when plugging in the USB programmer doesnt actually place the ESP into flash mode, and it needs to be rebooted again (after initial power up) while GPIO 0 is grounded.

This why I love boards with built in USB! wemos d1 mini et al.

The form factor isn’t always right, but they flash easily!

Agreed!

However for pre-made things that’s just the way it is. For example I scored a bunch of WiOn switches for $3, with enough space inside to make room for a few extra sensors like temp/humidity/PIR, so I just had to do a bunch of manual flashing recently.

Good point.

solved the problem myself, sorry. half asleep me never read it instructions quite close enough and had rx to rx and tx to tx, so after swapping them to rx to tx and tx to rx all is working now, thank you for the fast reply’s and help though

3 Likes

Just remember, if something is transmitting at one end of a wire, the other end is receiving :slight_smile: