VUSBTiny AVR SPI Programmer Using ATtiny85
after making a usbtiny isp programmer and using it for 6 months, i was looking at making another one for carrying around. i like the simplicy of the usbtiny isp design but would like to make it even smaller and take less parts. one thing in the original design that i want to change is to eliminate the use of clock crystal. one solution i found is that v-usb drivers supports the 16.5Mhz internal oscillator on attiny25/45/85 devices. so i start out this project to have usbtiny isp employs v-usb for usb communication. the immediate benefits is that it saves space and have less component counts (no more crystals).
description from http://www.xs4all.nl/~dicks/avr/usbtiny/
USBtiny is a software implementation of the USB low-speed protocol for the Atmel ATtiny microcontrollers. Of course, it will also work on the ATmega series. The software is written for an AVR clocked at 12 MHz. At this frequency, each bit on the USB bus takes 8 clock cycles, and with a lot of trickery, it is possible to decode and encode the USB waveforms by software. The USB driver needs approximately 1250 to 1350 bytes of flash space (excluding the optional identification strings), depending on the configuration and compiler version, and 46 bytes RAM (excluding stack space). The C interface consists of 3 to 5 functions, depending on the configuration.
description from http://www.obdev.at/products/vusb/
V-USB is a software-only implementation of a low-speed USB device for Atmel’s AVR microcontrollers, making it possible to build USB hardware with almost any AVR microcontroller, not requiring any additional chip.
Step 1: Features and parts
note that the io lines to the target mcus are not protected. you can add 1k-2k resistors to SCK and MOSI and protect against possible wrong connections
based on the works found at
* attiny45/85 (85 is more easier to come by)
* 3.6v zener diodes (1n747,BZX79,..avoid 1W types)
* 68ohm resistor x 2
* 1.5K resistor
* mini breadboard 170 tiepoints
* usb cable (dollar shop usb printer cable is fine)
* 1k/2k resistors for io lines protection (optional)
* a working avr programmer (yes, it’s a catch22, we need one to make one)
* working avr programming environment.
Step 2: Breadboard layout, schematic, and construction
* follow breadboard layout, there ain’t that may components, 3 resistors, 2 diodes, 1 cap, plus an 8 pin mcu.
* get a dollar shop usb printer cable cut off the printer end, there will be 4 exposed wire, secure and make them into a 4 pin male header, we will use it to connect to the breadboard. consult schematic for layout and pin assignment (J1).
* watch out for diode polarity.
building and flashing the project
the project was built in a linux ubuntu lucid box with avr-gcc toolchain. it is assumed you already have such an environment, or you can find out from the internet how to setup one up. source codes are gnu gpl v2 licensed from inheritence.
the source code follows a convention recommended by v-usb, you can download the source package vusbtiny.tgz and untarred in into a project directory. within your source directory, there is a main.c, which is my version of modified usbtiny programmer. and a usbdrv sub-directory, which contains the v-usb layer. please observe licensing term from the above two projects when building this. my source on the programmer logic is based on Dick Streefland version and not the ladyada version (although they are almost the same).
for those who do not have a build too-chain, you can use the following binary
click to download vusbtiny.hex
and use avrdude to flash firmware
avrdude -c usbtiny -p t45 -e -V -U flash:w:usbtiny.hex
(if your device is a tiny85, replace -p t45 w/ -p t85)
source can be download here
click to download vusbtiny.tgz
untar the source package into your working directory
tar -zxvf vusbtiny.tgz
* do cd vsubtiny, to change into vusbtiny working directory
* ajust makefile for target device according to the chip you will be using. i.e. PROGRAMMER_MCU=t45 or t85
* do a make
* attach your favorite ISP programmer
* modify makefile and change your avrdude parameters if needed. the stock one assumes USBTiny programmer. i.e. AVRDUDE_PROGRAMMERID=usbtiny
* flash firmware via make install
after flashing firmware, we need to properly set the fuse, we are using pin 1 reset as io in this project
* ppl clock used as required by v-usb layer for usb timing
* reset pin disabled as we need to use it as io
avrdude -c usbtiny -p t45 -V -U lfuse:w:0xe1:m -U hfuse:w:0x5d:m -U efuse:w:0xff:m
this setting disables further programming via 5V SPI as we need the RESET pin (pin1) for io. you will need access to a HVSP programmer to recover the fuse.
For more details, click: VUSBTiny AVR SPI Programmer Using ATtiny85
Leave a Comment
You must be logged in to post a comment.