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
Definitely a reason to contact NXP support engineers.