Programming Arduino Due from Console

While looking around the MMDVM project I found a nice utility that allows for programming the Arduino Due from the console (see [1]). That is interesting because up to now I had always been on site to upgrade my MMDVM firmware. As I do not have a graphical environment running on the Raspberry Pi driving the MMDVM installing Arduino IDE is not an option.

Instead I can build the new MMDVM firmware with the Arduino IDE on any other computer and export the compiled sketch as binary file. That can be done using the “Sketch” menu within the Arduino IDE.

The binary file is usually written to the directory where the sources of the MMDVM project are located. That can be transferred to the destination system using SCP or the like. The target system is a Raspberry Pi running Raspbian 8. The tool of choice is bossa which exists as a cli variant in the list of packages. Just do a “apt-get install bossa-cli”.

After that you can write the MMDVM firmware to the Arduino Due according to [1] with:

$ stty -F /dev/ttyACM0 speed 1200 cs8 -cstopb -parenb > /dev/null 2>&1
$ bossac --port=ttyACM0 --force_usb_port=false --erase --write --verify --boot=1 --reset MMDVM.ino.arduino_due_x.bin

The firmware is written without problems and the Arduino is restarted automatically. Nice way to remotely update the MMDVM firmware.

References

[1] https://github.com/N4IRS/MMDVM-Install/blob/master/Bossa/upload_firmware.sh