AnsweredAssumed Answered

STM32L4 RTC Accuracy

Question asked by Daniel Tarrago on Mar 27, 2017
Latest reply on Mar 27, 2017 by Daniel Tarrago

Good morning,

I'm developing an application based on STM32L475 device.

I use the RTC (LSE based) as a periodic wakeup source, as application is periodically going to Stop2 mode: I have followed the '...STM32Cube_FW_L4_V1.7.0\Projects\STM32L476RG-Nucleo\Examples\PWR\PWR_STOP2_RTC' example and I have setup the RTC to wakeup every 31.25ms =>

 

....

  if (HAL_RTCEx_SetWakeUpTimer_IT(&H_RTC, 0x0200, RTC_WAKEUPCLOCK_RTCCLK_DIV2) != HAL_OK) //WakeUp Time every 31.25ms. RTC resolution set to 61.035us
{
Error_Handler();
}

...

 

Furthermore, I use the recommended 'NX3215SA 6pF' LSE oscillator.

The application is waking up every 31.25ms and it is working fine. In the code, there is also a variable that is initialized at 1920 and decremented every 31.25ms (every time RTC interruption is given), so it reaches 0 every minute: at this point, the application switches on a LED, and variable is initialized again => What I have observed is that the instant in which this happens is moving: about 5 seconds in 1 hour. So, is it necessary to calibrate the RTC? Is there any other reason that can cause this RTC to have this misallignment?

Best regards.

Outcomes