AnsweredAssumed Answered

Don't understand behaviour of RTC_AlarmCmd()

Question asked by kipp.michael on May 9, 2013
Latest reply on May 24, 2013 by Andy Brown
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?

Outcomes