homieiot / homie-esp8266

💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
http://homieiot.github.io/homie-esp8266
MIT License
1.36k stars 308 forks source link

OTA with BAD_CHECKSUM making device not responsible #208

Closed camilorodegheri closed 7 years ago

camilorodegheri commented 7 years ago

Hi,

I've been testing the new changes with OTA and base64 and I haven't been able to successfully get it to work yet.

To report the current situation, when sending a ota (using @mrpace2 script) the device is issuing a 400 BAD_CHECKSUM, but rebooting and then not responding until hard reset.

I can provide the logs from serial and mqtt if needed.

Is there anyone working on this? Otherwise I can take a look at it and try to solve it.

marvinroger commented 7 years ago

Can you test without base64? I think the base64 implementation is somehow broken.

ghost commented 7 years ago

A pair of MQTT and serial logs would be great. Also, can you share your base64-encoded firmware and the matching firmware binary? Note that this is just for trying to help with the 400 BAD_CHECKSUM.

You must have sent an MD5 which is why Homie rebooted after the failed OTA attempt. Something went wrong during that reboot. This is probably unrelated to the triggering 400 BAD_CHECKSUM issue. See #204.

marvinroger commented 7 years ago

@camilorodegheri Closing this, as the base64 OTA issue will be tracked here: #204

but rebooting and then not responding until hard reset

As @mrpace2 said, there's a known esp8266/Arduino issue. When you flash a firmware over Serial, calling ESP.restart() right after (which is done internally in Homie) hangs the ESP8266 the way you're experiencing it. However, if you power cycle the device after the flash, it will work restart without any issues.

So, as a rule of thumb: after you flash any sketch on the ESP8266, power cycle it once. There won't be any ESP.restart() issues after that. 😉

marvinroger commented 7 years ago

@camilorodegheri but still, if you can provide the base64-encoded firmware and the matching firmware binary, it would be great.

ghost commented 7 years ago

@marvinroger I was able to duplicate this issue. Now looking into it. Can you please reopen it?

marvinroger commented 7 years ago

@camilorodegheri can you test again with the latest git rev?

marvinroger commented 7 years ago

@camilorodegheri any news?

marvinroger commented 7 years ago

Closing as it seems to be resolved. Feel free to reopen if needed.