2018-08-08 02:39 AM
Hi,
I'am traying to calibrate STM32F407VGT6.
My code:
void RTC_Calibration(int32_t CalValue)
{
if(CalValue <= 0){ //Board going forward
CalValue=__fabs(CalValue);
HAL_RTCEx_SetSmoothCalib(&HRTC,RTC_SMOOTHCALIB_PERIOD_32SEC, RTC_SMOOTHCALIB_PLUSPULSES_RESET,(uint32_t)CalValue);
}else{ //Board going back
CalValue = 512 - CalValue; //CALR range 0-511
HAL_RTCEx_SetSmoothCalib(&HRTC,RTC_SMOOTHCALIB_PERIOD_32SEC, RTC_SMOOTHCALIB_PLUSPULSES_SET,(uint32_t)CalValue);
}
}
I measure and calculate the error in a certain period. I have two board. First board going forward, second board going back. I calculated value for first board CalValue = -63, second board CalValue = 21. First board running good. But second board not working correctly.
When I set CalValue=0 my second board clock going back 1 second in 8 hours. When I set CalValue=21 my board clock going forward 1.7 second in 8 hours. Also when I set CalValue=1 my board clock going forward. And when I set CalValue=-1 my clock going back.
Thanks