Update Arduino Code without IDE and without USB in the field

Hello everyone,
I have a custom development board based on my prototype tests with mkr zero.
My board uses a SAMD21G18A as the MKR zero and a W5500 for ethernet connection.

The SAMD received commands via raw ethernet and proceeds based on these commands and send answers to my windows host program.
All working fine.

I read a lot on this topic about how to add the bootloader and output my code as hex or bin file.

Now I want to be able to update my code in the field without the need of a usb plug or any external software. My goal is to send the new code from the field computer to my SAMD via Ethernet and update it this way.

I already know that it is not possible to update the code directly. I had some ideas and want to ask some experts. For all ideas I run into the described problems or run out of informations:

  1. Use some of the librarys which allow to access Flash as EEPROM and replace the files.
    -> I did not find any information on how to access special areas in the Flash to replace the code.
    Additionally I found conflicting information if the access to Flash is possible in this way.

  2. Use Ariadne to replace the code.
    ->I did not find any information that this bootloader can be used on the SAMD chips.

  3. Send my code to my controller during operation mode and store it on a external EEPROM or SD card. After Reboot the bootloader should check if new files are available and replace the old ones.
    -> I did not find any information on this topic for MKR Zero.

  4. The bootloader should be able to communicate via the W5500 to receive an update and reboot after update. I would be able to send the data via raw ethernet or any other common ethernet protocol.
    -> I Did not find any info for MKR Zero.

Does anyone has experience with that topic or has some helpful information?

Thanks in advance for any help...
Lutzer

use my ArduinoOTA library. it is based on Arduino's WiFi101OTA library for MKR

1 Like

Hello Juraj,
thank you for your fast reply.

And more thank you for that great library and your work on this. I downloaded the library, built a test environment based on your OTASketchDownload.ino example and my host program and was able to update my code without any issues.
Great work.

I have two more questions which are related to the ArduinoOTA library.

  1. What is the maximum size for an update via ArduinoOTA? Is it half of the free Flash memory? For the MKR Zero this would be 128KB.
  2. I need to store some user data in my application. At least I need to store the serial number and MAC adress for my board. Is there a way to achieve that with ArduinoOTA library as well? I thought that I could get collisions between the update via ArduinoOTA and other libraries to access the FLASH. Do you have any hint on this?

I think ArduinoOTA will respect EEPROM emulated in flash. there is a fuse for it. The fuse test was submitted to ArduinoOTA GitHub repo.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.