RTC Alarm EventCallback called only 1 time
Working with the RTC I'm having some issue with the callback only being called a single time.
void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) {
RTC_AlarmTypeDef sAlarm;
uint32_t hobb_time;
__HAL_RTC_ALARM_CLEAR_FLAG(hrtc, RTC_FLAG_ALRAF); // Does not seem to change the ISR register
hobb_time = HAL_RTCEx_BKUPRead(hrtc, RTC_BKP_DR1);
// Write the new hobbs incremented value to backup register
HAL_PWR_EnableBkUpAccess();
HAL_RTCEx_BKUPWrite(hrtc, RTC_BKP_DR1, ++hobb_time);
HAL_PWR_DisableBkUpAccess();
HAL_RTC_GetAlarm(hrtc, &sAlarm, RTC_ALARM_A, FORMAT_BIN);
if(sAlarm.AlarmTime.Minutes > 58)
{
sAlarm.AlarmTime.Minutes = 0;
}
else
{
sAlarm.AlarmTime.Minutes = sAlarm.AlarmTime.Minutes + 1;
}
while(HAL_RTC_SetAlarm_IT(hrtc, &sAlarm, RTC_FORMAT_BIN) != HAL_OK){}
}
I have the alarm being triggered every 1 minute. I can see the alarmA flag and try to clear it with this macro:
__HAL_RTC_ALARM_CLEAR_FLAG(hrtc, RTC_FLAG_ALRAF);
But the ISR register is unaffected.
I've masked the DAYS, SECONDS, etc.
sAlarm.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY|RTC_ALARMMASK_HOURS
|RTC_ALARMMASK_SECONDS;
sAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_ALL;Anybody working with alarm events that only trigger a single time?
