cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 - Use LSI2 as a RTC clock source for waking up from STOP2 mode

Gae
Associate

Hi everybody,

I have an application, where my device should go every record_interval into the stop2 mode. Then Wakes up then measure some sensor values, then goes into the sleep. Same goes over and over.

The issue is, I am using the LSI2 as a clock source for my RTC. I am then using that RTC clock to wake my MCU up from the STOP2 mode. But the issue is: that RTC time (based on the LSI2) is drifting (roughly 10s less than the real time). I am then using the real sleep time to advance the ticks of my freeRTOS, because the ticks are being paused during the STOP2 mode.
Advancing the ticks manually then causes my freeRTOS task to run with some delays.

Now my questions are:

- Is there any way on my PCB, ith the STM32WB55RG on it to make the LSI2 or even the LSI1 more precise? PS: I am planning to buy an LSE oscillator. In the mean time, I try to compensate my application while using the LSI2

- Are there any other timers, options (apart from the LSE) to have a reliable time source for my RTC timer? Or maybe use other timers during the STOP2 mode?

 

I would be very happy to have any kind of help regarding this. Thank you very much.

 

Best regards

 

Gaëtan

1 ACCEPTED SOLUTION

Accepted Solutions
Gyessine
ST Employee

Hello @Gae 

You can tweak the asynchronous and synchronous prescaler dividers. They are set to 127 and 255 by default in STM32CubeMX. These values are suitable for LSE (32 768 Hz), but not for LSI (32 kHz).

You can try 127 for the asynchronous prescaler and 249 for the synchronous prescaler.
based on the Reference manual, The RTC can use LSI, LSE, or HSE/32 as the clock source. If you do not want to use LSE, HSE/32 is the remaining option. However, I recommend that you implement LSE because it is easy to use, reliable, and keeps the system simple.
BR
Gyessine

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Gyessine
ST Employee

Hello @Gae 

You can tweak the asynchronous and synchronous prescaler dividers. They are set to 127 and 255 by default in STM32CubeMX. These values are suitable for LSE (32 768 Hz), but not for LSI (32 kHz).

You can try 127 for the asynchronous prescaler and 249 for the synchronous prescaler.
based on the Reference manual, The RTC can use LSI, LSE, or HSE/32 as the clock source. If you do not want to use LSE, HSE/32 is the remaining option. However, I recommend that you implement LSE because it is easy to use, reliable, and keeps the system simple.
BR
Gyessine

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Gae
Associate

Thank you very much. Those changes of the prescaler values helped a lot.

Announcement

We’re moving the ST Community to a new platform to give you a better and more reliable community experience.