Gertboard & Flowcode (AVR Version)

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Gertboard & Flowcode (AVR Version)

Post by JohnCrow »

Gertboard & Flowcode (AVR Version)

Introduction:

The Gertboard is designed as an GPIO expansion to the Raspberry Pi computer.
It has 12 LEDs, a motor controller, 6 open collector drivers, I/O buffers to protect the GPIO port on the Raspberry Pi.
Other connections are A-D and D-A converters.
These can all be wired up by means of either simple push on jumpers (the same as used on e-blocks) and f-f patch leads.

However, for me one of the most interesting aspect of the Gertboard is the inclusion of an AVR microcontroller.

The board is supplied with a 28 pin AVR MEGA328P device.
It can use some other AVR devices as below.
AT Mega 48A/PA
AT Mega 88A/PA
AT Mega 168A/PA

The user guide for the Gertboard describes programming the device directly from the Rpi using a modified version of AVR dude and the Arduino sketch software.

However the programming connection on the Gertboard is a standard 6 pin AVR ISP header. This means it can be programmed using the AVR programmer supplied with the E-Block AVR system, and more importantly it can be programmed with Flowcode.

A link to my article on building the Gertboard can be found here.
http://www.001tech.co.uk/Forum/viewtopic.php?f=20&t=87

Available Ports:
Using the AT 328A/P the following ports are available on the Gertboard header.

Port B – Bits 0 to 5
Port C – Bits 0 to 5
Port D – Bits 0 to 7

Programming:

The Gertboard has to be connected to the Raspberry Pi to receive its power, so it cannot be used as a stand- alone board.
(There is space on the board for a 3 pin regulator and co-ax dc input jack, however these are not supplied as standard. Information about them is included in the user guide.)

The AVR-ISP is simply plugged on to the 6 pin header, in the same way as it connects to the E-block programmer.
Flowcode will then program the device in the same way as it would the normal E-block programmer.

The Gertboard uses a 12MHz ceramic resonator, so Flowcode will need to be configured to match this. Details of setting up the clock options can be obtained from the device data sheet.
AVR data sheets tend to be, in my opinion somewhat more cryptic than those from Microchip, possibly because I have more experience with PICs than AVR.

Because the AVR device is in a socket, it is also possible to program it using the AVR e-blocks programmer board.

Sample Programs:

I have included some sample programs. The first two are basic test programs to show the operation of the Gertboard and do not interact with the Raspberry Pi.

The third example takes I/O commands from a Python script running on the Raspberry Pi and causes the program running in the AVR to respond to its changes.

ADC-LEDs

Port D0 –D7 LEDs
Port C0 – Potentiometer (ADC 0)

A 5kR Variable resistor is connected with the ends to 3.3V and 0V
The wiper is connected to PORT C0
Varying the potentiometer shows the adc value in binary on the row of LEDs

Knightrider-LEDs

Port D0 –D7 LEDs

Simply increments the binary value sent to port D and shows on the LEDs

Pulse-Counter

Counts the number of pulses on PORT C0 and displays as a binary number on PORT D

Port D0-D7 LEDS
GPIO 25 to B12
Buffer output to Port C0
Note
GPIO 25 can be connected directly to PORT C0, but the Gertboard buffers are designed to protect the Raspberry Pi GPIO connections.

Connect the AVR ISP to the 6 pin header, taking care to align pin 1 with the red stripe on the ribbon cable.
The Flowcode program reads the status of PORT C0 and each time this goes high, the binary value sent to PORT D is increased.
This causes the value shown on the LEDSs to increment.
Gertboard - AVR ISP
Gertboard - AVR ISP
Gertboard-AVR.JPG (95 KiB) Viewed 5221 times
Software.zip
Software
(7.56 KiB) Downloaded 296 times
1 in 10 people understand binary, the other one doesn't !

dbasnett
Posts: 125
Joined: Mon Aug 15, 2011 1:54 pm
Has thanked: 8 times
Been thanked: 11 times
Contact:

Re: Gertboard & Flowcode (AVR Version)

Post by dbasnett »

I had never heard of Raspberry Pi. That seems to be a lot of power for $25.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Gertboard & Flowcode (AVR Version)

Post by JohnCrow »

Hi
Its a great little computer.
It now comes with 512k memory as well for the same price.

Matrix make an adaptor board so you can connect e-blocks to it
This is my article on using it.
http://www.matrixmultimedia.com/mmforum ... =2&t=11335

Its uses Linux for the operating system. Although they have just now released a version of RISC OS for it.
Ive had a quick look at this but not done anything with Risc OS yet.
1 in 10 people understand binary, the other one doesn't !

dbasnett
Posts: 125
Joined: Mon Aug 15, 2011 1:54 pm
Has thanked: 8 times
Been thanked: 11 times
Contact:

Re: Gertboard & Flowcode (AVR Version)

Post by dbasnett »

"Unless you have been living in some remote technologically devoid desert island for the last year you cannot have missed all the publicity and hype surrounding the release and massive popularity of the Raspberry Pi."

The island is Microsoft ;)

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Gertboard & Flowcode (AVR Version)

Post by kersing »

JohnCrow wrote: It now comes with 512k memory as well for the same price.
Hi John,

Don't you mean 512 mega bytes of ram?

Regards,

Jac
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

dbasnett
Posts: 125
Joined: Mon Aug 15, 2011 1:54 pm
Has thanked: 8 times
Been thanked: 11 times
Contact:

Re: Gertboard & Flowcode (AVR Version)

Post by dbasnett »

From the FAQ:
"What’s the difference between Model A and Model B?

Model A has 256Mb RAM, one USB port and no Ethernet (network connection). Model B has 512Mb RAM, 2 USB port and an Ethernet port."

I am sure that John knew that. Probably a brain fart ;)

Post Reply