Electronic – Cannot program ATTiny85 fused for 32 kHz

attinyavravrdude

Now, I know what you're thinking. I've been thinking it all night too.

Yes, I know that with the tiny fused for a 32 kHz crystal that I'll need the SPI clock to be 8 kHz or less. Even that, however, seems to not be working.

I started with a working board that had a 4 MHz crystal and divide-by-8 fusing. I first used a USBTiny to reset the fuses to the default using avrdude (62 DF FF). I then removed the crystal and its loading capacitors and tacked in a 32 kHz 12.5 pF crystal in its place. I then used the same USBTiny to set the fuses to E6 DF FF. And that's all she wrote.

With a scope, I can peek at the xtal pins and I can see 32 kHz. So I suspect the clock is running.

I knew that I'd be adding -B to the avrdude command line. Before I started all this, I experimented with various values of -B and a flash read. Sure enough, altering -B made the flash read happen faster or slower.

But I've tried adding -B values up to 250 (which I read on this page should result in a 4 kHz SPI clock). Nothing. I've tried using at least 6 different versions of the AVR-as-ISP-but-slowed-down concept with an Arduino Uno. None of them work. All of them work with an unmodified version of the device I started with (with its 4 MHz crystal and original fusing), so I'm confident the wiring is correct.

What else could it be?

Best Answer

I figured it out.

Fuse changes don't erase the flash. The previous sketch started with setting the system clock prescaler to divide-by-8. The clock prescaler survives RESET.

The fix was to temporarily tie RESET low. That way I had a chance to attach the programmer and power up without the prescaler setting taking place. I uploaded a new sketch without the prescaling and it works now.