adafruit / Adafruit_SleepyDog

Arduino library to use the watchdog timer for system reset and low power sleep.
MIT License
235 stars 66 forks source link

Watchdog.sleep() and Feather Lora M0 #7

Closed lbovay closed 7 years ago

lbovay commented 7 years ago

Hi, did anyone get Watchdog.sleep(xxxx) to work with the Feather Lora M0 ? Mine goes to sleep but never wakes up :(

I use the Sleep example code.

Cheers,

PaintYourDragon commented 7 years ago

Code's there and works, but just noticed I didn't bump the version number, so Arduino IDE might not pick up the latest. I'll do that in a couple minutes here (to version 1.1.1), but may take some time to filter up...can either wait a little while, or download and install ZIP if needed immediately.

lbovay commented 7 years ago

@PaintYourDragon Thank you for your answer,

Still no luck.. I'm running Arduino 1.8.1, installed this library in V1.1.1 aswell as this dependancy: https://github.com/adafruit/Adafruit_ASFcore as a zip import.

I use the Sleep example here: https://github.com/adafruit/Adafruit_SleepyDog/blob/master/examples/Sleep/Sleep.ino

Code is building without issues, for testing I used: int sleepMS = Watchdog.sleep(100);

Console output is: Adafruit Watchdog Library Sleep Demo! Going to sleep in one second...

I also didn't connect any pins on my boards, so there is only the USB and an uFL antenna. What am I missing ? Note: the BasicUsage example seems to works as intended.

PaintYourDragon commented 7 years ago

Not sure what to suggest. I'm running same version of IDE & libraries. Slightly different board (RFM69 instead of LoRa), but that shouldn't make a difference, all the M0 boards should run that code identically. MAYBE a compiler difference (I'm on Mac) but haven't seen that sort of thing in years.

scott2b commented 6 years ago

Re: the LoRa boards. If you are using RadioHead, iirc there is a conflict between the radio driver and Sleepy Dog. I believe it was the case when I tried it that they were competing for the same interrupt or something like that. Otherwise, if not using the RadioHead driver for the LoRa, Sleepy Dog seems to work fine.

One caveat. I might not look like it is waking up if you are depending on Serial output. It will lose the serial connection when it goes to sleep. Also, re-loading can be quite finicky if you have a sleep in your loop. I find that I have to kick the Feather by pushing the reset button 2x in order to load new code.

huzarif97 commented 6 years ago

I am currently trying to use both RadioHead and Sleepy Dog and am experiencing the issue scott2b is describing; I found a quick fix where I comment out the area of tc_interrupts.c that creates the TCx_Handler for each TC, but I would like to find a better way that salvages all of the TC's in case I need them for the future. Thanks

Kuurusch commented 6 years ago

Hey, is this issue fixed for the LoRa-modul on the M0?

loicgillioz commented 6 years ago

Hi, I've also found that going into sleep mode with LoRa module makes it crash. I will keep you updated if I find a fix. Commenting the RadioHead include allowed me to use standbyMode() without problems.

Kuurusch commented 6 years ago

@loicgillioz Hey, thanks a lot, yea would be cool. Otherwise the M0 needs way too much energy :/

nyfelix commented 4 years ago

Thank you guys, after testing for almost an hour I realised, that after sleep the Serial connection was broken... but it works all fine.