Upload sketch from Raspberry Pi

using a custom bossac-0x4000 tool


We will show how you can upload sketches from a Raspberry Pi to your Industruino D21G. While it is possible to run the Arduino IDE on a Raspberry Pi, it is unfortunately not possible to compile and upload sketches to the Industruino at this point, as the Industruino board package does not contain all necessary tools for the Pi platform.

This demo assumes that you have an Arduino IDE running on an Industruino supported platform (Windows, Mac, Linux x86), with the Industruino board package installed as documented here. You can obtain a binary of your compiled sketch by clicking on Sketch > Export compiled Binary. This will put 2 files in your sketch folder e.g.

  • blink.ino.industruino_d21g.bin
  • blink.ino.with_bootloader.industruino_d21g.bin
We will use the first one, and if you did a normal upload from the IDE, you would see in the actual command in the bottom feedback window (if verbose is enabled) e.g
/home/tom/.arduino15/packages/industruino/tools/bossac/1.7.0-industruino/bossac-0x4000 -i -d --port=ttyACM0 -U true -i -e -w -v /tmp/arduino_build_797024/blink200ms.ino.bin -R
While we cannot use the IDE on the Pi for the reasons above, we can run this command on the Pi using a custom version of the bossac tool. You can download this bossac-0x4000 from our github, and put it in a folder on the Pi, e.g. /home/pi/industruino. This is the bossac version 1.7.0, the same as is used in the Industruino board package.
I'm using a Raspberry Pi 4, with the latest Bullseye Raspberry Pi OS.

I compiled 2 different binaries (standard blink on pin 26, the LCD backlight, with 2 different frequencies).

Connect the Industruino to your Pi by USB cable. It should be recognised as port /dev/ttyACM0 - if you want to double check, run $ dmesg

In order to put the Industruino in bootloader mode, so it can accept a new upload, we need to activate the bootloader. This is done in the same way as the Arduino IDE does it: by open/close the port with baud rate 1200. We can do this on the Pi with:

$ stty -F /dev/ttyACM0 ispeed 1200 ospeed 1200

Now the Industruino LCD backlight should be fading in/out, to show that the bootloader is active. We are ready to upload the binary:

$ ./bossac-0x4000 -i -d --port=ttyACM0 -U true -i -e -w -v blink200ms.ino.industruino_d21g.bin -R

This will upload the sketch and start running it.

Remember if you want to upload again, you have to activate the bootloader again with the first command.

If you want to compile your own bossac-0x4000 executable, you can clone this repo.