01 September 2011

AVR board not powering off

... or why does my Attiny2313/ATmega168 board stay alive when I flip the switch?

That's the case with my FT-817 keypad&I.F.R. if a SPST switch is used on the Vcc line.

The block diagram above illustrates the situation: if board 2 (right) is switched off and board 1 (left) is powered, a "high" signal on any input pin of board 2 will keep it awake and running. The board on the right goes off only if the TXD-to-RXD line is interrupted as well. Why so?

I initially thought the culprit were the pull-up resistors, so I disabled them all around the UART: board 2 was still up (LCD backlight on, LED lit, uC code running, ...).

I asked around and I was pointed to the right direction: AVR uC input pins protection diodes! I had somehow overlooked them on the mega168 datasheet.

They are there on every single I/O pin, so there is no way I can live without a DPST switch on both Vcc and TXD line. All other (hardware) workarounds mean more components.

Like a small forward voltage diode between 78L05 and Atmega168 that would prevent the LCD to stay up, but the uC would still run the code. Or a line driver chip in front of the ATmega168.

Let's keep things simple and physically interrupt both Vcc and TXD lines (RXD pin on board 2).