This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: RTC Configuration

Part Number: TM4C1294NCPDT


Tool/software:

void
AppRTC(void)
{
uint32_t ui32Status;
struct tm sTime;

//
// Print the buffer to the terminal.
//
UARTprintf("To wake, wait for 5 seconds or press WAKE or"
"RESET\n");
UARTprintf("See README.txt for additional wake sources.\n");

//
// Wait for UART transmit to complete before proceeding to
// hibernate.
//
UARTFlushTx(false);

//
// Get calendar match value to be 5 seconds from the current time.
//
GetCalendarMatchValue(&sTime);

//
// Set the calendar match register such that it wakes up from
// hibernation in 5 seconds.
//
MAP_HibernateCalendarMatchSet(0, &sTime);

//
// Read and clear any status bits that might have been set since
// last clearing them.
//
ui32Status = HibernateIntStatus(0);
MAP_HibernateIntClear(ui32Status);

//
// Configure Hibernate wake sources.
//
MAP_HibernateWakeSet(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_GPIO |
HIBERNATE_WAKE_RESET | HIBERNATE_WAKE_RTC);

//
// Request Hibernation.
//
MAP_HibernateRequest();

//
// Wait for a while for hibernate to activate. It should never get
// past this point.
//
SysCtlDelay(100);

//
// If it ever gets here, store the text, that informs the user on
// what to do, into the respective widget buffers.
//
UARTprintf("The controller did not enter hibernate. Press RESET"
"button to restart example.\n");

//
// Wait here.
//
while(1)
{
}
}







this part of the code is not fetcing the current date and time... what to change from it ?

  • HI,

    this part of the code is not fetcing the current date and time... what to change from it ?

    What do you mean? Do you mean it starts with the default year 2013 as shown below?

    The reason is the code is setting the default time to 2013 when DateTimeDefaultSet() is called. 

    //*****************************************************************************
    //
    // This function sets the time to the default system time.
    //
    //*****************************************************************************
    void
    DateTimeDefaultSet(void)
    {
    g_ui32MonthIdx = 7;
    g_ui32DayIdx = 29;
    g_ui32YearIdx = 13;
    g_ui32HourIdx = 8;
    g_ui32MinIdx = 30;

    }

    You can change it. See the below command options to enter the current date and time.