2022-07-07 12:04 AM
Hi everyone,
I am trying to trim the internal RTC of an STM32MP157 to run slightly faster. According to the reference manual, you need to set bits CALP and CALM[8:0] in RTC_CALR to do so.
Here is what I did (using devmem2:(
# Enable write access to RTC_CALR
./devmem2 0x5C004024 h 0xCA
./devmem2 0x5C004024 h 0x53
# Write calibration factor (CALP=1, CALM=327) to RTC_CALR
./devmem2 0x5C004028 h 0x8147
Reading back the contents of register RTC_CALR returns 0x0147 instead of 0x8147, which corresponds to CALP=0.
Measuring the RTC deviation confirms that CALP does not get set to 1.
I am aware that using hwclock with adjtime can easily work around this issue. Yet not knowing what is going wrong here keeps bugging me...
Solved! Go to Solution.
2022-07-07 12:50 AM
Hi,
this behavior is explained because our SW does not use default values and sets PREDIV_A = 0 and PREDIV_S = 32767 (to allow better accuracy on Linux time restore on low power modes exit as subsecond granularity is linked to PREDIV_S).
See relevant RTC section to calibrate in that case:
Regards,
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
2022-07-07 12:50 AM
Hi,
this behavior is explained because our SW does not use default values and sets PREDIV_A = 0 and PREDIV_S = 32767 (to allow better accuracy on Linux time restore on low power modes exit as subsecond granularity is linked to PREDIV_S).
See relevant RTC section to calibrate in that case:
Regards,
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
2022-07-07 12:53 AM
Thanks, now it makes sense!