Closed nimasaj closed 4 years ago
This is one of the biggest limitation on the older ATMega series which I didn't come across (and hence on radio silence on this issue) until very recently. If your source of wake up has a very short pulse (example your low pulse from UART) even in the range of ms, the MCU will not be able to determine what woke it up because upon waking up there will be a delay due to oscillator start up sequence (configured using the fuse and how long depends on the fuse settings). By the time the oscillator start up delay has been completed, your signal has probably already went HIGH
. So, this causes it to skip your ISR function call where you would set the IntFlag
. Possible remedy is to use a shorter delay oscillator start up setting on the fuse but I have tried down to 4800 bps using the shortest possible oscillator start up sequence, and even with that there are chances it skipped the pulse. If you have only the UART as the single source of wake up, you can skip setting and checking the flag altogether and that would work as the low pulse is still able to wake the MCU up but fall short of determining the cause which is probably not important in this case.
Thanks for providing this library and publishing it in public. Using this library, it seems that periodic wakeup using PowerDown mode is incompatible with external interrupt on Atmega328P running on 3.3V-8MHz. I would like to keep Atmega338P in DeepSleep for a fixed interval time (14 minutes periods), but at the same time if an interrupt happens, it can wake up. I have to mention that running solely on deep sleep mode
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF)
is working perfectly, but not working when using it with an ISR. By running following code, everything seem to work in the beginning but after the first period (14 minutes), the board doesn't go into DeepSleep mode and consumption increases to around 3.8mA. Do you have a suggestion/fix/hint for this issue?update1. FYI, I'm using SoftwareSerial library in my code as well.
Sample code
```c #include "LowPower.h" #include