REMOTE ICSP Programming - In Circuit System Programming (ICSP) using Raspberry PI GPIO via Bitbanging Technique
Working of the Project:
Raspberry PI is configured as server which has the capability to program the Arduino using AVRDUDE installed on it. Raspberry PI is ported with raspbian jessie
OS based on Linux Kernel, Firmware of Raspberry PI controller is written in python. On the Client side a software application created using Labview which connects to the server and capable of
transfering hex file to the server and Communication commands for certain actions of the server through TCP/IP Protocol.
Features / Capability of the Server controlled via the Client:
Entire project is based on command driven approach.
1. Client can send Transmit command and server accepts the connection and gets ready to receive hex file, client transmits the hex file and once its succesfully
done socket connection is closed
2. Client can send program command to the server and server Initiates the programming of Arduino using AVRDUDE which in turn uses concept of Bit Banging, converting
GPIO lines of the raspberry PI in to SPI lines and programs the arduino using ICSP lines
3. Client application is Event based which connects to the server only when transmit button click event happens or program button click event happen.
4. Number of Devices can be connected to the Raspberry PI but limited by the number of GPIO lines available on the PI
Features of the Project
1. Client is able to connect to the server on port 8888 with server IP details and instructs the server to program the Arduino devices connected to it.
2. Multiple clients can be connected to the server and Multiple devices can be programmed accordingly
3. The communication is over the TCP/IP Protocol hence distance is not the limitation but for this project the server as well as the client has to be in the same network
Libraries used in the Project
1. AVRDUDE:
[ For Complete Documentation : http://www.nongnu.org/avrdude/user-manual/avrdude.html ]
AVRDUDE - AVR Downloader Uploader - is a program for downloading and uploading the on-chip memories of Atmel’s AVR microcontrollers.
It can program the Flash and EEPROM, and where supported by the serial programming protocol, it can program fuse and lock bits.
AVRDUDE also supplies a direct instruction mode allowing one to issue any programming instruction to the AVR chip regardless of whether AVRDUDE implements
that specific feature of a particular chip.
AVRDUDE can be used effectively via the command line to read or write all chip memory types (eeprom, flash, fuse bits, lock bits, signature bytes) or via an
interactive (terminal) mode. Using AVRDUDE from the command line works well for programming the entire memory of the chip from the contents of a file,
while interactive mode is useful for exploring memory contents, modifying individual bytes of eeprom, programming fuse/lock bits, etc.
AVRDUDE supports the following basic programmer types: Atmel’s STK500, Atmel’s AVRISP and AVRISP mkII devices, Atmel’s STK600, Atmel’s JTAG ICE (both mkI and mkII,
the latter also in ISP mode), appnote avr910, appnote avr109 (including the AVR Butterfly), serial bit-bang adapters, and the PPI (parallel port interface).
PPI represents a class of simple programmers where the programming lines are directly connected to the PC parallel port. Several pin configurations exist for
several variations of the PPI programmers, and AVRDUDE can be be configured to work with them by either specifying the appropriate programmer on the command line
or by creating a new entry in its configuration file. All that’s usually required for a new entry is to tell AVRDUDE which pins to use for each programming function.
A number of equally simple bit-bang programming adapters that connect to a serial port are supported as well, among them the popular Ponyprog serial adapter,
and the DASA and DASA3 adapters that used to be supported by uisp(1). Note that these adapters are meant to be attached to a physical serial port.
Connecting to a serial port emulated on top of USB is likely to not work at all, or to work abysmally slow.
If you happen to have a Linux system with at least 4 hardware GPIOs available (like almost all embedded Linux boards) you can do without any additional
hardware - just connect them to the MOSI, MISO, RESET and SCK pins on the AVR and use the linuxgpio programmer type.
It bitbangs the lines using the Linux sysfs GPIO interface. Of course, care should be taken about voltage level compatibility. Also, although not strictrly
required, it is strongly advisable to protect the GPIO pins from overcurrent situations in some way.
The simplest would be to just put some resistors in
series or better yet use a 3-state buffer driver like the 74HC244. Have a look at http://kolev.info/avrdude-linuxgpio for a more detailed tutorial
about using this programmer type.
2. Socket Library in Python for TCP/IP communication
[ For Documentation : https://docs.python.org/2/library/socket.html ]
The Python interface is a straightforward transliteration of the Unix system call and library interface for sockets to Python’s object-oriented style:
the socket() function returns a socket object whose methods implement the various socket system calls. Parameter types are somewhat higher-level than in
the C interface: as with read() and write() operations on Python files, buffer allocation on receive operations is automatic, and buffer length is implicit
on send operations.