#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