Updating code

Let's say if we ship out our product which uses Arduino to customers around the world, is there any way sketch can download a new version from a site, and put it in eeprom and then reboot with the new version

Are your customers Arduino enthusiasts who have the IDE installed?

Maybe the effect can be achieved by distributing and storing your sketch on an SD card. Your customers could either be sent an SD card or download a file onto one and then put it in the Arduino.

Here is a thread that covers the idea (I don't know if it works); http://forum.arduino.cc/index.php?topic=16812.0

I've never done it, but it can be done...

Of course, the Arduino has the bootloader (unless you've removed it). If your customers are tech-savvy they can do it themselves. Or, you could write a custom version of the Arduino IDE/programmer.

The EEPROM is small but if you have space in the flash you essentially have two different programs and upon boot-up you can "jump" to the new code (probably by calling one of two functions that are both essentially complete programs).

So I assume the trick is to never over-write the original code and have a hardware-jumper that's read at boot-up telling it to run the original code or the new code. Initially, you can have two copies of the original code so you're always running from the "current code" location and the "original code" is only run with the hardware-jumper in the alternate location when updating the firmware, or if the new-firmware gets fouled-up.

Or, it should be possible to put a checksum in the code so the new-code only gets run if it's loaded without errors. (Both of these techniques require boot-initialization code that never gets changed.)

I've never done anything special with the Arduino's flash so you'd have to make sure you can erase/overwrite a block of memory without erasing the original code.

...When the company I work for tried to do it (not an Arduino) I don't know what happened but it never got implemented so I assume they had trouble (I'm not the programmer). The do have a way of field-updating but there's no way to revert-back if the flash gets trashed or if they just don't like the update. If the flash gets trashed it has to come back to the factory for re-programming via JTAG. These are industrial products and the customer will only update if they have a particular problem so it's rare for a unit to get updated in the field.

No, our customers would just be using what we ship to them with no knowledge on how to update or make changes themselves.

You can "build" a program that uploads a HEX file to an Arduino. The AVRDUDE program that is part of the IDE does that.

Search for Arduino hex uploader

So you could give the customer a PC program that would upload to the Arduino a HEX file that you send them at some future date.


Thanks mate, will look into it.

Make sure you give the customer a copy of the HEX file that represents the program with which the Arduino is shipped. That way s/he can re-upload the original code if the future "improvement" fails to work.