javos65 / WDTZero

Allows to use the WatchDog functionality for Arduino Zero, MKRZero and MKR1000 only
15 stars 12 forks source link

WDT and RTC Not working together #6

Closed mattb1969 closed 3 years ago

mattb1969 commented 4 years ago

Hi, I noticed a previous comment that was closed without an actual resolution, I think it was misunderstood as reading the post suggests a similar set of issues that I am currently experiencing. (https://github.com/javos65/WDTZero/issues/2)

Using MKRWAN 1310 board

If I this WDT timer running, it works fine. When set to 16 seconds, it reset the processor at the right time.

If I have a RTC timer running, it happily triggers every 30 seconds as configured. This has been modified to use the OSCULP32K clock as per another post to reduce power (https://forum.arduino.cc/index.php?topic=553612.0). (https://github.com/arduino-libraries/RTCZero)

If I have a RTC and a WDT both configured within the application, neither appear to work correctly.

I have looked at the configuration for both, they are using the same clock (GCLK_GENCTRL_SRC_OSCULP32K), they both have the same basic setup GCLK->GENCTRL.reg = (GCLK_GENCTRL_GENEN | GCLK_GENCTRL_SRC_OSCULP32K | GCLK_GENCTRL_ID(2) | GCLK_GENCTRL_DIVSEL );

Yet the system is not working. I am not a clock expert, so I am a little uncertain as to how to resolve the issue. I am not sure it is even an issue with this library,

javos65 commented 3 years ago

Hi,m sorry for my late reply. I expect there is a conflict with clock resources or clock settings among RTC and WDT. Need to figure this out when I have the time :)

DamonLane commented 3 years ago

I don't want to "me too" or hijack, but I'm having an issue that could be related and therefore may help figure out what's happening. In my case, documented by someone else here: https://forum.arduino.cc/index.php?topic=619945.0, it's ArduinoLowPower and WDTZero that don't work together. I'm trying to use several minutes of sleep and the 16M softcycle, but the device resets very quickly, defintely within a minute, but I can't tell how quickly from the remote data.

andreacosti commented 3 years ago

I'm very interested in the solution of this bug too.

mattb1969 commented 3 years ago

Check out this link. I’ve taken what is here and built it further with low power in mind.I’ve not configured long sleep cycles, the example is only a few seconds, but the framework is there for longer, but you’ll need to get to grips with various register settings for a longer time period and make use of the Early warning feature.

https://github.com/mattb1969/InterruptswithRTCandWDT