User avatar
Gert van Loo
Posts: 2477
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

STICKY: FAQ & Install

Sun Jan 05, 2014 12:31 pm

This is the FAQ list for the Gertduino.
The next post is about installing the software.

Last update:
5 Jan. 2014: Initial version.
25 Mar. 2014 : Added section about programming errors.
7 April 2015 : More things which make it fail

Beware: the pins used to program the Arduino chip also come out on the connectors.
Some plug-on boards use those pins. If such a board is plugged on top it may cause the
programming signals to distort in either amplitude or shape. Try programming with no board on top.

To use the Gertduino with a Pi 2, you need the updated software which uses
the device-tree. The device tree software also means that the reset pin does NOT
hold its state using the reset_on/rest_off script.
  1. My Raspberry-Pi boots into safe with the Gertduino on top (Big font and a superuser prompt)
  2. My Raspberry-Pi does not halt, but restarts with the Gertduino on top
  3. My Rapsberry-Pi does not boot with the Gertduino on top (Colour screen visible)
  4. I can't use a remote shell with Rapsberry-Pi with the Gertduino on top
  5. Continuous programming errors
The first four errors above have the same cause, and the same solution.
An error has been seen with some Gertduinos where the Raspberry-Pi does not boot or no remote shell access is possible.
The cause of the error is the ATmega48 device which pulls the scl line low. This is equivalent to the safe boot mode
of the Raspberry-Pi. The suspicion is that for some boards the factory did not clear the test program from the Atmega48.
This makes that the SCL line is low after reset.
This causes the phenomenons (1) and (2) listed above.
(The SCL line is re-programmed to 'restart the Pi' at the end of the halt sequence)
The lock-up effects (3) and (4) are only seen when using with NOOBS 1.2. In that case the boot process stops
with the 'colour' screen visible. The error is NOT seem with NOOBS 1.3 or with Rasbian.

Solution:
In all cases holding the Atmega48 in reset by placing a jumper over the Re pins solves the issue.
After clearing the Atmega48 or programming it with any program which does not hold the SCL pin
low the error goes away and the jumper is no longer needed.
Clearing device can be done with avrdude. You need first set the programming jumpers for the Atmega48
device as shown in the manual. As specified in the manual you need a version of avrdude which has been
updated to work with the Raspberry-Pi GPIO pins.
After installing that you can erase the Atmega48 device using:
/usr/bin/avrdude -c gpio -p m48pa -e

I have had a PM where after that the Pi still boots in safe mode.
If you add "avoid_safe_mode=1" to the end of the config.txt that should definitively help.
(And check what the voltage is over R13. It should be zero!)


The Arduino IDE always reports a verification error.
When working from the Arduino IDE use the command 'upload using programmer'.
Do not use the default 'upload' button as that does not run an 'erase' before programming.

The UART is not working
First try a loop-back with minicom. Then try loop-back on the other side.
Then try one connection at a time. Set the baud rate very, very low and use a simple
voltmeter to see if the voltage changes on the transmit pin when you send data
(I assume you don't have access to a oscilloscope...)
Also read the next section about baud rate. Sometimes you receive garbage when the
baud rate is wrong but often you get nothing at all.
As last resort you might have blown-up the serial port. I have three Pi's at home
where everything works except the serial port. I don't know why but it seems
the GPIO pins are must susceptible to stop working....

The UART gives weird characters on my screen
The most likely cause for that is a wrong baud rate.
If you derive the baud rate from the CPU clock:
#define F_CPU 16000000UL
#define BAUDRATE 9600
#define BAUD_PRESCALLER ((F_CPU / 16 / BAUDRATE ) - 1)
make sure the F_CPU has the correct value. Beware that until you run the 'startup' script the Atmega
devices will run from their internal (1MHZ) clock. Note that afterwards the Atmega48 runs of its internal 8MHz clock
but the Atmega328 runs of the external 16MHz clock. (And the Atmeg328 on the Gertboard runs at 12 MHz)
To be more sure about your CPU clock, check it!
Find (or make) an LED blink program and set it up to go on/off once every 10 seconds.
Then check the actual blink rate against you expected blink rate.

Continuous programming errors
A small number of people have continues programming errors. (verify error ...)
if they try to program the board while there is a shield connected.
The solution is in slowing down the avrdude programmer using the -i option.
For me -i 2 was enough for the error to disappear. You can NOT add the -i option to the Arduino GUI so the work around
is to replace the avrdude executable with a shell script which always adds -i ...
Step 1 : move the binary avrdude to avrdude.bin:
sudo mv /usr/bin/avrdude /usr/bin/avrdude.bin
Step 2: create a text file named avrdude in /usr/bin/ and make it executable
This is the file contents:
#!/bin/bash
avrdude.bin -i 5 [email protected]

You make it executable using:
sudo chmod 777 /usr/bin/avrdude

See the next post about an automatic install makefile file which should do it all for you!

User avatar
Gert van Loo
Posts: 2477
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

FAQ & Install

Fri Mar 28, 2014 6:48 pm

Installation.

Getting the Arduino environment up and running with the Gertduino hardware requires a lot of file manipulation.
The latest discovery that it also requires a special delayed programming mode does not help.
To make life easier I have worked on a makefile.
As it does a lot of 'super user' stuff you have to run it in 'sudo' mode.
I have tried it and it worked for me using the latest Raspbian.
Make sure you have a working internet connection before you run it!
Attached the gtar-zipped file: make_install_gertduino.tgz
Download and then unpack using:
tar xzf make_install_gertduino.tgz
Then you can run it using:
sudo make -f make_install_gertduino

20-feb-2015: added some usefull programs (gertduino.tar)
These seem to have disappeared from the Farnell website.
Attachments
gertduino.tar
(7 KiB) Downloaded 442 times
make_install_gertduino.tgz
(1.5 KiB) Downloaded 725 times

Return to “HATs and other add-ons”