2016-05-18 05:38 AM
Hi,
I am using the STM32L4 Discovery Kit and I wanted to enable the RTC Re-Calibration / Smooth digital Calibration configuration. The board RTC is using the on board LSE Oscillator having 32.768 kHz clockI found out from the Reference Manual about this and also there is a API HAL_RTCEx_SetSmoothCalib() by which we can enable the RTC Calibration.But I am a bit confused about its usage.I have calling the API with the below parameters: HAL_RTCEx_SetSmoothCalib(&RtcHandle, RTC_SMOOTHCALIB_PERIOD_8SEC, RTC_SMOOTHCALIB_PLUSPULSES_SET, 1);but I am not sure how does the CALM and CALP work. I saw the formula in the Reference Manual, but still I am not clear about what does the Masking of the Clock Pulses mean when configuring the CALM as a non-zero value.Thanks,Sunny #calibration #rtc #stm32l42016-05-18 01:35 PM
Inserting a single cycle over the observation time would be of the form
HAL_RTCEx_SetSmoothCalib(&RtcHandle, RTC_SMOOTHCALIB_PERIOD_8SEC, RTC_SMOOTHCALIB_PLUSPULSES_SET, 512 - 1);Removing oneHAL_RTCEx_SetSmoothCalib(&RtcHandle, RTC_SMOOTHCALIB_PERIOD_8SEC, RTC_SMOOTHCALIB_PLUSPULSES_RESET, 1);2018-03-07 01:35 AM
Hi
I have also trouble setting up the CALM register.
The note on the STM32L4 RM0351about CALM setup is not clear at all.
CALM[8:0] (RTC_CALR) specifies the number of RTCCLK pulses to be masked during the
32-second cycle. Setting the bit CALM[0] to ‘1’ causes exactly one pulse to be maskedduring the 32-second cycle at the moment when cal_cnt[19:0] is 0x80000; CALM[1]=1causes two other cycles to be masked (when cal_cnt is 0x40000 and 0xC0000); CALM[2]=1causes four other cycles to be masked (cal_cnt = 0x20000/0x60000/0xA0000/ 0xE0000);and so on up to CALM[8]=1 which causes 256 clocks to be masked (cal_cnt = 0xXX800).can anyone explain what it means.
The CALM value is subtracted from the 2^20 counter or not ?
2018-03-07 02:51 AM
I wouldn't use the word 'subtracted'; I'd say, CALM pulses in 2^20 pulses are skipped.
It means, that until the 2^20 counter overflows, (2^20 + CALM) crystal oscillations elapse.
JW