RTC Problem

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

RTC Problem

931 Views
ywjack
Contributor III

I used the external crystal oscillator (32768HZ) for the real-time clock experiment, but I found that my read time is always 0:0:0 on January 1, 2016. I feel that the real-time clock is not counting.

The following is my configuration, can you help check if there is a problem?1563246451(1).jpg1563246393(1).jpg1563246370(1).jpg1563246426(1).jpg

The following is my program configuration and initialization

RTC_DRV_Init(RTCTIMER1, &rtcTimer1_Config0);
RTC_DRV_ConfigureSecondsInt(RTCTIMER1, &rtcTimer1_SecIntConfig0);
RTC_DRV_SetTimeDate(RTCTIMER1, &rtcTimer1_StartTime0);
RTC_DRV_StartCounter(RTCTIMER1);

if(Key_Test==1)
{
   Key_Test = 0;
   RTC_DRV_GetCurrentTimeDate(RTCTIMER1, &currentTime);
}

Finally, I found out that it was read on January 1, 2016, 0:00, 0:00.

Labels (1)
Tags (1)
0 Kudos
1 Reply

757 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi yang wei

Have you tried the Demo code that is included in the SDK? I saw that you have the same configuration that the example code, does this example work for you?

 /* Initialize RTC instance
     *  - See RTC configuration component for options
     */
    RTC_DRV_Init(RTCTIMER1, &rtcTimer1_Config0);
    /* Configure RTC Time Seconds Interrupt */
    RTC_DRV_ConfigureSecondsInt(RTCTIMER1, &rtcTimer1_SecIntConfig0);

    /* Set APIS to allow usermode access to RTC Memory Space */
    /* Clear bit position to grant usermode access level */
    AIPS->OPACR[regIdx] &= ~AIPS_OPACR_SP5_MASK;
    /* Switch to user mode */
    swUserMode();

    /* Set the time and date */
    RTC_DRV_SetTimeDate(RTCTIMER1, &rtcTimer1_StartTime0);

    /* Start the RTC counter */
    RTC_DRV_StartCounter(RTCTIMER1);

Best regards

Jorge Alcala

0 Kudos