Get Interfaced with AVR ISP Programmer (USB)
AVR ISP programmer is a simple to use USB programmer for AVR devices. It is low cost, easy to use, works great with avrdude and is tested extensively on Windows platform.
Features
- Standard AVR ISP programmer
- ATtiny2313 with USBtiny firmware preloaded
- Buffered output
- PTC fuse protected power
- Programmer can power target
- Slide Switch to select target powering
- Supports almost all AVR Microcontrollers
- Power LED, USB data LEDs and two status LEDs
- Both 10-pin and 6-pin targets supported
Board Overview
AVR ISP Programmer uses SPI to program the target device. Six pins are required for the purpose : Vcc, GND, Reset, MOSI, MISO, and SCK. The programming can be done with standardized 10-pin, 2×5 connector.
mini-B USB Connector is the data and power input to the AVR ISP Programmer. The programmer can deliver power to the the target device. Flick the switch(named TPWR) to “ON” position, to power the target device. It can deliver upto 500mA before tripping the on-board PTC. It will output 5V, so if you’re working with a 3.3V or 1.8V system, make sure this switch is in OFF position.
74AC125 Buffer – This chip helps to add some protection to the programmer by buffering the data-line outputs.
2×5 IDC connector – Connect the programming cable to this header and program your AVR.
ATtiny2313 ISP header – The 6-pin header is to program ATtiny2313 if you want to modify the programmer firmware.
LEDs – There are five indicator LEDs for power(PWR), programming status(STS1,STS2) and data transfer(D+,D-).
ISP pin-out
Using AVRDUDE
AVRDUDE is a very popular command-line program for programming AVR chips using the in-system programming technique (ISP). You must open up “Command Prompt” (for Windows) or “Terminal” (Mac/Linux) to use this command-line tool.
There are some predefined commands for avrdude, which gets listed by typing the command ‘avrdude’ followed by enter. The response shown as below
To make sure the AVR Programmer is get ready to program with AVRDUDE by using command “ avrdude -c usbtiny -p m32 “(avrdude -c usbtiny -p atmega32 also working fine.). Where -c is the programmer type and -p is the part number of AVR device used. (If you don’t know the part number for your device, just specify –p? to list all parts in the configuration file) AVRDUDE will attempt to read the Device Signature from your AVR, which is unique for a device family. If everything is connected correctly, you should get a response like this
Flash Programming
If everything is working fine, you can flash the hex file to the target device. Location of the hex file can be specified in the command prompt by following way. For example, if the path of the folder containing hex file is D:\LED\default\LED.hex, type ‘ D: ‘ followed by enter you will get response as ‘ D:\> ‘ then type cd\LED\default and press enter again.
Wanna write flash?
The command -U handles read, write and verify memory operations (r-read, w-write, v-verify). To write the hex file LED.hex to flash memory, use the following command
‘ avrdude -c usbtiny -p m32 -U flash:w:LED.hex ‘.
Read flash memory
The command to read the flash memory contents of an AVR is ‘ avrdude -c usbtiny -p m32 -U flash:r:read.hex ‘. You can specify the location to save read file as told earlier. The command reads the contents of your AVR flash memory and stores it as “read.hex”. Read operation takes more time.
Reading/Writing fuses
Fuses are the configuration files that tell the microcontroller what clock frequency it’s supposed to run at, what voltage to shutdown at, which kind of oscillator used, etc.. Turns out we can use a special kind of fuse called a “Lock Bit” to lock part of the AVRs memory so that the boot loader cannot be overwritten. Besides lock bits, fuses are separated into two different categories: low fuse byte and high fuse byte.
The commands below help to read and /or write fuse files from/to the target AVR device.
You can use these commands to read lfuse, hfuse, efuse and lock files, also specify the file name with to save read file.
avrdude -c usbtiny -p m32 -F -U lfuse:r:lfusefile.hex
avrdude -c usbtiny -p m32 -F -U hfuse:r:hfusefile.hex
avrdude -c usbtiny -p m32 -F -U lock:r:lockfile.hex
For example to read lfuse, send command ‘ avrdude -c usbtiny -p m32 -F -U lfuse:r:lfusefile.hex ‘ you will get response as follows. The lfuse save in lfusefile.hex file.
To write fuse file the commands are,
avrdude -c usbtiny -p m32 -F -U lfuse:w:lfusefile.hex
avrdude -c usbtiny -p m32 -F -P usb -U hfuse:w:hfusefile.hex
avrdude -c usbtiny -p m32 -F -P usb -U efuse:w:efusefile.hex
avrdude -c usbtiny -p m32 -F -P usb -U lock:w:lockfile.hex
If you want to read one of the avr device memory and write it to another target device,you can do simply as follows (here the device is ATMEGA32, has no efuse file).
To read,
avrdude -p m32 -F -P usb -c usbtiny -U flash:r:code.hex:i -U lfuse:r:lfusefile.hex:i -U hfuse:r:hfusefile.hex:i -U lock:r:lockfile.hex:i
To write,
avrdude -p m32 -F -P usb -c usbtiny -U flash:w:code.hex:i -U lfuse:w:lfusefile.hex:i -U hfuse:w:hfusefile.hex:i -U lock:w:lockfile.hex:i
You can write fuse bits directly as follows:
avrdude -p m32 -F -P usb -c usbtiny -U flash:w:code.hex:i -U lfuse:w:0xEF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
Note: The values of fuse bytes are written as an example only, refer the datasheet for the proper configuration bits.
Dimension
Resources
Shop with us
Leave a Reply
You must be logged in to post a comment.