Gertboard Setup

I spent quite a bit of time at a Digital Makers Meeting setting up my Gertboard. In particular, I was trying to get the the Atmel ATMEGA328p microcontroller working. Initially I tried to use the arduino IDE to communicate; however, given that I almost exclusively access my RPi via ssh I found that the IDE was very slow. I thought I’d write up my findings so that others wouldn’t have to go through the same frustrating process. I followed the guide written by the very knowledgeable Gordon Henderson on his site. The one change from the guide is that you don’t need to install the full Arduino IDE (which saves a fair bit of space on your RPi); instead just install the arduino-core package.

sudo apt-get install arduino-core

Follow the rest of the guide including the initial avrsetup. This will now create the necessary files to allow you to access the ATMEGA328p from the RPi. However, to upload sketches to the ATMEGA328p you will need one last piece of software called ino. If you get installation errors you may need a couple of extra packages to complete the installation (they don’t fully list all of the dependencies on their site). Once installed it is advisable to setup some defaults for using ino to upload sketches, create a file called .inorc in your home directory and add the following:

[build]
board-model = gert328

[upload]
board-model = gert328
serial-port = /dev/ttyAMA0

[serial]
serial-port = /dev/ttyAMA0

You are now ready to upload sketches to the gertboard from the command line. Follow the instructions on the quick start tutorial to get started.

The one thing that I have found is that you will need to manually erase the ATMEGA328p before you upload a new sketch using the command:

avrdude -c gpio -p m328p -e -v

The main drawback in using the RPi to program the ATMEGA328p on the gertboard is that it ties up the SPI pins on the RPi so that you can’t do other things at the same time. This became an issue for me as was experimenting with the MCP3002 ADC on the gertboard at the same time (which also communicates via the SPI pins). An alternative approach is to program the ATMEGA328p from another computer using an AVR programmer – this process is described on the next page.

Some Useful Links
https://projects.drogon.net/raspberry-pi/gertboard/
http://www.mydominion.co.uk/?page_id=287
http://friendsoftheunicorn.net/content/using-ino

One thought on “Gertboard Setup

  1. Pingback: Programming the Gertboard from the command line | Leicester Raspberry Pi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s