2019-05-14 08:43 AM
With the STM32 in stop mode 2, is it possible to use the RTC as a additional low power timer?
I mean to trig IRQ periodically.
I tried the PWR_STANDBY_RTC STM32Cube_FW_L4_V1.14.0 example for STM32L476 and the code never stop at the breakpoint in function RTC_WKUP_IRQHandler().
What's more, to avoid debugger I tried to set the LED2 ON inside this function, but the LED never lights up.
Solved! Go to Solution.
2019-05-14 09:07 AM
There was a bug in CubeMX for the L4 which I found - don't know if it has been fixed. I needed to use
EXTI->IMR1|=(1<<20);
to get the RTC interrupt to work.
EXTI20 is the pseudo external interrupt used by the RTC
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, timetosleep, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
EXTI->IMR1|=(1<<20);
HAL_NVIC_EnableIRQ((IRQn_Type)(RTC_WKUP_IRQn));
2019-05-14 09:07 AM
There was a bug in CubeMX for the L4 which I found - don't know if it has been fixed. I needed to use
EXTI->IMR1|=(1<<20);
to get the RTC interrupt to work.
EXTI20 is the pseudo external interrupt used by the RTC
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, timetosleep, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
EXTI->IMR1|=(1<<20);
HAL_NVIC_EnableIRQ((IRQn_Type)(RTC_WKUP_IRQn));
2019-05-14 09:32 AM
(I used the latest STM32CubeMx)
Does ST have a LL_example?
2019-05-16 09:09 AM
You are right Peter. Still not corrected inside CubeMX
Same problem: if Wake Up Clock is change inside CubeMX there is no change in any generated file .....:o