Intro: Parallel AVR Programming Board
Some weeks ago I decided to make a simple webserver based on some AVR chip (An instructable describing the project will follow soon :-) ). The idea was to keep the circuit as simple as possible and to reuse the existing available libraries. For that reason I decided to base the webserver on the Atmega328, which could allow me to use the Arduino IDE and libraries to create the program, because the mentioned chip is the heart of Arduino Uno, Arduino Duemilanove and Arduino Nano. I did not want to have a bootloader burned to keep the free memory as much as possible. For that purpose I omitted the USB interface. I left only the ISP programming port. Because the PHY(MAC) chip could be supplied with maximum 3.6V, I have decided to run the whole device at low supply (3.3V). The preliminary intention was to use an USBasp with 3.3V option as programmer, but I found that, if I try to program the AVR chip with it, the webserver voltage regulator was going hot. Trying to supply the programmer with the webserver regulator was also unsuccessful - the programmer was not recognized by the PC. Then I have found solution - to program the AVR chip on a breadboard, where I have to insert all the cables, two 22 pF capacitors and the quartz crystal. And each day, when I wanted to "play" with the webserver to repeat this assemble, what was annoying for me.
I took a decision to make a simple programming board, where I have only to insert the AVR chip, to program it, and to re-insert it on the webserver board. I wanted to reuse a lot of old components and to make the programmer simple, easy and effective.
I had somewhere in my stuff an old "Centronics" connector , extracted from defected old inc-jet printer. I decided to reuse it and to make a parallel programmer. Attention: This programmer will work on PC, which has LPT port. I suppose it will work also with USB 2 LPT adapter, but I did not test this. It is possible also, that some OS could block the access to the LPT port - in this case, may be , this programmer board will not work. It was tested successfully on PC working under Windows XP with embedded LPT port .
Step 1: The Design ....
This programming board is dedicated for the 28-pin DIL AVR chips (see the picture). With small changes it can be redesigned for the other Atmel AVR chips. Additional ISP port can be added, and then the board becomes universal parallel programmer. The schematics is very similar with the STK200 Atmel programmer, or more precisely said with "Pony STK200". The difference between them is that, the second one has am LED indicating the programming process. Both programmers normally have a 25-pin DB-25 connector.
I use a "Centronics" connector, which has 36 pins. The reason for that is: I had one connector available and also the printer cable which was DB-25<->Centronics. The majority of the parallel interface printers had the "Centronics" port.
The programmer is supplied by the USB of the PC. I have soldered a cut USB cable, whose supply & ground wires are used only.
The schematics and the PCB are shown on the pictures. A PDF file for toner transfer PCB manufacturing is attached also.
The "Eagle" PCB design files are available for download.
Remark: The PCB is designed using two metal layers. The top metal layer can be omitted and simple wire bridge connections can be used instead.
Step 2: BOM
The list of the parts needed:
1 x "Centronics" female printer connector (taken from old printer)
1 x USB cable (It should be cut) - I have used one from defected PC mouse
1 x 74HC244 -octal buffer with enable chip ( Ebay )
1 x BC547 - universal LP NPN transistor - can be replaced with general purpose NPN LP transistor
2 x LED - the size and color do not matter
1 x 16 MHz quartz crystal (again Ebay)
2 x 22 pF ceramic capacitors
2 x 100 nF
1 x 10-470 uF electrolyte capacitor
1 x 1 MOhm resistor
2 x 330 - 1100 Ohm resistors
1 x 10 KOhm resistor
1 x 33 KOhm resistor
1 x 28 pin socket for the target AVR chip
If desired - 20 pin socket for the 74HC244 chip
Step 3: The Programming
After soldering of all components the programming board is ready for use.
My intention was to use the Ponyprog software to burn the HEX file inside the Atmega chip.
What for bad surprise! This program was not supporting the Atmega328 chip :-( .
Another solution must be found!
I tried to use directly the Arduino IDE , where I defined as programmer "Parallel programmer" and pressed the menu button "Upload using the programmer". No success..... Because Arduino uses the AVRDUDE programmer, I decided to try directly with it.
It was reporting "The AVRDUDE could not open the lpt1 port" What now?
After small investigation, I have found that the driver "giveio.sys" must be installed. For that purpose in the folder:
\Program Files\arduino-xxx\hardware\tools\avr\bin\ a special "Install_giveio.bat" file exist. It must be started in DOS prompt window and installs automatically the driver.
Another batch executable file "status_giveio.bat" checks the installation status.
These two files exist also in the standalone installation of WinAVR (only AVRDUDE, without Arduino IDE).
Step 4: So Far...so Well :-)
The previous blockage was resolved...
Now comes another problem: There are two different versions of the Atmega328 chip: Atemega328 and Atmega328P. (P means low power). AVRDUDE and Arduino IDE (also using the AVRDUDE software) are configured to work with Atmega328P. The chip, which I use is the "high power" one. Both chips have different signatures!
Arduino IDE and AVRDUDE, both report something like this: "The chip not recognized - false chip signature. For Atmega328 expected signature XX XX XX" ...
Now the solution is the following: Using a text editor the file "averdude.conf" must be opened and edited.
For the Arduino IDE its place is ": \Program Files\arduino -xxxx\hardware\tools\avr\etc\" and for WinAVR its folder is :
A serch for "m328p" is done. In the Atmega328p part definition section of the file the line :
"signature = 0x1E 0x95 0x0F" must be changed to "signature = 0x1E 0x95 0x14"
Step 5: Let's Try Again
Now seems that everything is configured.
Let's try again the programming.
First, I would like to set the correct fuses.
My decision was to set them exactly as in the Arduino boards.
The procedure is the following:
1) The board must be supplied and connected to the LPT port of the PC
2) DOS prompt window is opened
3) We navigate to the WinAVR \bin\ folder, where the AVRDUDE is placed.
4) For the low fuse the default setting is "OxFF"
5) on he command line of the DOS prompt window we have to type the following string:
"> avrdude -c pony-stk200 -p m328p -U - lfuse:w:0xFF:m<Enter>".
In this way we define, that we will use pony-stk200 type programmer on Atmega328/P chip and we want to write 0xFF as value for the low fuse.
For our satisfaction - It works!!!
Now the high and the extended fuse can be written and also the HEX file can be burned.
For very low price, we have a reliable and simple to use programming board for AVR chips.