OTA programming using GPRS

Started by anandteke, June 15, 2016, 05:12:58 AM

anandteke

I have been following updates on Monteino OTA upgrade for quite some time and am excited to finally try it. 

I have a device based on Atmega328, collecting data and transmitting it over GPRS using FTP. I would like to be able to upgrade its firmware remotely.

Following is the approach in my mind
-Device checks for availability of new firmware stored as a file on the FTP Server
-Whenever new firmware is available, device downloads and writes it to external SPI memory
-Somehow verify each byte written on the SPI memory
-DualOptiboot upgrades the firmware on reboot

I could not find any experiences of OTA using GPRS. I am sure people must have tried it by now. Any links to those would be helpful.

Specifically, I want to know how to prepare the file to be stored on the server for remote upgrade. I mean each byte of that file should be just as required. Can I just copy the compiled hex file byte by byte on to the SPI chip?

Regards,

TomWS

#1
If you examine the code in the wireless hex library you'll see the 'format' that the boot loader requires to load a new image from spi flash. It's basically a raw binary image offset by a ten byte header that gives the bootloader a signature and blocksize of the image.

If you can get a raw image loaded into this area of flash then it doesn't matter HOW it got there, the bootloader will load it when you reset the node (simple to do with WDT timeout)

What I do is convert the hex file into binary packets that I can send over a moteino network. These packets get get stored in an upper region of flash until I am sure they have all arrived at which time I transfer the data to the boot area and restart.

It's relatively easy to do if you know how to parse and repackage the hex file. Spi flash library read and write bytes are easy to use.

Tom