Folks,
While working on an earlier project, I bought 10 AT85's. I bricked a couple while doing that project, but I recently started a new project, and in the course of an evening, I have lost another two chips. I only have 3 left.
I'm pretty sure I know what I did wrong. The effect is that I program a chip (a small test program to check something or other. It works. I modify the program and try to re-write it, but it says that the fuses have been set to zero.
avrdude.exe: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.03s avrdude.exe: Device signature = 0x000000 (retrying) Reading | ################################################## | 100% 0.03s avrdude.exe: Device signature = 0x000000 (retrying) Reading | ################################################## | 100% 0.03s avrdude.exe: Device signature = 0x000000 avrdude.exe: Yikes! Invalid device signature. avrdude.exe: Expected signature for ATtiny85 is 1E 93 0B avrdude.exe: safemode: hfuse reads as 0 avrdude.exe: safemode: efuse reads as 0 avrdude.exe: erasing chip avrdude.exe: reading input file "0xE4" avrdude.exe: writing lfuse (1 bytes): Writing | | 0% 0.00s ***faile d; Writing | ################################################## | 100% 0.09s avrdude.exe: 1 bytes of lfuse written avrdude.exe: verifying lfuse memory against 0xE4: avrdude.exe: load data lfuse data from input file 0xE4: avrdude.exe: input file 0xE4 contains 1 bytes avrdude.exe: reading on-chip lfuse data: Reading | ################################################## | 100% 0.01s avrdude.exe: verifying ... avrdude.exe: verification error, first mismatch at byte 0x0000 0x00 != 0xe4 avrdude.exe: verification error; content mismatch avrdude.exe: safemode: hfuse reads as 0 avrdude.exe: safemode: efuse reads as 0 avrdude.exe: safemode: lfuse changed! Was e4, and is now 0 Would you like this fuse to be changed back? [y/n]
I'm using Atmel Studio-7, and tools/External tools AVRDude commnd line is ...
-U lfuse:w:0xE4:m -U hfuse:w:0xdf:m -e -v -F -pattiny85 -cstk500v1 -PCOM6 -b19200 -D -Uflash:w:"$(TargetDir)$(TargetName).hex":i -C"C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"
I think I know what I did wrong, but I'd like your assurance that it would produce the effect I'm getting, and maybe a friendly shovel to dig me out.
In writing the test program, I set all port pins to OUT except INT0, which I'm going to use. "All pins" includes PB5, which is used for RESET, and the Arduino Nano that I'm using as a programmer needs to yank that line in order to program the chip.
main: ; Load stack register LDI R16, HIGH(RAMEND) ; Upper byte OUT SPH,R16 ; to stack pointer LDI R16, LOW(RAMEND) ; Lower byte OUT SPL,R16 ; to stack pointer ; Define directions for port pins ldi r16,(1<<PB0)|(1<<PB1)|(1<<PB3)|(1<<PB4)|(1<<PB5) ; <==== I guess this is the problem. PB5 = Reset out DDRB,R16 ; Set all ports OUT except INT0 (PB2)
My questions :
Q1 : would this produce the effect I'm seeing?
Q2 : Has it really set the fuses to 00, or does it just think so because it is unable to pull the RESET line?
I now have four bad chips, of which two (and maybe all) have the same issue, so ...
Q3 : Have I stuffed them? I guess I can't even supply an external clock to a pin set as output.
Thanks People.