GertDuino Setup

The documentation for the GertDuino leaves very much to be desired. It doesn't work properly out of the box and the information that you need is scattered all over the place. So, here's a guide to getting the board functioning properly on a Raspberry Pi that's running Raspbian. I checked the procedure on a new install of Raspbian using NOOBS_v1_3_2. I'm assuming that all the files will be in your home directory. You might want to make sure that your system is up to date first.
sudo apt-get update
sudo apt-get upgrade

Download a copy of the User Manual and the Software Examples. Now, unzip the archive and rename the resulting directory because another archive is going to use the same name.
cd
unzip gertduino.zip
mv gertduino Gertduino

The Pi tries to boot into safe mode when the GertDuino is connected which is not something we want.
avoid_safe_mode=1 has to be added to the end of config.txt.

sudo nano /boot/config.txt
Add the line and then quit using CTRL-O, ENTER, CTRL-X.

Next, we have to install some software. These directions are taken from Gordon's GertBoard page. Make sure we have the most recent copy of the Arduino IDE.
sudo apt-get install arduino

Next are the directions from Gordon's ATmega Setup page. Download the gertduino archive to your home directory and unpack it.
cd
tar xzf gertduino.tgz
cd gertduino
ls

You should see
avrdude gdset m48 reset setup tester

Download this shell script to the new avrdude directory and then run it. Using this script will save you a lot of typing.
cd avrdude
chmod +x atmega
./atmega

Finally you're ready to install the GertDuino on the Pi. Install the jumpers on the GertDuino as shown on page 7 of the user manual, shut down and power off the Pi, install the GertBoard and power on the Pi again. Now you have to program the fuses in the ATmega48p.
Power on the Pi and
cd gertduino/avrdude
./avrsetup

and pick number 3 from the menu. If all went well, you can move on to the ATmega328p. You might want to shut down and power off the Pi before you move the jumpers as shown on page 6 of the user manual. The procedure is the same as for the 48p except you pick number 1 from the menu.

If you have trouble booting at this point and get a sh: can't access tty; job control turned off message then shut down, put the jumpers back for the ATmega48 and start up the Pi again. Then type the following
avrdude -c gpio -p m48p -e
shut down, move the jumpers back to the ATmega328 position and start up again. Make sure to run avrsetup when the Pi has booted.

Now we can try one of the demo programs.
cd
cd Gertduino
cd blink
chmod +x program_328
./program_328 blink.hex

You should see all six leds blinking fairly rapidly in sequence. If all has gone well, you might want to copy program_328 to a location that's in your path.
sudo cp program_328 /usr/local/bin

To use the Arduino IDE, set the jumpers for the 328p, set Tools/Board to Gertuino with ATmega328 (GPIO), Tools/Programmer to Raspberry Pi GPIO and use File/Upload Using Programmer rather than the upload icon.