The Atmegas on the Gertduino are programmed using Avrdude in the same way the ATmega on the Gertboard is programmed. A few minir differences to the Gertboard though – the main ATmega 388p runs at 16MHz to be 100% compatibile with an Arduino, and the ATmega 48p runs at 8MHz off the internal oscillator.
The main jumper block controls some of the GPIO from the Pi to the ATmegas and the serial port too.
But first, a huge apology – the software here requires some assembly – ie. you’ll need to type commands to install it. Worse – I have a version of avrdude here which has some patches in it to use the Pi’s GPIO to program the ATmega – this is fine and what was done for the previous version, but this one uses wiringPi internally so its much faster. (Its statically linked so you don’t need to install wiringPi). The big downer is that the SD card I developed it on was recycled into my wifes new camera before I uploaded the patches to my backed-up servers, so right now all I have is the binary – I’ll rectify that in good time, but for now, as long as you’re happy with that, it’ll all “just work”.
Firstly make sure you have the standard arduino software installed.
sudo apt-get install arduino
This will install everything you need to get going with the Gertduino (and Gertboard and any other Arduinos connected to the Pi via e.g. the USB interface)
Get and unpack the Gertduino software:
cd wget -O- http://project-downloads.drogon.net/gertduino/gertduino.tgz | tar xfz - cd gertduino ls
and if that goes well, you ought to see:
avrdude gdset m48 reset setup tester
Now come the “hand assembly”
We need to replace the avrdude binary and some system configuration files.
cd avrdude # Config. files sudo cp /etc/avrdude.conf /var/tmp sudo cp avrdude.conf /etc sudo cp /usr/share/arduino/hardware/arduino/boards.txt /var/tmp sudo cp boards.txt /usr/share/arduino/hardware/arduino/boards.txt sudo cp /usr/share/arduino/hardware/arduino/programmers.txt /var/tmp sudo cp programmers.txt /usr/share/arduino/hardware/arduino/programmers.txt # Binary sudo cp /usr/bin/avrdude /var/tmp sudo cp avrdude /usr/bin/avrdude # Make avrdude set uid root sudo chmod 4755 /usr/bin/avrdude
That’s the hard part over!
We’ve downloaded some new configuration files for avrdude (and the arduino IDE if you use it – I don’t!) and installed a new binary version of avrdude. Now – this is a big ask – you need to run avrdude as root, or make it set uid root. You need to trust that I’ve not installed any untoward code in the binary – I haven’t and I will provide a new version with the patches when I re-do it shortly, but for now…
The next thing to do it set the fuses on both Atmega processors.
In the avrdude directory you’ll find a utility called avrsetup, but before you run it, set the jumpers on the Gertduino to allow programming of the ATmega328p – see page 6 of the user manual and set the jumpers accordingly, then run:
You’ll be prompted with a menu – pick 1 for the ATmega328p, and assuming it’s successful, the ATmega can now be programmed with your own code using the Arduino IDE, or via your own Makefiles, avr-gcc, etc. If using the Arduino IDE, remember to select the right board in the boards menu under the tools menu.
Once the ATmega328p is setup, you can move onto the 48p. Move the jumpers to the Atmega48p side (See manual page 7) and run the avrsetup program again. This time pick option 3 – to program the ATmega to run from the internal clock at 8MHz.
And if that works then you’re all set, as they say.