Content originally posted in LPCWare by alimicro on Mon Nov 11 08:45:30 MST 2013
Hi
I have an evaluation board based on LPC4357 and works well but during RTC_init it takes a long time (I think about 5 to 6 seconds ) to init.
here is my code to init which is exactly the same as CMSIS source code:
<pre>
void RTC_Init (LPC_RTC_Type *RTCx)
{
CHECK_PARAM(PARAM_RTCx(RTCx));
LPC_CREG->CREG0 &= ~((1<<3)|(1<<2));
LPC_CREG->CREG0 |= (1<<1)|(1<<0);
LPC_SCU->SFSCLK_0 = 1 | (0x3<<2);
LPC_CGU->BASE_OUT_CLK = (CGU_CLKSRC_32KHZ_OSC<<24) |(1<<11);
do
{
/* Reset RTC clock*/
RTCx->CCR = RTC_CCR_CTCRST | RTC_CCR_CCALEN;
}
while(RTCx->CCR!=(RTC_CCR_CTCRST | RTC_CCR_CCALEN));
do
{
/* Finish resetting RTC clock*/
RTCx->CCR = RTC_CCR_CCALEN;
}
while(RTCx->CCR != RTC_CCR_CCALEN);
RTCx->ILR = RTC_IRL_RTCCIF | RTC_IRL_RTCALF;
RTCx->CIIR = 0x00;
RTCx->AMR = 0xFF;
RTCx->CALIBRATION = 0x00;
}
</pre>
about 3 seconds for first do-while and 3 seconds for the next one.
Is it usual?