adafruit / adafruit/Adafruit_CircuitPython_DS3231

Alarm triggering prematurely for certain times

Open
#42 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
25
Forks
19
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the `thisRTC.alarm1 = (time.gmtime(newAlarm), "monthly")` assignment and trace the DS3231 alarm1 handling for the `monthly` and `weekly` modes. Reproduce the case where the alarm is set exactly one hour ahead, then verify that updating it does not trigger immediately and still works for the reported future times.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.