0

BTW - I have, unsuccessfully, searched for an answer before posting.

I have an NodeMCU connected to a bunch of Arduino Nanos over the I2C bus. The WiFi-enabled NodeMCU has the capability to do OTA updates on itself, which I've mastered but I want to update the same code into all of the slave Nano devices.

Is this possible? If so, what is the easiest way? The devices will be installed on a wall, so I don't want a bunch of USB cables trailing out of it.

Can I use/share the WiFi connection on the NodeMCU, with the Nanos, via the I2C bus? Or is there a better way?

PS - I have read about compiling the .INO file into a hex or bin file but still don't understand the process properly.

PPS - updating .INO files OTA on an ESP8266/WiFi enabled NodeMCU is great but they are bigger (wider) that a Nano and would cost a lot of money as I would need about 30 or so.

1 Answer 1

2

The compilation and linking process turns the .INO file into a .HEX file which is basically the machine-code that gets loaded into the processor. It is easy enough to get hold of that file as part of the compilation process.

To update the firmware in your Nanos, you basically need to replace the existing bootloader (which updates via the serial interface) with one which updates via I2C.

I see such a bootloader exists here on Github.

Is this possible?

Sounds like it.

If so, what is the easiest way?

Depends what you mean by "easiest". If the devices are mounted on a wall, that may be the easiest way.

What you might do is, after booting up, each device would query the master to see if an update was available*. If it was, they would take turns to get the update supplied to them via I2C. If the update failed half-way through it might be hard to recover. You might want to have some sort of system where the bootloader checks if the main code is valid (eg. by a sumcheck) and if not, request another update.

I think it could be done, the mechanics could provide an interesting challenge. Have fun with it!


* One possibility would be for the master to make an I2C broadcast (maybe every 10 minutes) of what the current software version is, and if the slave finds that it doesn't have the latest version, request an update. If the master was busy (perhaps because it was updating another slave) the slave might wait 5 minutes and try again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.