Hi, I'm using this sequence:
Chip_RTC_Init(LPC_RTC);
//
FullTime.time[RTC_TIMETYPE_SECOND] = 0;
FullTime.time[RTC_TIMETYPE_MINUTE] = 0;
FullTime.time[RTC_TIMETYPE_HOUR] = 0;
FullTime.time[RTC_TIMETYPE_DAYOFMONTH] = 20;
FullTime.time[RTC_TIMETYPE_DAYOFWEEK] = 3;
FullTime.time[RTC_TIMETYPE_DAYOFYEAR] = 20;
FullTime.time[RTC_TIMETYPE_MONTH] = 01;
FullTime.time[RTC_TIMETYPE_YEAR] = 2021;
Chip_RTC_SetFullTime(LPC_RTC, &FullTime);
/* Enable rtc (starts increase the tick counter and second counter register) */
Chip_RTC_Enable(LPC_RTC, ENABLE);
void Chip_RTC_Init(LPC_RTC_T *pRTC)
{
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_RTC);
/* Disable RTC */
Chip_RTC_Enable(pRTC, DISABLE);
/* Disable Calibration */
Chip_RTC_CalibCounterCmd(pRTC, DISABLE);
/* Reset RTC Clock */
Chip_RTC_ResetClockTickCounter(pRTC);
/* Clear counter increment and alarm interrupt */
pRTC->ILR = RTC_IRL_RTCCIF | RTC_IRL_RTCALF;
while (pRTC->ILR != 0) {}
/* Clear all register to be default */
pRTC->CIIR = 0x00;
pRTC->AMR = 0xFF;
pRTC->CALIBRATION = 0x00;
}
I have ten boards working properly, this same card worked fine before it was reprogrammed. Even if I uploaded old FW (using built in UART bootloader) there is no way to make RTC to count again.