Control of the Cluster Triple is done using an ATmega328P (or ATmega328PB), the IC can be reprogrammed using either a standard ISCP programmer or you can also use a Raspberry Pi. If you're a regular programming AVR then you can skip most of this document but please remember NOT to alter the Fuses as you may end up "bricking" the IC requiring it to be removed and reprogammed with a parallel programmer.
This guide explains how to use a Raspberry Pi to write updated firmware to the Cluster Triple.
To program the Cluster Triple following this guide you'll need a Raspberry Pi running Raspbian (or Raspbian based distribution) with a 40 pin header, five jumper wires (female-female) and power supplies for both Pi and Cluster Triple, etc.
Connect the wires between Cluster Triple and Raspberry Pi as shown in the table below.
|Cluster Triple||Raspbrrry Pi (physical/ BCM)|
|1 / MISO||12 / BCM18|
|2 / 3v3||No connect|
|3 / SCK||18 / BCM24|
|4 / MOSI||16 / BCM23|
|5 / RST||32 / BCM12|
|6 / GND||6 / GND|
The physical pins on the Cluster Triple and Raspberry Pi can be see below (Pi GPIO pinout from pinout.xyz).
Once connected up you should have something like this.
Once you have the wiring setup between the Pi and Cluster Triple ensure all Compute modules have been removed from the Triple, power the Cluster Triple via the "PWR" port, remove any cables from the "USB" port on the Triple, power on the Pi.
Log into the Pi and install the required software Git (to download the firmware) and Avrdude (programming).
sudo apt-get -y install git avrdude
Download the ClusterCTRL firmware.
git clone https://github.com/burtyb/ClusterCTRL.git
If you haven't added the programmers used by ClusterCTRL to the avrdude.conf file previously these can be added by running.
sudo bash -c "cat ClusterCTRL/clustertriple-1.0/avrdude.conf >> /etc/avrdude.conf"
You can now either build your own firmware or install prebuild firmware.
Installing prebuilt firmware
To see the currently available firmware files.
Files are numbered with the version at the start, then the board type and harware version. You MUST pick the firmware to match the hardware you have, for example 1.2_clustertriple-1.0.hex for the Cluster Triple v1.0. Installing the wrong firmware can brick the ClusterCTRL device. If in doubt please ask on the forum first.
Double check the wiring and once you're ready program the AVR (replacing FIRMWARE with the .hex firmware file to be written "...flash:w:ClusterCTRL/firmware/1.2_clustertriple-1.0.hex" for example).
sudo avrdude -D -c pi_1 -p atmega328p -U flash:w:ClusterCTRL/firmware/FIRMWARE
If you see a Device Signature "avrdude: Device signature = 0x1e9516 (probably m328pb)", then your Cluster Triple has an ATmega328pb and needs to be programmed using a different command.
sudo avrdude -D -c pi_1 -p atmega328pb -U flash:w:ClusterCTRL/firmware/FIRMWARE
You should then see the AVR being programmed, after a few seconds you should see "avrdude done. Thank you.". You can now unplug the PWR cable to the Cluster Triple, remove the jumper wires and then, replace the Compute Modules and connect up as normal.
Building and installing firmware
Install the software to compile firmware for the AVR
apt-get install gcc-avr avr-libc
Change into the directory of the ClusterCTRL devices you have.
Build the firmware using make.
You should then see the firmware being built and once complete it should check the size of the firmware file - something similar to this (the numbers may be different).
... ... avr-objcopy -j .text -j .data -O ihex firmware.bin firmware.hex ../src/checksize firmware.bin 32768 2048 ROM: 7450 bytes (data=74) RAM: 144 bytes
If the firmware has been built correctly you will need to change to the root user and change back to the build directory.
sudo -i cd ~pi/ClusterCTRL/clustertriple-1.0/
You can now program the IC
The IC is then detected (ATmega328p/ATmega328pb) and programmed, if you see any errors please check/post on the forum.
Type exit to get back to the "pi" user.
You can now unplug the PWR cable to the Cluster Triple, remove the jumper wires and then, replace the Compute Modules and connect and power up as normal.