2021-03-18 04:00 AM
I have setup RTC wakeup functionality and generated code with CubeMX.
The code does not work straight away, because imr1's mr20 in EXTI IMR1 register was not unmasked. I suppose this is a bug and should be handle by STM. It took some time to figure that out and that is not what you expect from automatic code generator.
Note! This is just a bug report and notice for everyone who faced same issue.
/* RTC init function */
void MX_RTC_Init(void)
{
/** Initialize RTC Only
*/
hrtc.Instance = RTC;
hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
hrtc.Init.AsynchPrediv = 127;
hrtc.Init.SynchPrediv = 255;
hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
hrtc.Init.OutPutRemap = RTC_OUTPUT_REMAP_NONE;
hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
if (HAL_RTC_Init(&hrtc) != HAL_OK)
{
Error_Handler();
}
if (HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 7, RTC_WAKEUPCLOCK_RTCCLK_DIV16) != HAL_OK)
{
Error_Handler();
}
/* Adding this line makes Wake up ISR works */
__HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT();
}
2021-03-22 07:31 AM
Hello @SAkhi.951
Thanks for your feedback,
Which part number are you using please?
Khouloud
2021-03-23 07:42 AM
Hello @Khouloud ZEMMELI ,
MCU - STM32L41RCIx. CubeMX FW package FW_L4 V1.13.0