LCP4357 RTC reset and calibration

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LCP4357 RTC reset and calibration

398 Views
lpcware
NXP Employee
NXP Employee
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?
Labels (1)
0 Kudos
1 Reply

287 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Mon Nov 11 09:33:52 MST 2013
http://www.lpcware.com/content/forum/writing-rtc-time-registers-causes-delay-code-execution
0 Kudos