2019-10-31 05:09 AM
I am using the STM32L433 RTC in periodic wakeup. i have initialised the rtc and it does interrupt once, but never interrupts again. i suspect the ISR rouitne is not clearing a flag some where. i have seen many comments relating to this but no definitive information on the reason or a solution.
The ISR clears the EXTI pending interrupt and the RTC wake up flag.
// clear wake up time flag
RTC->ISR&=~(RTC_ISR_WUTF);
// clear int flag and exit
EXTI->PR1|=EXTI_PR1_PIF20;
Any suggestions appreciated.
2019-10-31 05:51 AM
I came up with same problem and reason was an interrupt have calling another interrupt.
2019-10-31 06:12 AM
Yes i have multiple interruprts servicing many different peripherals. will explore this option. thanks.
2019-10-31 06:29 AM
> RTC->ISR&=~(RTC_ISR_WUTF);
That looks like a minus sign, not a tilde. I don't think that's clearing what you want.
2019-10-31 06:47 AM
You can check flags on IDE.
2019-10-31 02:33 PM
Don't confuse between interrupt and wakeup. Check the PWR flags too. Note that in most STM devices one register contains the flag and it's cleared using another register.
2019-10-31 03:46 PM
Hi,
Thanks to all for the help i managed to solve the problem, as it generally is once discovered was simple.
in order to write to the ISR register the register needs to be write enabled.
the DBP bit in the PWR->CR1 register need to be set.
this code in the ISR works
// set up DBP bit in PWR_CR1 to allow write to RTC registers
PWR->CR1|=PWR_CR1_DBP;
// clear int flag and exit
EXTI->PR1|=EXTI_PR1_PIF20;
// clear wake up time flag
RTC->ISR&=~RTC_ISR_WUTF;
// disable write to RTC registers
PWR->CR1&=~PWR_CR1_DBP; // disable write to RTC registers