I started running into issues when I began using ESP32s instead of 8266s, I could do the initial flash over serial, and follow it up with some configuration. But the moment I tried to OTA update with further configuration, it would fail every time. The errors were always the same vein, connection reset by the ESP before the update could complete.
The error message below is the message I got every time, each time at some different percentage complete, even at 95% it would fail.
INFO Uploading /data/build/esphome-web-757c70/.pioenvs/esphome-web-757c70/firmware.bin (1370368 bytes)
Uploading: [===================== ] 35% ERROR Error receiving acknowledge chunk OK: [Errno 104] Connection reset by peer
It took quite some time of trying various actions, none of which managed to fix the issues. I could always reflash via serial, but after that it would perpetually fail to OTA update. I finally tried changing the platform from Arduino to esp-idf.
esp32:
board: esp32dev
framework:
type: arduino
I found that swapping the framework type to esp-idf instead of arduino framework, and flashing it over serial would allow me to finally be able to OTA update again on the device. I’m not sure if this will be a long term fix yet, but so far so good. It managed to fix the problem on two of my ESP32 bare boards that I had been seeing the issue with, then I went and installed it on my boards that were in devices.
esp32:
board: esp32dev
framework:
type: esp-idf
I was able to flash with that over a serial connection to the ESP, and afterwards I could finally OTA update again.
I ran into a side effect that caused my pn532 NFC readers to stop working in their default config despite compiling fine after this change. I’m still not sure what caused it, I fixed one by changing what GPIO it was connected to and then updating it a few times (oddly it didn’t work the first time).
I don’t regret making the change though I wish the same GPIO usage would work with the new esp-idf platform that worked with the Arduino platform.