Hello, I'm having problems with RTC in LPC1768. The RTC is running, but is advancing approx 5 seconds per hour. The electrical circuit is good, with a 20ppm crystal tolerance, and 12,5pf capacitors of load. Tha VBAT is conected in CR1220 lithium battery. I have reviewed the source code and is OK. Below is my code:
void InitRTC(void) { LPC_RTC->CCR = ( !CLKEN | CTCRST ); LPC_RTC->CCR &= ~CTCRST; return; } /***************************/ void StartRTC(void){ LPC_RTC->CCR |= ( CLKEN ); return; } /***************************/ int main (void){ char temp[36]; InitRTC(); StartRTC(); while(1){ sprintf ((char *)temp,"%2.2d/%2.2d/%.2d %2.2d:%2.2d",LPC_RTC->DOM,LPC_RTC->MONTH,LPC_RTC->YEAR,LPC_RTC->HOUR,LPC_RTC->MIN); lcd_gotoxy(1,0); lcd_print(temp); } return 0; }
The RTC is running correctly without the battery, with main power connected in VBAT. But yet the RTC is running advancing. I can't use the calibration of application note AN10849. I have 100 identical hardwares, and they are with different accurate. I think that this variation is very high for be simply a low accuracy of LPC. There must be some other problem.
Does anyone know what might be happening? Thanks
I think that 8% is a very high variation. Not found in data sheet the clock accuracy of RTC.
The use of calibration it is not practical because I have 100 identical hardwares, and they dont are advancing equal. Some are advancing less, about 5%, and other about 3%. So, is not feasible calculate the calibration for each hardware.
Does the PCB layout can be a cause for this variation?