cancel
Showing results for 
Search instead for 
Did you mean: 

RTC IRQ STM32L476

Mich1
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Peter Mather
Associate III

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));

View solution in original post

3 REPLIES 3
Peter Mather
Associate III

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));

Mich1
Associate III

(I used the latest STM32CubeMx)

Does ST have a LL_example?

Mich1
Associate III

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