adafruit / Adafruit_CircuitPython_DS3231

Adafruit CircuitPython drivers for the DS3231 realtime clock.
MIT License
21 stars 19 forks source link

Alarm triggering prematurely for certain times #42

Open Blake-James opened 2 years ago

Blake-James commented 2 years ago

I'm using the DS3231 alarm 1 as a watchdog by attaching it to the reset pin of my Jetson NX. The python script running on the Jetson constantly updates the alarm time to be some time in the future. This has worked fine when setting that alarm to ~30min in the future while looping every 10min, but it seems like if I set that alarm time to be exactly 1hr from now, the alarm triggers prematurely the moment that I set that new alarm to +1hr from now.

My line of python used to set the alarm looks like: thisRTC.alarm1 = (time.gmtime(newAlarm), "monthly") where newAlarm is an epoch time in seconds +1hr from now. I've tried "monthly" and "weekly".

What's going on here? Why does the alarm trigger as soon as I set it for that particular time?