GertDuino Board Setup
Initial setup steps for a GertDuino board with an existing Raspberry Pi 2 system, and solve the Raspbery Pi reboot problem.
Introduction
The steps below assume you have:
- A Raspberry Pi 2, fully workable (power, network, display), running Raspbian (I had version 1.1)
- A GertDuino board (I had revision 5)
First get and read the GertDuino manual.
You would have learned that GertDuino board comes with two Atmel microcontrollers that can be programmed from Raspberry Pi: ATmega328p and ATmega48pa.
The following steps will get to the point where we load a program for each microcontroller from Raspberry Pi.
Mount GertDuino
Ensure the Raspberry Pi 2 is not powered.
Mount the GertDuino board on top of the Raspberry Pi 2.
Now Raspberry Pi does not want to boot any more and displays:
The root cause for this seems to be a factory test program that the ATmega48pa comes with. The issue will be gone once we load a different program.
Some claim that adding the following line to /boot/config.txt
and rebooting helps.
This but did not help me.
Ensure the system is not powered.
Use the four jumpers the GertDuino board comes with. Put them in the position to program the ATmega48pa (marked in red in the image from the manual below).
The step above should allow the Raspberry Pi to boot. Power the system. It should boot now.
Install software
Install the cross-compiler. This will allow you to compile code for the ATmega microcontrollers.
Install avrdude
. This will allow you to load code into the ATmega
microcontrollers.
Setup the code examples.
Load program to ATmega48pa
Try to upload a program to ATmega48pa (we’ve already setup the jumpers in a previous step).
You might get an error like:
To fix that error edit avrdude.conf
.
Copy-paste the section for ATmega48 and change the following fields for
the new ATmega48pa section: the id
, desc
and signature
:
Try to upload a program to ATmega48pa, this time it should succeed.
Shutdown Raspbery Pi.
Load program to ATmega328p
Ensure the Raspberry Pi 2 is not powered.
Use the four jumpers the GertDuino board comes with. Put them in the position to program the ATmega328p (marked in red in the image from the manual below).
Power on the system. This time it should boot even if ATmega48pa is no longer reset.
Run one off clock setup (as per manual documentation)
If you get an error message like below, check the connection (between the Gertduino board and Raspberry Pi) and jumpers, then try again.
Load a program into ATmega328p.
This should work.
See it working
To see the LEDs blinking, you need to remove the reset for the ATmega328p. Either:
- remove the jumper from the reset position
- or use the
reset_off
script from the~/gertduino
folder
The reset_off
and reset_on
scripts also have issues, possibly because GPIO
8 on Raspberry Pi is now in default input mode. Commenting the last statement
(# echo 8 > /sys/class/gpio/unexport
) gives mixed results. But that’s a
battle for another time.
And that’s the initial setup for the GertDuino board with a Raspberry Pi 2.