5.10. Using the clock output to revive AVRs
It is possible to disable an AVR if you accidentally set its clock-related fuses to something invalid. The clock settings must be valid for any kind of programming to work. If you are having trouble programming an AVR and think it might be due to invalid clock settings, you can try the steps below to supply a 100 kHz clock signal to the AVR and revive it.
- Connect the AVR to the programmer in the usual way as described in Section 5.1.
- Configure the programmer’s B pin to be a 100 kHz clock output by running
pavr2cmd --line-b clockor by opening the Pololu USB AVR Programmer v2 Configuration Utility, changing “Line B function” to “Clock (output)”, and clicking “Apply Settings”.
- Set the programmer’s ISP Frequency to 1.465 kHz by running
pavr2cmd --freq 1.465or by using the configuration utility.
- Connect a wire from the programmer’s B pin to the AVR’s XTAL2 pin.
- Perform a full chip erase. In Microchip Studio, you can use the “Erase now” button in the “Memories” section of the “Device Programming” dialog. If you are using AVRDUDE, you can take a command you would normally use for programming, and replace the “-U” option and its arguments with “-e”.
- If the chip erase did not work, connect the B pin to XTAL1 and try again.
- If you still cannot get the chip erase to work, read the troubleshooting advice in Section 5.6. If you change anything, be sure to try both XTAL1 and XTAL2 again.
- If you still cannot get the chip erase to work, then there is probably something wrong with the AVR besides its clock settings, and you will not be able to revive it using these steps.
- Reprogram your chip’s fuses to appropriate values. The easiest way to do this is to use Microchip Studio’s user interface, but you can also use AVRDUDE as described in Section 5.9.
- Disconnect the clock signal from the programmer, and set the programmer’s ISP frequency back to a reasonable value like 114 kHz.
- Try programming to ensure that everything is working as expected. If this works, then you have successfully revived the AVR!