Projects‎ > ‎ATMega328P‎ > ‎

AVR Pocket Programmer

posted Apr 5, 2010, 12:58 AM by Bill Bai
It's fairly simple to open up a notepad on the computer and start throwing down code, but the key link between software and hardware is this AVR Pocket Programmer.  

Pretty much all microcontrollers these days have In-System Programmers (ISPs) which allow new code to be programmed onto them while they are still in the system.  This seems like an obvious thing, but I've had to work with microcontrollers and programmable logic devices that did not have ISPs.  It was a pain in the butt to remove the chip from the circuit, plug it into a special programming socket, download the program, and then put the chip back into the circuit only to find a typo two seconds later and have to repeat the process.  

The chip is still installed in the system, and peripherals can be attached.

The ISP allows that entire process to be avoided by programming the chip while it's still in the circuit and attached to all of it's other peripherals.

This picture shows the 6 connections of the ISP.  The grey ribbon cable in the top left is connected to the AVR Pocket Programmer.

This is a schematic of the 6pin connector at the end of the ribbon cable that connects the programmer to the chip.

The ISP puts the program onto the microcontroller via the Serial Peripheral Interface (SPI) connection module of the ATMega328P.  The Master-Out Slave-In (MOSI), Master-In Slave-Out (MISO) and Serial ClocK (SCK) lines do the heavy lifting of getting the code from the computer into the memory of the microcontroller.  VCC provides +5V and GND is ground/common.  RST connects to the reset pin of the microcontroller.  The reset pin controls the state of the microcontroller.  Without the reset held low (the reset pin is active low), the microcontroller will go on its merry way running the program already on it.  It will just ignore the data coming down the SPI line as gibberish.  However, with the reset held low, the microcontroller enters a programming state; wherein it listens to the data coming in on the SPI interface and programs itself.

Now that the physical connection from the computer to the microcontroller is set up, we can begin to program the micro to do interesting things.