Project

General

Profile

Arduinos

The Arduino code is in

 src/SlowControls/Arduino/src

and the hex-files loaded onto the arduino flash can be built from the top-level gm2-tracker-readout-daq/software/src Makefile via

cd gm2-tracker-readout-daq/software/src
make arduino_bin

Each Arduino binary is built from code in a separate directory under "src" e.g. src/Humidity for the code reading the humidity sensor. In these src/xxx directories there is a single *.uno file which is the equivalent of the main.cc and what is compiled (along with any other files in that directory to create the "hex" (executable) file loaded onto the arduino flash. The hex file is called xxx.hex where xxx is the directory name above.

In the src/xxx one must edit the Makefile to set the baud rate and USB port so the uploader knows where to send the hex file.

To upload the files to the device just:

cd src/SlowControls/Arduino/src/xxxx
make upload

This uses the "avrdude" tools to upload the hex file the flash. This can also be done on the command line using for example:

cd src/SlowControls/Arduino/src/Humidity
../../mk/bin/ard-reset-arduino  /dev/ttyACM0
/usr/bin/avrdude -q -V -p atmega328p -C /etc/avrdude/avrdude.conf -D -c arduino -b 115200 -P /dev/ttyACM0 \
            -U flash:w:build-uno/Humidity.hex:i