RTC Flags problem when alarm is set
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-05-16 4:37 AM
Posted on May 16, 2014 at 13:37
Hi,
My RTC (F103) is currently running from LSI. The counter is counting properly, and the SEC flag in CRL is set every second as expected. When the Alarm is set, the SEC flag is asserted and cannot be cleared anymore. Also the alarm flag never gets set regardless of the value written to the ALRL and H registers. Here's an example: withRTC_SetAlarm line commented, the led changes it's state once every second.
RTC_ClearFlag(RTC_FLAG_SEC);
while(RTC_GetFlagStatus(RTC_FLAG_SEC)==RESET);
//RTC_SetAlarm(RTC_GetCounter()+10);
RTC->CRL = 0;
while (1)
{
x = RTC_GetFlagStatus(RTC_FLAG_SEC);
if (x)
{
BRD_LedToggle(LD2);
RTC_ClearFlag(RTC_FLAG_SEC);
RTC->CRL = 0;
}
}
Uncommenting the
RTC_SetAlarm(RTC_GetCounter()+10) results in always true if condition that blinks the led on every iteration of the while loop. Clear flag does nothing and the flag is constantly asserted.
Can anyone replicate this problem? What would be the source of it?
This discussion is locked. Please start a new topic to ask your question.
0 REPLIES 0
