2025-03-12 10:23 AM
I'm currently using a STM32L433RCT3 and the L4 HAL library. My goal was to read back a configured RTC alarm, increment it, and restart the alarm. I created a:
RTC_AlarmTypeDef sAlarm;
I read back the RTC alarm using,
HAL_RTC_GetAlarm(&hrtc,&sAlarm,RTC_ALARM_A,RTC_FORMAT_BIN);
I set the RTC alarm again using,
HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, RTC_FORMAT_BIN);
Setting the alarm fails due to,
assert_param(IS_RTC_ALARM_SUB_SECOND_MASK(sAlarm->AlarmSubSecondMask));
If I don't initialize the sAlarm to {0}, the AlarmSubSecondMask is undefined and the HAL_RTC_SetAlarm() may fail. It seems like the HAL_RTC_GetAlarm() should also be retrieving & setting the AlarmSubSecondMask as well.