igrr / esptool-ck

ESP8266 build/flash helper tool by Christian Klippel
GNU General Public License v2.0
360 stars 123 forks source link

espcomm_sync fails if 7 SLIP packets have not been received after a successful sync #83

Closed mattbaker-digital closed 3 months ago

mattbaker-digital commented 3 months ago

espcomm_sync in espcomm/espcomm.c requires a total of 7 SLIP response packets for the function to return as a success. Based on my testing, the ESP device can actually send less than 7 sync command responses. The loop should just be used to throw away any sync command responses (with no minimum), ready for subsequent commands.

mattbaker-digital commented 3 months ago

I now see that the stub flasher should send back these additional identical sync command responses: https://github.com/espressif/esptool/blob/master/flasher_stub/stub_flasher.c#L233

The official Espressif docs weren't very descriptive about the correct response to a sync command / payload: "The host should wait until it sees a valid response to a SYNC command"