OTA update error 104 (flash erase failed)

Hi,

I have problems updating my Wemos D1 mini with OTA updates. Now i program my Wemos with ESP8266 flash tool. When i try to use OTA i have this errors in my logging:

[18:12:37][D][ota:072]: Starting OTA Update from 192.168.1.188...
[18:12:37][V][ota:097]: OTA features is 0x00
[18:12:37][V][ota:171]: OTA size is 337520 bytes
[18:12:37][V][ota:219]: Update: Binary MD5 is 06ec462b243f66089e1ae7f02a1a8b52
[18:12:37][D][ota:243]: OTA in progress: 0.3%
[18:12:37][W][ota:233]: Error writing binary data to flash: 0 != 536!
[18:12:37][W][ota:276]: Update end failed! Error: ERROR[2]: Flash Erase Failed


[18:13:09][I][ota:046]: Boot seems successful, resetting boot loop counter.

And this is the message in my compile and upload screen:

INFO Successfully compiled program.
INFO Resolving IP address of esp_meterkast.local
INFO  -> 192.168.1.164
INFO Uploading /config/esp_meterkast/.pioenvs/esp_meterkast/firmware.bin (337520 bytes)
Uploading: [==                                                          ] 3% 
ERROR Error sending data: [Errno 104] Connection reset by peer

My config is:

esphome:
  name: esp_meterkast
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "xxx"
  password: "xxx"
  # Optional manual IP
#  manual_ip:
#   static_ip: 192.168.1.164
#    gateway: 192.168.1.1
#    subnet: 255.255.255.0
    
# Enable logging
logger:
  level: VERBOSE
  
# Enable Home Assistant API
api:

ota:

switch:
  - platform: gpio
    name: "Deurbel uitzetten"
    pin: D1
    
binary_sensor:
  - platform: gpio
    name: "Deurbel"
    pin:
      number: D8
    filters:
      - delayed_off: 100ms

Anyone with idea’s?

Same here. Did you find a solution? I created https://github.com/esphome/issues/issues/845 before I found this post.

I’ve seen this a lot since the latest update. Seems to happen when the chip gets busy with the current code while it is being reflashed. I’ve rewritten code to have a quiet mode which I can employ during reflash.

Hi @Giel538

Were you able to solve this? It is just happening with Wemos D1 or all boards?

I suffered this on a D1 Mini - apparently they are supposed to have 4M flash, but many of the clones only have 1M. Setting the board to esp01_1m got the OTA working for me (you lose the D1 Mini specific pin mapping to Dx and need to revert pin names to GPIOx - which is frustrating but not the end of the world)

1 Like