2022-06-26 10:53 PM
Background: The MCU chip I use is stm32L476RG. Since the MCU usually needs to work in the standby mode and will wake up within 2s, I want to count the time the MCU is in the standby mode each time.
Implementation method: The clock source of RTC is LSI, PREDIV_A[6:0] in RTC_PRER in the register is 15, PREDIV_S[14:0] is 32767, that is to say, the load value in the register RTC_SSR will subtract 1 every about 488.3us. I used systick to implement a delay function to verify the accuracy of RTC for timing, read the value of RTC_SSR before and after the delay, denoted as cnt1 and cnt2 respectively, timing time T=(cnt1- cnt2)*488.3.
Question: The picture below shows the actual situation where I use systick delay and RTC timing. I would like to know why this happens.
RTC related configuration:
2022-06-26 11:43 PM
Check the datasheet - LSI frequency and accuracy.
2022-06-27 06:12 PM
As can be seen from the above two figures, the LSI clock frequency is in a certain range, so we cannot know the exact clock frequency??
2022-06-27 07:36 PM
Yes.
JW
2022-06-27 07:41 PM
Thank you very much