Electronic – ATtiny45 pin change interrupt PB5

attinyavrgpioinputinterrupts

On the ATTiny45 data sheets it states that PB5 can be used as a digital IO pin and I want to use it to trigger a pin change interrupt, my only issue is that it is also the reset pin and the moment I connect it to ground to try and trigger an interrupt it resets the ATTiny. Is it possible to use this pin for interrupts and if so how?

Best Answer

Until I checked the ATtiny45 datasheet today I was convinced that you can't program the AVR after programming RSTDSBL in Fuse High Byte. But then I stumbled over this note under Table 6-7 Start-up Times for Internal Calibrated RC Oscillator Clock"

Note: 1. If the RSTDISBL fuse is programmed, this start-up time will be increased to 14CK + 4 ms to ensure programming mode can be entered.

Now it doesn't mention what programming mode is refered to, either High Voltage or SPI. So if your programmer supports it, you may be able to enter the programming mode within 4ms after power up, instead of using the "\$\overline{\text{RESET}}\$-line protocol" (don't know the proper name for it). You should even be able to verify this without programming the RSTDISBL fuse, and just by programming Start Up Times (SUT[1:0] in Fuse Low Byte) for the internal RC osscillator.

Chapter 20 on page 147 and onwards explains various modes for programming of the devices, but fails to mention the RSTDISBL fuse. Seems you need trial-and-error to be 100% sure ...

I personally use Arduino to ISP program AVR's and I suppose one should be able to hack the ArduinoISP sketch to power up the AVR and start the programming handshake within 4ms after that. But I never tried it myself.

Of course you could reset the fuses for your controller using a high voltage programmer like the AVR Dragon. (Dragon apparently isn't able to power cycle the target device, so Dragon won't support programming without utilizing the \$\overline{\text{RESET}}\$-line). On the other hand, Dragon does support HV programming, which solves your problem either way.

Or you could improvise an HV-programmer to reset the default fuses.