Build the parallel port In-System Programmer (ISP)

Note from the present: these days I use homemade USBasp connectors to upload programs to the AVR, which, you guessed it, connects to the USB port instead.

 In simple terms, the ISP just connects a couple of parallel port pins to a couple of AVR chip pins.

However, there will be a tri-state buffer involved to protect the PC from violent chips. A tri-state buffer comes in the form of another cheap chip, and can `disconnect' the parallel port pins from the AVR.

 

The tri-state buffer chip just fits in one of the more spacious parallel port plugs:

isp_open.jpg See, an ISP can be built without getting too professional...

 

Circuit diagram

I used the below circuit diagram with one change (see `The LED Line' below). The lines ending with triangles mean that they should be connected to Ground.

avrisp-stk200.png Male PC parallel port connector on the left, female connector on the right. Note that on the right only six lines are actually used, so you don't necessarily need a 10-fold cable. Nevertheless, the grounded lines help against noise.

The parallel port plug diagram on the left is male and must be seen as if the pins stand towards you, out of the picture.

The target circuit plug on the right is a female plug and must be seen as if the hole side of the plug faces away from you, so that you are looking at the back of the plug.

You can verify this by looking for little numbers on the plug or an arrow indicating pin one.

You want the 10-fold cable between the two plugs to be as short as possible, meaning about 20 cm, to ensure good communication.

 

The LED line

I did not connect O2A to pin 3 of the 10-pin plug, since I saw no need for a LED. In fact, my other side of the 10-pin plug (the male plug on the circuit board with the AVR chip) connects pin 3 to Ground. So if I wanted a LED, it would have to be still inside the ISP. I would have to connect a LED and a 1k resistor in series between O2A and pin 3.

Although I need only 6 pins on the AVR side, it is a 10 pin plug -- having more grounded wires in the cable reduces interference noise on the data transmitting cables. Note that, while the grounded pins are next to each other on the plug, they end up being alternated with data lines in the cable itself, so that a noise reducing wire is next to each data wire.

 

Explanation of components

The communication is digital, which means that each cable represents one bit; a zero is 0 volt and a one is 5 volt. There are only signals of 0V or 5V passed through the cables, no other voltages in-between or something.

The 74HC244 chip is an array of 8 tri-state buffers. It is called tri-state because it has three states: on, off and disconnected -- or 5V, 0V and zero current (not bound to any particular voltage).

This is what the chip does: when the chip reads a high (5V) on pin I2A, the output pin O2A is also set to 5V. Otherwise O2A is pulled down to zero volt. In other words, O2A always wants to be the same as I2A.

With one exception: If GA is set high (5V), the input I2A has no effect anymore, and O2A is neither zero nor 5 volt, but stays in the third state where no current is allowed to flow.

The reasons this chip is useful are these: the output side is not directly connected to the input. Much more, the output pin mimicks what is seen at the input pin. So, if a pin is accidentally misconnected, you won't destroy your computer's hardware. The second reason is that as soon as programming the chip is finished, all eight buffers are `disconnected' and the AVR chip is free to use its pins as desired.

Note that MOSI is connected to an output pin (O1A), because MOSI is the communication line going from the programmer to the AVR chip. In contrast, MISO is connected to an input pin (I4B), which reveals the fact that MISO is used for communication from the AVR chip to the programmer. MOSI = Master-Out Slave-In, MISO = Master-In Slave-Out, where the PC is the master and the ATMEGA is the slave.

I can't make sense of the diode (1N4148). It's got something to do with supplying the tri-state chip with power, possibly its purpose is to not allow power to be transferred the wrong way. Powering your device through the parallel port is unfortunately not foreseen in the parallel port specification (it might work, but it's dirty).

The resistor and capacitor are used to filter out unwanted noise, I assume.

[Next section]
login 2012-12-16 21:03