Sunday, August 14, 2011

Using the Adafruit USBtinyISP

The new CEENBoT Commander uses an open source AVR mkII ISP driver that is not compatible with the regular AVR driver. When you try to run both the new CEENBoT Commander and AVR Studio 4 on the same computer, the AVR proprietary driver will load and CEENBoT Commander will not be able to program the CEENBoT. When you have both CEENBoT Commander and AVR Studio 4 installed on a computer you will need to use AVR Studio 4 to send the programs to the robot.

Well I figured that if I have to use AVR Studio 4 anyway, I might as well use the Adafruit USBtinyISP. I had built one of these kits earlier and had gotten it to work using directions from the USBtinyISP page. I used the Windows directions here.

It is really not too bad leaving CEENBoT Commander to go over to AVR Studio 4 to upload programs. And when I want to program the CEENBoT with the API using C, I can do that too using the USBtinyISP.

The next generation of CEENBoT will have the ISP programmer built in and accessible through a USB cable. So eventually the ISP programmer will not be needed anyway.

Connecting using USBtinyISP


Setup USBtinyISP Programmer
Install drivers and check that the USBtinyISP appears in the Windows device manager

Setup a COM bridge (COM2 <> COM6)
Install com0com bridge (Unclick the CNCA0<>CNCB0 checkbox during install)
Check Windows device manager for COM ports in use
Use com0com bridge command: install PortName=COM2 PortName=COM6
Windows will setup the ports (Answer No, do not search Internet, then Install automatically)
Device manager should now show the ports

Setup USBtiny500 Emulator
Install the software and run USBtiny500
Select one of the ports for the USBtiny500 emulator like COM2
Once the port is selected the USBtiny500 emulator will look for a USBtiny
The other port will be used in AVR Studio for the programmer: STK500 on COM6
The USBtiny should be found on a USB port, USBtiny500 should show: Status: Ready
If it fails to find the USBtiny on a USB port, unplug and reconnect the USBtiny interface

Setup the AVR Programmer in AVR Studio 4
Use Tools menu > Program AVR > Connect (or use Con button on toolbar)
Select Platform: STK500 and Port COM6

Verify AVR Programmer Setup by Connecting to CEENBot
Use Tools menu > Program AVR > Auto Connect (or use AVR button on toolbar)
Click Cancel if an upgrade warning message box is desplayed

Turn on CEENBoT
Connect ISP cable (6 pin)  to ISP port on CEENBoT, match the red stripe with pin 1
Under the Main tab select device: ATmega324P and Programming Mode: ISP mode
Click Read Signature button to check the connectivity to the CEENBoT
The Read Signature button may need to be clicked a few times to get the proper reading
The USB connection to the computer may need to be unplugged and reconnected
The signature returned should match selected device: ATmega324P