"Burning up" attiny85 chips [SOLVED BUT...]

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
barney
Posts: 6
Joined: Thu Feb 21, 2013 4:03 am

"Burning up" attiny85 chips [SOLVED BUT...]

Post by barney » Thu Feb 21, 2013 4:22 am

I am using the latest 2012-12 stock hid-data example. Since I am using a attiny85 chip I changed these settings in the usbconfig.h file:

#define USB_CFG_IOPORTNAME B // was D
#define USB_CFG_DMINUS_BIT 1 // was 4
#define USB_CFG_DPLUS_BIT 2

In the Makefile I changed these lines:
DEVICE = attiny85
F_CPU = 16500000 # in Hz
FUSE_L = 0xef // should be 0xe1 but documented Makefile says 0xef
FUSE_H = 0xdd

AVRDUDE = avrdude -c usbtiny -p $(DEVICE) # edit this line for your programmer

I am using a usbtiny purchased from SparkFun https://www.sparkfun.com/products/11460?, the kind where you just plug in the chip.

If you look at the Terminal output below you see all works fine but when I try to re-program the chip I get the error below and I believe the chip is dead as I can't seem to do anything with it after that. I'm down 5 chips at this point and don't know what my next step would be. Note this happens even if I don't put the chip in the circuit. It never leaves the programmer.

Please HELP!!

avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.



Code: Select all

Georges-MacBook-Pro:firmware gbarnabic$ make clean
rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s
Georges-MacBook-Pro:firmware gbarnabic$ make hex
avr-gcc -Wall -Os -DF_CPU=16500000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny85 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
avr-gcc -Wall -Os -DF_CPU=16500000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny85 -x assembler-with-cpp -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o
avr-gcc -Wall -Os -DF_CPU=16500000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny85 -c usbdrv/oddebug.c -o usbdrv/oddebug.o
avr-gcc -Wall -Os -DF_CPU=16500000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny85 -c main.c -o main.o
avr-gcc -Wall -Os -DF_CPU=16500000    -Iusbdrv -I. -DDEBUG_LEVEL=0 -mmcu=attiny85 -o main.elf usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size main.hex
   text      data       bss       dec       hex   filename
      0      1958         0      1958       7a6   main.hex
Georges-MacBook-Pro:firmware gbarnabic$ make program
avrdude -c usbtiny -p attiny85  -U flash:w:main.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e930b
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: writing flash (1958 bytes):

Writing | ################################################## | 100% 2.73s



avrdude: 1958 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex contains 1958 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.85s



avrdude: verifying ...
avrdude: 1958 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

avrdude -c usbtiny -p attiny85  -U hfuse:w:0xdd:m -U lfuse:w:0xef:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e930b
avrdude: reading input file "0xdd"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xdd:
avrdude: load data hfuse data from input file 0xdd:
avrdude: input file 0xdd contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xef"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xef:
avrdude: load data lfuse data from input file 0xef:
avrdude: input file 0xef contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Georges-MacBook-Pro:firmware gbarnabic$ make program
avrdude -c usbtiny -p attiny85  -U flash:w:main.hex:i

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

make: *** [flash] Error 1
Last edited by barney on Sat Feb 23, 2013 8:43 pm, edited 1 time in total.

amx
Posts: 6
Joined: Fri Jan 04, 2013 2:00 pm

Re: "Burning up" attiny85 chips

Post by amx » Fri Feb 22, 2013 2:38 pm

Hi, I never used an attiny but other avrs and my guess would be that you dont connect a crystal while programming the chip. It works the first time because the avr ships with fuses set such that he internal rc oscillator is used. If you change the fuses (again, I havent looked up the attiny fuse bits) to ext. 16.5MHz oscillator you must connect such an oscillator even when programming the chip. Seems like the programmer breaks out all pins so you can still add an external crystal circuit to it.

Good luck!

barney
Posts: 6
Joined: Thu Feb 21, 2013 4:03 am

Re: "Burning up" attiny85 chips

Post by barney » Sat Feb 23, 2013 8:41 pm

Thanks for the reply but I am not using a crystal in the circuit. After burning up a few more chips I figured out that I needed to changed the fuse setting.

The notes in the Makefile say this (see below), but for the ATTiny85 apparently you need to make the low fuse 0xe1 NOT 0xef as the excerpt shown below says to make it. I do now see that even thought the header says ATTiny25/45/85, inside the note it says ATMega*5 FUSE_L. I guess that this should be brought to the attention of the author so he can fix it in the next release.

############################## ATTiny25/45/85 ###############################
# ATMega*5 FUSE_L (Fuse low byte):
# 0xef = 1 1 1 0 1 1 1 1
# ^ ^ \+/ \--+--/
# | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz)
# | | +--------------- SUT 1..0 (BOD enabled, fast rising power)
# | +------------------ CKOUT (clock output on CKOUT pin -> disabled)
# +-------------------- CKDIV8 (divide clock by 8 -> don't divide)
# ATMega*5 FUSE_H (Fuse high byte):
# 0xdd = 1 1 0 1 1 1 0 1
# ^ ^ ^ ^ ^ \-+-/
# | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V)
# | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved)
# | | | +-------------- WDTON (watchdog timer always on -> disable)
# | | +---------------- SPIEN (enable serial programming -> enabled)
# | +------------------ DWEN (debug wire enable)
# +-------------------- RSTDISBL (disable external reset -> enabled)
#

Post Reply