I have encountered an unexpected problem finalizing the last details of a tiny85 project. I have I2C running as slave, peripherals configured, in short, everything working OK. What I wanted to do as the last step is to set the prescaler of the system clock to 1 by code. This is for the system to work at 8 MHz, but with the fuses set by default.
For this, I added these 2 lines in the setup block:
CLKPR = (1 << CLKPCE);
CLKPR = 0x00;
The problem is that, apparently, these lines brick the tiny85 after the first run. After that, I'm not able to flash it with USBasp anymore.
I flashed two tiny85s with the same result (the first time I couldn't believe what was happening). Then, for the third, I commented these two code lines, recompiled, flashed, and the problem vanished.
Trying to recover the chips, I built a 12-volt programmer with an Arduino Mega 2560, I forced the fuses to the default values, just in case (L:0x62, H:0xDF, E:0xFF). I can verify that the fuses are correctly set, but still, they don't respond to the USBasp.
I must be making some basic mistake, but I can not solve it, can anyone give me any clue? Are the lines to modify the prescaler correct? How can I recover the chips?
Any help is very welcome!
Thanks in advance ...