AVR programmers at CSE

AVR programmers at CSE

Terms

AVR devices can be programmed in parallel mode or serial mode.
Serial mode is also known as SPI.
In parallel mode you can program every feature including all the fuse bit.
Serial mode cannot program a number of fuse bits. Never the less it does everything that most people will ever need
Parallel programming does not necessarily mean the parallel port on your computer
Serial programming does not necessarily man the serial port on your computer

Programmers used at CSE

News - May 2004

The 'avrdude' programmer is part of the standard AVR-GCC development environment. No-one here has actually used it since we have used other things from long ago and have tended to keep using what we know. I think it would be a good idea for someone to evaluate 'avrdude' - i think it will replace all the programmers I discuss in the following section.

There are many programmers available for AVR micros. The cheapest are the simple parallel port programmers, which just consist of a DB-25 and a few resistors and wires. In CSE a serial port programmer based on an Atmel App Note AVR910 has also been used a lot - and is required if you happen to have a notebook without a parallel port.

Which programmer to use ? Maybe PonyProg is the way to go as it seems to have the most complete coverage of AVR devices at this time. See below for more details,. UISP is a good call if you don't want a grphical interface. SP12 works fine for me - it has a new configurable 'dev' file feature that seems to promise support for all future devices, Mega or otherwise.

A programmer actually consists of two things - the physical hardware and the program that runs on your developmnet machine.

Note that the new Mega versions of the AVR's require page-based programming, while the older members of the family used byte-based programming. Some programmers and/or their support software don't handle page-based programming too well.

hardware

There is also 'avrdude' which seems to becoming part of the AAVR-GCC toolchain. Its a parallel port programmer - but I have no experience with it.

Software

Successes and Failures


The serial port programmer based on Atmel's AppNote #910.


Programming a Mega323 using CSE's serial port progranner

For some time a standard programmer used at CSE for programming AVR's has been a serial device based on Atmel AppNote AVR910. Basically a small AVR plugs into a serial port, a host program then loads the stuff down the serial port and the small AVR then programs the target device.

This system broke when the School started using the new Mega323. A bit of sleuthing showed that the problem was that the new Mega AVRs are programmed in page mode - previous processors only supported byte mode. The small programmer itself does support page mode, the problem actually resided mostly in the hosts program.

So changing host program to

	uisp '
was tested and does support page programming. The following lines shows how to invoke it for a Mega - this is just a simple script

    #!/bin/sh

    # -dpart is the hex part number, so ?? for an 8535, etc
    # programmer crystals  4MHz->19200    8MHz->38400  12MHz 57600   16MHz=??
    uisp -v=2 --upload --erase  -dprog=avr910  -dspeed=19200 -dpart=45
          -dserial=/dev/ttyS1 if="ledflash.hex"

the 'dpart' parameter is a magic number that tells the programmer what avr is being used. I had to modify the programmer to say that yes - there did indeed exist a Mega323 - and its magic number was 45. I have reporgrammed a number of existing programmer devices to handle this.
only use appropriately tagged programmers.

Other Mega devices are not supported as at today - since we have none to test with. If another comes along, it is easy enough to change it. At least for me :-)

In this directory are two tar files:

Source for GCC, a script for the programmer, the hex file, etc. Just type "./prg_uisp"
  • uisp-20021201.tgz - source for uisp - there is an executable inside (compiled under RH8)

  • faster programming using the serial programmer

    The serial port programmer we use will operate correctly at other clock speed.s. It operates apparently correctly at 4MHz - the 'native ' speed, and also at 8MHz and 12MHz.

    The following baud rates apply for different crystals
    4MHz - 19200
    8MHz - 38400
    12MHz - 57600

    This can be specified in the command line invocation of 'uisp'

    if course changing the crystal may damage the programmer - your call, don't blame me