New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kinetis: Adjust RTT alarm trigger time #7476
Conversation
The RTT alarm will trigger when the RTT seconds register is equal to the set alarm target, instead of triggering at the following second.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with the changes here (I trust you with the CPU reference manual @gebart).
Just one comment about the minimal alarm value in this case.
RTC_Type *rtt = RTT_DEV; | ||
|
||
/* Disable Timer Alarm Interrupt */ | ||
rtt->IER &= ~(RTC_IER_TAIE_MASK); | ||
|
||
rtt->TAR = alarm; | ||
rtt->TAR = alarm - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if one passes 0
as alarm ? It doesn't make sense but maybe we should ensure alarm
is greater than 1 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should actually still be correct, the alarm will be set to trigger when the counter is equal to 0xffffffff and increments, i.e. when the counter turns 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Un-tested ACK (+1 for fixing the RTT 1s delay)
Tested ACK. Go! |
Thanks! |
The RTT alarm will trigger when the RTT seconds register is equal to the set alarm target, instead of triggering at the following second. This makes the API behave more like what users seem to expect.
Fixes #6331 for Kinetis