Upload compiled sketch to Arduino Due using command line

So I had my Arduino Due based MMDVM up and running on the hill top and wanted to upload new firmware to it without driving 30km up to the repeater site. The Raspberry Pi3 it is connected to is completely headless, no desktop, no vnc … only ssh. I tried stuff like forwarding the serial port over TCP, but no joy.

Those simple steps will show you how to upload a compiled  sketch file to your Arduino Due using command line. I assume you already copied your compiled bin file to your Raspberry Pi. First you need to install bossa-cli package. My Due is connected through the programming port.

sudo apt install bossa-cli

The Arduino Due must be reset in order to upload the compiled sketch, this is done by opening/closing the serial port at 1200bps. The following command line just does this, uploads the bin file to the due and the resets the serial port back to 115200bps. I assume your file is name MMDVM.ino.bin, if not adapt the line accordingly.

stty -F /dev/ttyACM0 1200;bossac -U false -i -d -p ttyACM0 -e -w -v -b -R MMDVM.ino.bin;stty -F /dev/ttyACM0 115200

You will see tons of cryptic output, wait until it completes without any errors and you#re done. That’s it! Easy uh?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.