avrusb500 is a modern stk500 protocol compatible programer
for Linux, Mac, Windows ... (and more).

http://tuxgraphics.org/electronics

1) Hardware
-----------
The circuit diagram can be found in the hw/ directory

2) Compile
----------
You need a avr-gcc installation with avrlibc-1.2.X

To compile all software including hardware test programs
type the command:

make

4) BitBang loading of firmware
------------------------------
Note: If you have ordered the avrusb500 kit from http://shop.tuxgraphics.org
then you can skip this step. Everything is already installed on the CD.

Loading of firmware is done under Linux only. The programer
is OS independent once you have loaded the firmware.

You can either use the pre-compiled uisp_ppbg binary from bin/
or build it from sources:
- install libusb http://libusb.sourceforge.net
- install uisp-20050207.tar.gz + uisp-20050207-usb-bbpg-patch.txt
  or install uisp-20050207-usb-bbpg.tar.gz
- copy the file called uisp into this directory and name it uisp_ppbg
- become root and execute the make load* commands (see further down)


3) Testing
----------
The hardware is tested in 3 steps:

3a - connect avrusb500 to the usb port of your Linux PC and 
     type 
     more /proc/bus/usb/devices

     Search in this text for "Vendor=0403 ProdID=6001".
     If it is there then the USB part is working.
     If not check soldering and parts for the ftdi chip. A common
     mistake is to swap the D+/D- cables on the usb port.

3b - connect the little programmer bridge cable between CONN1 and CONN4
     (correct polarity please!) and execute the command:

     make load_test_1

     Note: this command needs to be executed as root unless you use
     the avr programming CD from http://shop.tuxgraphics.org

     The LED on the board should start to blink.

3c - This test has only limited added value compared to 3b. Allmost
     all functionallity is already tested if 3a and 3b were passed. You can
     skip this test if you want.
     For the test connect the little programmer bridge cable between CONN1 and CONN4
     (correct polarity please!) and execute the commands:

     make ttydevinit1152
     make load_test_2

     Note: the second command needs to be executed as root unless you use
     the avr programming CD from http://shop.tuxgraphics.org

     Remove the usb connector and plug it back in. Run the following
     command to see that the ftdi_sio module is loaded:
     /sbin/lsmod | grep ftdi

     If it is not loaded then execute the command (as root):
     modprobe ftdi_sio

     execute the commands:

     ./ttydevinit1152 /dev/usb/tts/0
     or (dependent on your Linux distribution):
     ./ttydevinit1152 /dev/ttyUSB0

     Open two shell windows (e.g xterm or Konsole) and execute in

     shell 1:
     cat /dev/ttyUSB0      
     (or cat /dev/usb/tts/0 but that is obvious, I guess...)

     in shell 2:
     cat > /dev/ttyUSB0

     In shell 2 you type now:
     1
     In shell 1 you should see now the text "on OK" and the LED should go on.

     In shell 2 you type:
     0
     and in shell 1 you should see now the text "off OK" ... and the LED 
     should go off.

     You can terminate the cat commands with crtl-c.


4) Loading the final firmware
-----------------------------
After successful testing of the hardware (step 3) you can now load the final
firmware:

make load

This command is rather slow and will take about 40 minutes to 
complete (run it over lunch time). The loading is a bit faster
on a PC with USB 2.0.
You will need to do this firmware loading only once. After this step
you have a fast and modern AVR programmer.


Change history
--------------
2005-09-30:  avrusb500-0.6 first public version
2005-10-18:  avrusb500-0.7, minor editorial updates in the circuit diagram
2005-11-28:  avrusb500-0.8, Circuit diagram updated R11 and R13 changed from 220 to 1K
                            (220 Ohm works also for works also for low voltage 
			    targets [2.7V] but 1K might be better)

Author/Copyright/Links
----------------------
Guido Socher (guido [At] tuxgraphics.org)
Copyright: GPL (see http://www.gnu.org/licenses/gpl.html )
Homepage of the avrusb500: 
    http://tuxgraphics.org/electronics/200510/article05101.shtml

