Content originally posted in LPCWare by AlexandreR on Wed Jul 23 02:54:14 MST 2014
Hi everybody!
I have a big problem, we produced 500 boards with a LPC1547 embedded, and on half the RTC doesn't work.
The 32khz oscillates, I think it's not a pb from the XTAL.
my code to initiate the RTC:
void RTC_Init( void )
{
LPC_SYSCON->RTCOSCCTRL |= BIT_0;
LPC_SYSCON->SYSAHBCLKCTRL0 |= (BIT_23);
LPC_RTC->CTRL|= RTC_OFD ;
LPC_RTC->CTRL&= ~ RTC_SWRESET;
while(LPC_RTC->CTRL&RTC_SWRESET);
LPC_RTC->CTRL |= RTC_ALARM_1HZ | RTC_EN;
NVIC_EnableIRQ(RTC_ALARM_IRQn );
}
The LPC_RTC->CTRL is always equal to 0x82 ie
"Fail. RTC oscillator fail detected. Clear this flag after the following power-up. Writing a 1 clears this bit."
Have you an idea?
Thanks