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 ....
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
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
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 :-)
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
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.