Upload Arduino Sketches over Ethernet

The goal of the project is to create a working environment which allows uploading of sketches created in the Arduino IDE over Ethernet.

Having a working trivial FTP (TFTP) upload mechanism seems to be made up of three separate deliverables:

A Bootloader

Preparing the compiled Arduino sketch for delivery and network access.

An application with a mechanism to initiate a reset over the network and therefore a code download

The first part, the bootloader, needs to initiate a TFTP session with a configured server (i.e. stored in EEPROM), download and verify an application. This isn’t hard in the trivial case, but there are a lot of corner cases to handle. What about partial transfers? What if the host is unreachable? Have you bricked the Arduino?

The bootloader is going to boot up and get an IP address using DHCP, or use a static IP, and download a sketch from a TFTP server. Therefore, the network must support DHCP, the location and compiled sketch must be accessible on the network, and the code must be in a form that can be sent and understood by the bootloader. First we’re going to try sending the unmodified hex file – it has a fairly simple structure and is parsable; failing that we’ll come up with some other encoding. The project will be deemed a success if either DHCP or Static IP works.

Finally, supporting uploading over the net requires some application support as well. While the application is running it must be possible to command it to download a new sketch over the network. The Arduino IDE/hardware currently cleverly exploits a handshaking signal on the serial interface to initiate a reset into the bootloader, but we’ll have no such luxury in on the Ethernet interface. The plan is that any sketch that wants to support remote sketch download must implement a way to trigger a reset without having to (physically) push the reset button (e.g. set WDT and spin). How the end user implements this is completely up to her, but we’ll implement a viable canonical approach that users are free to re-use.

Bootloaders:

If you are not familiar with what an Arduino bootloader is, at a very high level it allows you to load Arduino code over USB using the Arduino environment instead of using an in system programmer and something like AVR Studio. It also does a bunch more stuff. Here is a nice tutorial on AVR bootloaders.

Q&A:

1. When are you going to release some code?
Our goal is to have a TFTP bootloader (deliverable 1) by MakerFaire NY, which is in September.

2. What license will the code be?
The bootloader will be released under the GPL.

3. Can I help?
Yes! Once we have some code, we will need people to test out the bootloader and help us find bugs. Please contact us (support AT wickeddevice DOT com) or post on the Arduino Developers mailing list.

4. What platforms are you targeting?
We would like this to work on the Nanode and Arduino Ethernet hardware. These two platforms use different chipsets, the Microchip ENC28J60 and Wiznet 5100 respectively. We will probably start development on the Nanode, then port the physical layer code to the Arduino Ethernet. The plan to to avoid branching the code until the last possible moment and re-use as much as possible. We will consider the project successful if we have the three deliverables listed above on either of these platforms.

5. What about security? As per discussions on the developers mailing list, the first version is going to be implemented using TFTP, which has no security built in. That discussion can take place subsequent to this project.

6. Will it work with a regular Arduino + an Ethernet shield?Since the Ethernet Shield uses the Wiznet chipset over the SPI interface, same as the Arduino Ethernet, it should “just work.”

7.Will you succeed?I don’t know. Failure is not an option. (wait – Failure is always an option 🙂

Note: This is not an official effort by Arduino and we are not part of the Arduino organization.

UPDATE: A couple of people have asked if the code is available yet. I’m afraid not. Currently I would say it will be available no earlier than one month from now (so beginning November).