2023-04-24 07:13 PM
Hello guys, I am working with an STM32L071CBT6 MCU. I want to have a cycle of 10 minutes, where MCU works for 1 minute before entering to standby mode during 9 minute.
Using RTC, I want to have an interrupt every 1 minute(60 s); but I don't want the interrupt to wakeup the MCU. I want to use a different RTC event to do so.
Is it possible to implement? Please any suggestion on how to go with this would be appreciated
Solved! Go to Solution.
2023-05-08 12:27 AM
I have found a solution. I will share it here in case anybody have a similar case:
The main problem was that I only had an LSE crystal, which is used for RTC, but for the rest of timers I had to use inaccurate internal clock source HSI because the lack of an HSE high speed crystal oscillator.
That was the reason I wanted to use RTC to generate the interrupts besides waking up MCU from standby mode(It seems like this is an abomination judging by how few people want to talk about generating interrupts with RTC).
Then I found out that we can use LSE as a clock source for LPTIM. This made my life easier since I got 2 features in one timer: low power and accuracy which is exactly what i was looking for.
So, this is how I solved my problem
Thank you all
2023-04-28 01:55 AM
Hi @migmel
Yes it's possible, To wake up from the Standby mode with an RTC alarm event, it is necessary to:
a) Enable the RTC Alarm interrupt in the RTC_CR register
b) Configure the RTC to generate the RTC alarm.
you can try this example: Projects/NUCLEO-L073RZ/Examples_MIX/PWR/PWR_STANDBY_RTC.
All information concerned on standby mode is resumed on Table 38 of RM0367.
Regards
Diane
2023-04-28 03:01 AM
Hello miss Diane, thank you for your reply.
I have separately done the standby/wakeup cycle with RTC and generated interrupts using another timer(TIM6, which use HSI as clock source). However, in this way, TIM6 lacks of the accuracy and precision I need.
To give you a context, I am using RTC(LSE external crystal) to wakeup the MCU from standby mode, and while the MCU is working, generate the interrupts I need to be perfectly synchronized to RTC.
I thought, what best way if I have RTC also doing the interrupts. Synchronization wouldn't be a problem right?
The main issue I see is, while in standby mode, I don't want RTC interrupts wakeup the MCU, because the interrupt events' frequency are higher than wakeup events' frequency
2023-05-03 05:35 AM
Hi @migmel
RTC interrupt have not capability to wake up MCU from standby only an external Reset (NRST pin), an IWDG Reset, a rising edge on WKUP pins (WUKP1, WKUP2 or WKUP3), an RTC alarm, a tamper
event, or a time-stamp event detected can wake up MCU from StandBy that have capability to wake up MCU.
Regards
DianeP
2023-05-03 05:37 PM
Thank you again,
I have used WKUP to wake up MCU.
So, I can used RTC interrupts freely without worry about wake up the MCU when I don't mean to.
One question remains, how can I set an RTC periodic interrupt, lets say every 30 s, without using any EXT Line? I have tried setting RTC global interrupt but nothing seems to happen. Not sure how to set the frequency to do so, or if it is actually doable in this way.
2023-05-08 12:27 AM
I have found a solution. I will share it here in case anybody have a similar case:
The main problem was that I only had an LSE crystal, which is used for RTC, but for the rest of timers I had to use inaccurate internal clock source HSI because the lack of an HSE high speed crystal oscillator.
That was the reason I wanted to use RTC to generate the interrupts besides waking up MCU from standby mode(It seems like this is an abomination judging by how few people want to talk about generating interrupts with RTC).
Then I found out that we can use LSE as a clock source for LPTIM. This made my life easier since I got 2 features in one timer: low power and accuracy which is exactly what i was looking for.
So, this is how I solved my problem
Thank you all