install avrdude 6.3 with linux gpio

Start by installing the files needed to compile the Avrdude, while putty is not necessary it is a good client for serial comms with the boards.

$ sudo apt-get install build-essential flex bison gcc libusb-dev putty

$ sudo apt-get install libftdi-dev libhidapi-dev libpthread-stubs0-dev libelf-dev

Now download the Avrdude files themselves, and unpack them

$ wget http://download.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz

$ tar xvzf avrdude-6.3.tar.gz

$ cd avrdude-6.3/

Before you continue with this, you need to make this change to the linuxgpio.c file

snprintf() is being used in linuxgpio.c to convert unsigned GPIO numbers. A recent commit has changed the format from "%d" to "%ud". "%u" is a valid conversion specifier, while the trailing 'd' ends up being printed (e.g. '17d' instead of '17').

This causes GPIO setup to fail:

Can't export GPIO 17, already exported/busy?: Invalid argument

Please replace "%ud" with "%u".

Now we can configure the makefile, to include the linuxgpio support.

$ ./configure --enable-linuxgpio

...

DO HAVE    libelf
DO HAVE    libusb
DON'T HAVE libusb_1_0
DON'T HAVE libftdi1
DO HAVE    libftdi
DON'T HAVE libhid
DO HAVE    pthread
DISABLED   doc
DISABLED   parport
ENABLED    linuxgpio

This is how it should look like when the configure command is finished.

Now we can continue the install process.

$ make

$ sudo make install

Now the AVRdude has been installed. We still need to adjust the avrdude.conf (in usr/local/etc/ ) part for the linuxgpio with sudo nano avrdude.conf

                   
#This programmer bitbangs GPIO lines using the Linux sysfs GPIO interface
#
#To enable it set the configuration below to match the GPIO lines connected to the
#relevant ISP header pins and uncomment the entry definition. In case you don't
#have the required permissions to edit this system wide config file put the
#entry in a separate .conf file and use it with -C+.conf
#on the command line.
#
#To check if your avrdude build has support for the linuxgpio programmer compiled in,
#use -c?type on the command line and look for linuxgpio in the list. If it's not available
#you need pass the --enable-linuxgpio=yes option to configure and recompile avrdude.
#
programmer
  id    = "gpio";
  desc  = "Use the Linux sysfs interface to bitbang GPIO lines";
  type  = "linuxgpio";
  reset = 8;
  sck   = 11;
  mosi  = 10;
  miso  = 9;
;

You will also want to turn on the support in raspberry interface configuration for I2C, serial, and SPI.

Raspberry PI Zero W

With this version of the raspi, you need to disable the bluetooth by adding into the config.txt either dtoverlay=pi3-disable-bt to disable bluetooth entirely, or dtoverlay=pi3-miniuart-bt That moves it to the slower serial comms. Then the necessary pins for the serial communications with boards made work properly.