JAndrassy / ArduinoOTA

Arduino library to upload sketch over network to Arduino board with WiFi or Ethernet libraries
GNU Lesser General Public License v2.1
450 stars 91 forks source link

Samd21 OTA over WiFi (ESP32) #114

Closed Fahadk7 closed 2 years ago

Fahadk7 commented 2 years ago

Hi, I have been working on a project which requires samd21 and esp32 together for an on-field IoT device , connected over AWS I am aware of how to perform OTA for esp32 with AWS libraries but need some guidance to do the same for SAMD21 connected over serial UART to esp32. Any help is appreciated, as this is my first time working with SAMD chips Will this library support the operation? Do I need to download the firmware(in binary format) from AWS and store it in esp32 flash memory(16MB version) and then have the esp32 soft double reset the slave mcu SAMD and write the firmware over UART? Or what are the available alternatives?

Thanks in advance, Fahad

JAndrassy commented 2 years ago

with ArduinoOTA the SAMD can do self-update, but only with an Arduino networking library (Enthernet, EthernetENC, WiFi101, WiFiNINA, WiFiEspAT). if you networking part is in the esp32 and the SAMD communicates with it over Serial then you can't use ArduinoOTA for SAMD.

you could use the InternalStorage object of ArduinoOTA library to store and apply the update, but the transport of the binary is on you. see the OTASketchDownload example.

Fahadk7 commented 2 years ago

Thanks for the advice Juraj! @jandrassy

Yes, you are correct, the networking part is on esp32. I had thought that I would download the binary into esp32 and send the data over to SAMD either in an array or JSON over serial communication

Would this method work theoretically? (I understand the chance of data loss could I perform a checksum after receiving the data to verify?)

and then as you suggested, store it in InternalStorage and apply it?

I will try and work this with the reference example OTASketchDownload. Thanks a lot!