Electronics -- Atmel/AVR-programming: Programmer Software
The program atmelprg was developed by me and is available under
the GNU GPL.
Download and Build
The program is distributed as source code, only. It should compile without problems on the Linux-ix86 platform using the GNU C++ compiler (gcc). Other hardware running gcc and Linux is likely to work, too.
After downloading the source code, you need to manually configure the
code before compiling it:
I hope that no additional tweaks are needed. Compiling should be fairly trivial by simply calling make. If an error occurs try and fix it yourself and then send me an e-mail about what could be improved.
Note that you need a bidirectional parallel port. I switched mine to "bidirectional" mode (I do not know if it also workd with EPP or ECP modes) in the BIOS (hey, the box is from 1995!) and it works. Don't know about other computers.
In order to see if things work for parallel programming, plug in the
Latch16Bit board and the
parallel programmer board (with an
AVR RISC in the socket, of course), make sure the switch is
open (no programming mode),
switch on the 5V and 12V power supply.
Waiting to enter programming mode... OK Detected device: (0x1e9401) Device name: ATMega161 Flash size.: 16384 bytes [0x2000 words] Vendor.....: Atmel EEPROM size: 512 bytes Has PAGEL: yes; Fuse+Lock: 2 bytes; ChipErase: RDY/BSY Waiting to leave programming mode... OK
NOTE that atmelprg currently only knows AT90S2312, ATMega161 and (untested:) AT90S4433. Other devices will generate an error. Feel free to patch my software or kindly ask me to do that. (When the program reacts upon closing the programming switch, then this is already a good sign.)
Next, you can try to read and dump the flash content which should be
0xff for a newly-bought chip:
Waiting to enter programming mode... OK Detected device: (0x1e9401) Device name: ATMega161 Flash size.: 16384 bytes [0x2000 words] Vendor.....: Atmel EEPROM size: 512 bytes Has PAGEL: yes; Fuse+Lock: 2 bytes; ChipErase: RDY/BSY Reading flash into buffer "flash" (16384 bytes)... done Dumping buffer "flash" (16384 bytes) [skipping 0x0000..0x1ff0: 8192 words 0xffff] Waiting to leave programming mode... OK
Writing flash and eeprom can be done as follows:
First of all, remember to call atmelprg --help
to get a list of all options/commands with a brief description.
The basic operation is as follows: Each cmd line arg which begins with a dash is considered a command, the others are parameters. So, -load file.bin means: execute command "load" with parameter "file.bin". Commands are executed in the order they appear on the command line.
The next basic principle is buffers. Most commands operate on
buffers which are referred to by their names. So, in order
to load the binary file file.bin into the buffer named buf1,
use -load file.bin buf1. In case you leave
away the second parameter (as further above), the buffer will get a
default name which is the file name (without path, i.e. "file.bin").
The program will not (tell you to) enter programming mode unless this
is necessary. You may SIGINT (^C) it when waiting for you
to close the switch.
If you understood the above, then atmelprg --help will give you anything you need to know. To complete it, here are a few examples:
This will load the files fileA.bin and fileB.bin into
two buffers with the same names as the files, erase the chip, download
(buffers) "fileA.bin" to flash and "fileB.bin" to EEPROM:
I find it practical to verify the written data after programming the
flash so you may use: