In error, I set a fuse bit on my ATtiny85 to expect an external clock (lfuse:w:0x62:m
) instead of a crystal (lfuse:w:0x6f:m
).
That locked me out of running or reprogramming it, but I imagined I could reprogram it if I simply supplied the desired clock signal, using PWM from another Arduino. However, what I set up isn't doing the trick. Anybody care to help troubleshoot? (Or is the whole concept faulty?)
The setup
I'm using the Arduino UNO as ISP (that's also what I used to brick the ATtiny85). I'm using the Arduino MEGA to supply a pulse for the clock.
The sketch on the Mega (for supplying the pulse) is as follows:
void setup()
{
setup2560();
}
void setup2560()
{
// OC0A is PB7, i.e. D13
pinMode(13, OUTPUT);
// PWM mode, non-inverted
TCCR0A = (3<<WGM00) | (2<<COM0A0);
// use Output Compare Register A, no prescaling
TCCR0B = (1<<WGM02) | (1<<CS00);
// Output Compare Register A
OCR0A = 4;
}
void loop()
{
}
My command to avrdude is:
avrdude -p attiny85 -P com8 -c stk500v1 -b 19200 -U flash:w:main.hex
The error message
avrdude.exe: Device signature = 0x000000
avrdude.exe: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
The error message is exactly what it was when the ATtiny85 had a crystal hooked up instead of the Arduino MEGA. (And same as when nothing was connected for clock.)
I didn't do any math to ensure that my MEGA's pulse frequency should equal the 16MHz which I instructed the ATtiny85 to expect (back when I bricked it). But I don't suppose that matters so much as the fact that the pulse is well over four times as fast as the programmer's Overriding Baud Rate of 19200 (which I set in the args for avrdude).