I'm quite a beginner in AVRs and this is my first project soldering the microcontroller and programming it on board. I know the ATtiny1634 QFN might not me the best micro for a beginner, but everything worked as expected when I programmed and tested the board, except for the PB3 as input PIN.

After carefully checking the solder and the code, I decided to search on the internet about the problem. I found this topic https://www.avrfreaks.net/forum/pull-not-pulling, that describes a situation very similar to mine, and also other topics talking about an annoying limitation that t1634 has, that curiously only appears in the datasheet's errata:

Errata Rev A

2. Port Pin Should Not Be Used As Input When ULP Oscillator Is Disabled Port pin PB3 is not guaranteed to perform as a reliable input when the Ultra Low Power (ULP) oscillator is not running. In addition, the pin is pulled down internally when ULP oscillator is disabled.

Problem Fix / Workaround: The ULP oscillator is automatically activated when required. To use PB3 as an input, activate the watchdog timer. The watchdog timer automatically enables the ULP oscillator.

Unfortunately, due to the fact that this information is not notified in any I/O Ports description of the datasheet, I found out about it just now that I have my board soldered and the PB3 input is crucial for project's operation.

But, as said in the errata, it seems like the problem can be solved by activating the watchdog timer. As a beginner, I have never user the Watchdog Timer and I know very few things about it. I tried to set the WDTON-Sets watchdog timer permanently on High Fuse, but when I tested it not only PB3 but all of the other inputs didn't work.

Do I have to set this WDTON bit on Hfuse or do I have to do something in my code for activating the watchdog timer as the errata suggests?

Thanks in advance for any help!


1 Answer 1


Do I have to set this WDTON bit on Hfuse or do I have to do something in my code for activating the watchdog timer as the errata suggests?

You can activate the WDT in your code with...


This enables that WDT in interrupt mode. As long as you have interrupts turned off, this should be enough to get your PB3 pin working right.

If want to have interrupts enabled in your code, then you will also need to do something with interrupts that the WDT will start generating on each timeout once enabled. Here is code that will not only enable the WDT in interrupt mode, but will also catch the interrupts with an empty handler....

#include <avr/io.h>
#include <avr/interrupt.h>


int main(void)

    // Enable the WDT in interrupt mode, set the timeout to max (8 seconds)

    WDTCSR = _BV(WDIE) | _BV( WDP3 ) | _BV( WDP0 ) ;


    /* Replace with your application code */

Note that we set the WDT timeout to 8 seconds. This is the maximum timeout and will result the fewest superfluous interrupts.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.