Question
Problem with RTC_ALARM_C on STM32WB5MM
I’m trying to set an alarm occurring on the 5 minute marks. However, after I set the alarm and try to read it back I always get 0 minutes and no interrupts. My code without the error handling is as follows.
Status = HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN);
Status = HAL_RTC_DeactivateAlarm(&hrtc, RTC_ALARM_A); // Deactivate before setting
/** Enable the Alarm A
*/
sAlarm.AlarmTime.Minutes = 5 * (((sTime.Minutes + 5) % 60) / 5);
sAlarm.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY | RTC_ALARMMASK_HOURS | RTC_ALARMMASK_SECONDS;
sAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_ALL;
sAlarm.Alarm = RTC_ALARM_A;
Status = HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, RTC_FORMAT_BIN);
What am I missing?
Thanks
