Question
Don't understand behaviour of RTC_AlarmCmd()
Posted on May 09, 2013 at 22:05
I'm using the RTC on an STM32L151CB and at some point I'd like to disable both alarms and update alarm A. I'm using the following code which doesn't work:
RTC_AlarmCmd(RTC_Alarm_A | RTC_Alarm_B, DISABLE);
RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &Alarm);
RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
The alarm won't be updated this way. It works when I insert some kind of delay functionality before RTC_SetAlarm, or when I disable one alarm after the other, like:
RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
RTC_AlarmCmd(RTC_Alarm_B, DISABLE);
RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &Alarm);
RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
Does someone have an idea what could cause this?
#stm32l1-rtc-alarm