I thought I'd document an issue I've been chewing on for a couple months now, and what recently solved the problem for me.
I had a couple moteino's, which were using interrupts, that would intermittently fail to come out of sleep.
The symptoms, and the steps I took to troubleshoot, were very similar to this thread:
https://lowpowerlab.com/forum/low-power-techniques/moteino-weathernode-won't-wake-upBase on that discussion, I hypothesized my code was allowing the sleep function to be called before interrupts we re-enabled. It turns out this hypothesis was incorrect. The real culprit turned out to be calling flash.sleep when the flash chip was already asleep. The problem was intermittent because the condition for this to occur, requires radio.receiveDone to return false.
Let's walk through the code, common to many of the example sketches, to explain this more clearly...
When setup is called, the flash is initialized and immediately put to sleep:
if (flash.initialize()) flash.sleep();
When running the through the normal loop, the flash chip is only woken up if radio.receiveDone returns true:
if (radio.receiveDone())
{
...
flash.wakeup();
...
}
Once the loop completes the task it was programmed to do (read temp, check motion, etc.), the device is put to sleep:
flash.sleep();
radio.sleep();
LowPower.powerDown(sleepTime, ADC_OFF, BOD_OFF);
flash.sleep is called unconditionally here, which results in an unresponsive moteino, if the flash chip was never woken up to check for a received message.
I was able to consistently demonstrate this issue by commenting out the entire if (radio.receiveDone()) block, while leaving in the final call to flash.sleep.
What I did not do is investigate why radio.receiveDone returned false. I did not need the flash chip for the project I was working on, so I just commented out both radio.receiveDone and the final call to flash.sleep. The problem is completely gone now.
The following thread was what pointed me to this solution:
https://lowpowerlab.com/forum/general-topics/spiflash-initialise()-hangs-intermittently-running-on-moteino/new/If I read this right, commit 7885ef3 on Aug 4, should fix this, so just update your spiflash library. Alternatively, make sure one's code does not try to put to sleep a flash chip that is already sleeping.