MY PROJECTS
robotics - electronics - machining
  Sunday December 22nd 2024 12:51:24 PM

Using USB Tiny with AvrDude

AVRDUDE is a popular command-line program for programming AVR chips. Avrdude 5.5 and newer explicitly supports USBtinyISP!

Install the drivers for  USBTiny using AVRDUDE

For Windows, follow this to get avrdude5.5 and the USBTiny libusb driver for it.

Unzip the files and copy avrdude.exe and avrdude.conf into the winavr/bin directory.

If your windows/system32 contains libusb.dll, make a backup then copy this 1.10 ver libusb.dll into the windows/system32 directory.

Plug the programmer in and when you get the new hardware found,  point it to the usbtiny.inf file. You should now see the USBtinyISP driver in the Device Manager window.

Testing the USBTiny hardware with AVRDUDE

 The programmer uses a Standard 6pin Pinout.

For this example we'll use a atmega128 as the target device.

To test that avrdude is working properly open a command line and run the command avrdude -c usbtiny -p m128 while the device is plugged in (The green LED should be on). 

You should get the following response, which means that it communicated with the programmer but failed to find a connected chip.

 If the programmer is not found, you will get this response:

You can try unplugging and replugging it (a reset may help) or check if the driver is installed, etc.

If you connect the programmer to the target device and run avrdude -c usbtiny -p m128 you should get the following which indicates it communicated properly with the chip.

Using it is simple, just indicate usbtiny as the programmer type. The port option is ignored as it always uses USB.

You can use the -B option to specify the ISP speed. By default the value is 10 which means 100KHz clock, this is good for target clock speeds > 500KHz. If you want the high speed clockrate (400KHz) for target frequencies > 4MHz you can use "-B 1" to speed up programming
To calculate the SPI frequency from the delay value, use this formula:

SPI clock frequency in KHz = 1000/(1.5+B) where B is the delay value

In general, the clock frequency should be at least 4 times larger than the target clock frequency. Try "-B 32" if you're having clocking issues, that should handle even 128khz clocks.



Copyright © Tom_L 2009-2020