Open spa-sam opened 6 years ago
hmm... so what shell I do?
Try like as : void setup() { MCUSR = 0; cli(); wdt_reset(); wdt_enable(WDTO_8S); WDTCSR = (1<<WDCE) | (1<<WDE); WDTCSR = (1<<WDE); WDTCSR = (1<<WDIE); // Watchdog interrrupt enabled. MCUSR = 0; sei(); } I don't know why wdt_enable() does not work normally. But, above code work well.
Hello I have the same problem with u8g library. Code above didn't work, could you please solve this problem?
Unlikely. Almost always it's user error, sometimes the implementation of wdt_enable().
In the first message of this thread the user activates the watchdog with WDTO_8S, what means; reset the MC if wdt_reset() is not called at least every 8 seconds. Than he delays for 9 seconds.
WDTO_4S is not available for all avr processors (only on: ATtiny2313, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861, ATmega48, ATmega88, ATmega168, ATmega48P, ATmega88P, ATmega168P, ATmega328P, ATmega164P, ATmega324P, ATmega644P, ATmega644, ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega8HVA, ATmega16HVA, ATmega32HVB, ATmega406, ATmega1284P, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, AT90PWM161, AT90USB82, AT90USB162, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATtiny48, ATtiny88.) WDTO_8S is not available for all avr processors (only on: ATtiny2313, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861, ATmega48, ATmega48A, ATmega48PA, ATmega88, ATmega168, ATmega48P, ATmega88P, ATmega168P, ATmega328P, ATmega164P, ATmega324P, ATmega644P, ATmega644, ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega8HVA, ATmega16HVA, ATmega32HVB, ATmega406, ATmega1284P, ATmega2564RFR2, ATmega256RFR2, ATmega1284RFR2, ATmega128RFR2, ATmega644RFR2, ATmega64RFR2 AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, AT90PWM161, AT90USB82, AT90USB162, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATtiny48, ATtiny88, ATxmega16a4u, ATxmega32a4u, ATxmega16c4, ATxmega32c4, ATxmega128c3, ATxmega192c3, ATxmega256c3.)
In both cases the bits for setting this are distributed to 2 registers. 3 bits in the one 1 in the other. Older implementations of wdt_enable() try to set the 4 bit value on 3 bits in the first register. That results at least in unexpected short times.
U8g libs do not mess with the watchdog. Neither they activate the watchdog, nor do they reset the watchdog for you. However. U8g operations take time. The shortest watchdog times may be exceeded (WDTO_30MS) on slow processors/displays/transfer-methods.
Sorry was from memory. The 4 bits are in the same register but not consecutive. -> same result.
Watchdog not work! Atmega328p, Nokia 5110. If Watchdog is triggered then the microcontroller restarts and freeze (or enters the reboot cycle?!). It does not depend whether there is a bootloader or not.
The display of the Nokia 5110 with the library from Adafruit wdt works.