Arduino Forum

Products => MKR Boards => MKRGSM1400 => Topic started by: GeirFrimann on Sep 29, 2018, 12:04 am

Title: OTA functionalty needed
Post by: GeirFrimann on Sep 29, 2018, 12:04 am
I have been looking around for a solution to do OTA updates on the MKR 1400 boarsd, the only solution I have found close is the flower-platform, that doesn't seems to be developed anymore.
It supports the Zero and the MKR 1000 boards only, according to this blog:https://www.hackster.io/flower-platform/program-mkr-over-the-air-goodies-voice-control-etc-562e9a?f=1#_=_ (https://www.hackster.io/flower-platform/program-mkr-over-the-air-goodies-voice-control-etc-562e9a?f=1#_=_).
Are there any plans to support OTA updates on the newer MKR boards??
Without it, I guess the boards will be used in just DIY projects, and not in any large scale deployments..

Title: Re: OTA functionalty needed
Post by: smgs on Oct 02, 2018, 03:31 am
I had a bit of a look about doing some over the air updates to the board and from what I can see it's possible, but the recommended route tends to be to program in the functions you think you might need at compile time if you can.

It seems like you can also get an AVR bootloader module for use (without needing a whole pc) which can do something like read a file from an SD card and that file can then be loaded onto the Arduino via the bootloader module.

so you can potentially do all this now, it's just finding the right External bootloader module or setting up an Arduino ISP type of thing.

Just thinking out loud here, I wonder if you could you also make a function that reads the content of a web page or file on a website, and then runs that content as a new function? I guess you might be able to, hmm, I think I remember seeing someone say that it would run much slower though as it's not compiled.

Just my thoughts anyway, will be interested to hear what you do.

Title: Re: OTA functionalty needed
Post by: sandeepmistry on Oct 02, 2018, 06:13 pm
If you have an SD card shield attached and use the SAMD core's bundled SDU library, you can perform an update by saving an UPDATE.bin file to the SD card and restarting the board.

See: https://github.com/arduino/ArduinoCore-samd/blob/master/libraries/SDU/examples/Usage/Usage.ino (https://github.com/arduino/ArduinoCore-samd/blob/master/libraries/SDU/examples/Usage/Usage.ino)

Might not be exactly what you are looking for however ...
Title: Re: OTA functionalty needed
Post by: smgs on Oct 03, 2018, 02:17 am
so potentially with the MKR GSM 1400, you could setup a function that downloads an "UPDATE.bin" file from a website or similar, and saves that file to your local SD card and then complete a soft reset on the device to re-flash it (what's the right terminology there, just update?)

That would be really neat, and as long as the new .bin file included the same function you could do that as many times as you like.

Very cool, will have to have a look into that one. Thanks sandeepmistry. Hopefully that helps the OP as well, it's certainly giving me some ideas...

Are there any drawbacks to trying to use the SAMD core bundled SDU library with the MKR GSM 1400?
Title: Re: OTA functionalty needed
Post by: sandeepmistry on Oct 03, 2018, 03:56 pm
Code: [Select]
Are there any drawbacks to trying to use the SAMD core bundled SDU library with the MKR GSM 1400?

- It takes 16 kB of flash to use the SDU library, there's a secondary boot phase added after the boot loader to check the SD card for the update file.

- If the update becomes corrupt or invalid, you'll need physical address to recover it via sketch upload over USB. You could use SHA256 or CRC etc, to validate the downloaded file before applying the update to avoid corruption during transport or storage.
Title: Re: OTA functionalty needed
Post by: gjt211 on Oct 14, 2018, 08:24 am
I am trying to implement this on a Feather M0 WiFi and can't get it to work.

It seems SDCARD_SS_PIN for the SD is set to 4, which in the Feather M0 WiFi is already in use by the ATWINC1500 WiFi module.

From what I can work out, I need change the SDCARD_SS_PIN in SDUBoot.ini then build via command line with build.sh but on my Mac this is failing.

Can anyone help please?

FYI: I already have working code that downloads the updated firmware to SD card as update.bin but it will never use it as the SS pin is wrong.
Title: Re: OTA functionalty needed
Post by: Juraj on Dec 10, 2018, 02:10 pm
I am trying to implement this on a Feather M0 WiFi and can't get it to work.

It seems SDCARD_SS_PIN for the SD is set to 4, which in the Feather M0 WiFi is already in use by the ATWINC1500 WiFi module.

From what I can work out, I need change the SDCARD_SS_PIN in SDUBoot.ini then build via command line with build.sh but on my Mac this is failing.

Can anyone help please?

FYI: I already have working code that downloads the updated firmware to SD card as update.bin but it will never use it as the SS pin is wrong.
SDU supports M0 in new version of Arduino SAMD core (1.6.20). It was in GitHub version from Aug 30.
Title: Re: OTA functionalty needed
Post by: Modiot on Jan 09, 2019, 01:03 pm
Do you have any news related to OTA funtionality?

I am also working on that, so If someone wants to colaborate, we can share our progress (or work together!!).
Title: Re: OTA functionalty needed
Post by: Juraj on Jan 09, 2019, 02:31 pm
Do you have any news related to OTA funtionality?

I am also working on that, so If someone wants to colaborate, we can share our progress (or work together!!).
you need only download the update file to SD card and have SDU library in sketch as described in comments above
Title: Re: OTA functionalty needed
Post by: smgs on Jan 14, 2019, 12:22 am
I got my MKR MEM shield in the mail the other week and am planning to do some work on this with a MKR GSM 1400 in the near future. Will start a post about it when I do :)
Title: Re: OTA functionalty needed
Post by: Juraj on Jan 14, 2019, 07:27 am
I got my MKR MEM shield in the mail the other week and am planning to do some work on this with a MKR GSM 1400 in the near future. Will start a post about it when I do :)
you can store the downloaded bin in flash memory and apply it from there. see the InternalStorage class in WiFi101OTA library
https://github.com/arduino-libraries/WiFi101OTA/blob/master/src/InternalStorage.cpp
Title: Re: OTA functionalty needed
Post by: Modiot on Jan 16, 2019, 06:00 pm
you need only download the update file to SD card and have SDU library in sketch as described in comments above
I tested it and it works well. So easy!

Thanks!
Title: Re: OTA functionalty needed
Post by: alanoatwork on Mar 01, 2019, 05:47 pm
sandeepmistry, can the SDU perform the update from the serial flash memory on board the MKR MEM shield, or must UPDATE.bin reside on the SD card?
Title: Re: OTA functionalty needed
Post by: Juraj on Mar 01, 2019, 06:23 pm
sandeepmistry, can the SDU perform the update from the serial flash memory on board the MKR MEM shield, or must UPDATE.bin reside on the SD card?
you could use the InternalStorage method if your sketch takes less then half of the flash memory.

the WiFi101OTA library contains a SerialFlashStorage method similar to SDStorage, but I didn't see a library to load the update from the serial flash after the reboot.

I hope @sandeepmistry answers