USB Programmer for AVR Microcontrollers version 1.0 (uavrp-1.0)

2006-11-22: I have just learned of a new project, "USBtiny". It sounds like it does more than my design did, all with clearly GPL-licensed software.

I am no longer working on this project. I encourage anyone who is interested to continue it.

Download [This file is an agumented version of the README.txt file included in the distribution]

Why in the world?

I created custom hardware to program AVR microcontrollers over USB. Originally I patched avrdude, but now I've written my own. The advantage of uavrp is that it runs on Windows and Unix, and that it interfaces to my harware.

What can't it do?

It's really a stretch to call this release 1.0. It has only been tested programming the program space on an atmega16. There aren't definitions for most AVR parts. Timings are wrong. Etc.

License

Portions (libusb-win32) are GPL and LGPL. You can download the source at http://libusb-win32.sf.net

Portions written by me (Jeff Epler) are covered by the GNU GPL. Obviously, a firmware image does not become GPL merely because it has been uploaded to a part by this software.

Python is distributed separately, under an open source license. See http://www.python.org.

Requirements

My custom USB hardware, Python 2.2 or better, USB ports, libusb on Linux (libusb-win32 is included in for Windows users)

Installation

Linux

First run "setup.py install" as root. Then, in the file /etc/hotplub/usb.usermap, copy the first non-comment line and change the third and fourth fields to 0x03eb 0x0002. Be careful to preserve the format of the file.

Now, plug the programmer in, attach it to a part you don't care about, and run

	$ uavrp-program.py
your part should be detected and erased, followed by an error about the argument list (because no firmware was listed on the commandline)

Windows

Install Python 2.3, available from http://www.python.org/ Double click the installer and follow the directions onscreen. Then plug in the programmer. Install the driver located under the Python directory, for example
	C:\python23\uavrp-driver\uavrp.inf

Now, attach the programmer to a part you don't care about and run

	C:\> uavrp-program
your part should be detected and erased, followed by an error about the argument list (because no firmware was listed on the commandline)

Usage

	uavrp-program firmware.hex
uavrp currently only programs firmware, not eeprom. Definitions for only 2 parts (at90s2313, atmega16) exist, and only one has been tested. (atmega16).

uavrp-program's only argument is an "ihex"-format image to be programmed on the attached device.

Adding a new part

Support for a new part is added by creating a new class in site-packages/uavrp.py. A new part inherits from Programmer and a number of other classes that describe the part (is the program memory banked or unbanked? Are there fuse bits? Are there lock bits?) and adds data to describe characteristics such as the format of the various SPI packets, part signature and memory sizes.

A Template is constructed from a 32-bit hex number, followed by a list of zero or more input parameters given as a bit shift and a bit mask, followed by the output parameter given as a bit shift and a bit mask. This is different to the way Atmel's documentation describes things. Template.fromstr() is a factory method which takes a specification from the datasheets (such as "0010 1000 xxxx xxaa bbbb bbbb oooo oooo") and creates a Template from it, with the following assumptions:

Example:

	class At90s2313(Programmer, unbanked_memory, unbanked_eeprom):
	    signature = 0x1e9101
	    read_program_lo = Template(0x20000000, [(8, 0x3ff)])
	    read_program_hi = Template(0x28000000, [(8, 0x3ff)])
	    
	    write_program_lo = Template(0x40000000, [(8, 0x3ff), (0, 0xff)])
	    write_program_hi = Template(0x48000000, [(8, 0x3ff), (0, 0xff)])

	    read_eeprom = Template(0xa0000000, [(8, 0x7f)])
	    write_eeprom = Template(0xc0000000, [(8, 0x7f)])

	    write_lock = Template(0xace00000, [(17, 0x3)])

	    chip_erase = Template(0xac800000) 

Future

Fixing the warnings printed by python2.3! (about unsigned ints becoming longs)

Obvious stuff, like reading flash, reading/writing firmware, lock bits and fuse bits. Getting the timing right, not just "good enough to program my devices". Supporting more devices. Allowing the user to override the detected part.

Less obvious stuff, like "SPI16" to program 4 bytes at once, as a speedup (since usb latency seems to be the biggest time suck)
[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[TXT]HEADER.html20-Oct-2008 11:16 5.2K 
[TXT]README.txt27-Mar-2004 16:11 4.0K 
[   ]uavrp-1.0.1.zip31-Jan-2005 08:20 68KSource for Windows or Linux
[   ]uavrp-1.0.win32-py2.3.exe27-Mar-2004 16:13 66KInstaller for Windows
[   ]uavrp-1.0.win32.zip27-Mar-2004 16:13 49KBinary Zip for Windows
[   ]uavrp-1.0.zip27-Mar-2004 16:13 57KSource for Windows or Linux
[DIR]uavrp-1.0/05-Apr-2004 11:04 -  

Apache/2.2.14 (Ubuntu) Server at bald.unpythonic.net Port 80