OTA update of WifiNINA firmware

Hey, First a little background
Ive been messing around on a long term project and decided I wanted to be able to update the U-Blox W102 firmware OTA. The module itself doesn't support any OTA updates due to a lack of flash space. So I had to figure out a way to download and then flash the wifinina module. I already worked out regular samd OTA updates with both internal memory and stored on an sd card. Since I now had the ability to download a binary file, (securely even over https), it was just a matter of figuring out how to flash the esp-32 within the U-Blox module.

Long story short I finally figured it out and have successfully flashed my nano 33 iot's wifinina module and have created a little library for myself.

So basically what I'm asking is "is there anyone interested in my library?" And "is it a good idea to share this library?" (I'm gonna definitely share it eventually but if there's interest I'll make it easier to understand and post it sooner)

My concerns are that it may be a bit complicated and someone using it wrong will brick their wifi module (not that it's hard to fix for someone who's flashed their module before, but for a beginner it can be very challenging. I know because I was there a few months ago haha)

The library needs an sd card connected to the nano 33 iot with a file containing the complete binary code for the esp-32.

In my program it increased the flash used by 5900 bytes.

I can't imagine many people wanting to update the firmware remotely or even that often but I've been dabbling with modifying my Nina firmware so I think I'll use it from time to time. Plus I just think it's cool to have the whole board completely OTA update compatible with nothing more than adding an sd card.

Sorry for the ramble it's been many days working on this and weeks researching and trying to figure out how to do it without any prior examples lol.

What do you all think?

1 Like

I don't have any projects that rely on OTA at the moment, but if I did I would definitely be interested in OTA firmware updates as well, so I am definitely interested.

I would just clearly document the potential danger and then not worry about it. If you want to go the extra mile, provide recovery instructions.

Arduino is all about giving people the freedom to experiment with embedded systems. With that freedom inevitably comes the chance of magic smoke and bricked chips. It's not much fun when that happens, but even when some hardware is completely destroyed from time to time, I think it's a small price to pay in exchange for the knowledge we gain.

Publish it on GitHub!

Got it up on GitHub! Hopefully this proves useful to some other people, any and all feedback or collaboration to make it more refined is welcomed!
Also if anyone else could test it out for me that would be awesome,
Eventually I'd love to put some more examples up, maybe one that downloads the binary
Esp Serial Flasher Github

Does anyone know anything about submitting to the official library manager? I think I have it all prepped and would love if someone who's done it before to check it over. After some more testing and refinement I guess I'll see if I can add it in there and make it more accessible

My suggestion is that you provide instructions for the user to obtain the firmware on their own. This will relieve you of the burden of hosting the current firmware binary in your repository.

Can the binary provided here be used?:

Everything you need to know should be explained here:

Please let me know if you have any questions.

I ran the "Arduino Lint" tool used to check compliance with the Library Manager requirements on your library and it passed with flying colors. So I think you are ready to go.

One thing to note is that this is somewhat unfortunate timing for submitting a library, as there is currently an outage in the system used to add new libraries and releases to the index:

This has no impact at all on the submission system though. You are free to submit your library any time you like. Just be aware that there will be an unusual delay between the time your library is submitted and when it finally becomes available for installation via Library Manager. But it's only a delay. Once the indexing system is back online, all the new libraries and releases that became available in the interim will be indexed and made available via Library Manager.

That's a good idea, I'll definitely put some better instructions on how to get the most up to date firmware. And yes that is the exact binary.
In some time I could make a simple example that includes connecting to wifi, an http request to that link (with the disclaimer to update link to desired release), download to SD card, flashing process then reconnect to wifi. I already have all of that in my own program so I just need to simplify it

Would it be useful to leave that binary with the library and just have a disclaimer that it may be outdated?

And awesome! I didn't even know about that Arduino lint tool, thank you! That's pretty cool, I'm gonna have to figure out how to use that In the future

I think I'll try and do that soon after I get some more fancy examples

For this application, you might be interested to know that Arduino publishes a JSON file that contains a list of all available firmware binaries in machine readable JSON format:
https://downloads.arduino.cc/arduino-fwuploader/boards/module_firmware_index.json

This index is used by the "Arduino Firmware Uploader" tool to get the firmware binaries.

It's up to you. I personally don't see a benefit to having it bundled with the library. Arduino users often don't even have a clear idea of where a given library is installed. So I think they will actually find it easier to just download the binary from the Internet than they will to hunt it down on their own PC (though certainly that is easy enough to do with some clear instructions). But that's only my own opinion. There might well be some good use cases I'm missing for having it always available with the library.

It is a handy tool. Please let me know if you have any problems or questions.

There is also a GitHub Actions action that makes it easy to set up your GitHub repository to automatically check the Arduino projects for any problems every time you make a change. Arduino has this set up on all their own firmware repositories (example)

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