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.

TM4C129ENCPDT: The RTC value is corrupt in the Field

Genius 3095 points
Part Number: TM4C129ENCPDT
Other Parts Discussed in Thread: CC3100

Thanks for your technical support for some of the issues in our product with the MCU TM4C129ENCPDTI3 and CC3100 module.

In our product, we are using the in-built RTC (Real Time Clock) feature of the microcontroller. We found that the RTC value is corrupt in the Field (where our system is installed in textile Machineries) once in a while.
Please find the Circuit and Software details below.
We have used TI library in our implementation.
Kindly review and support us to solve the issue at the earliest as we have started our production and this issue would stop our production and reputation with our customer.

Circuit details :

Software :

During Init() function

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
HibernateEnableExpClk(g_SysClock);
HibernateClockConfig(HIBERNATE_OSC_LOWDRIVE);
HibernateRTCEnable();
HibernateCounterMode(HIBERNATE_COUNTER_24HR); // Configure the hibernate module counter to 24-hour calendar mode.

In the main program in infinite loop, we have called the below code

struct tm temp_time;
DateTimeGet(&temp_time);
real_time.tm_mday = temp_time.tm_mday;
real_time.tm_mon = temp_time.tm_mon+1;
real_time.tm_year = temp_time.tm_year;
real_time.tm_hour = temp_time.tm_hour;
real_time.tm_min = temp_time.tm_min;
real_time.tm_sec = temp_time.tm_sec;

where the coding for DateTimeGet() is as below

//*****************************************************************************
//
// This function reads the current date and time from the calendar logic of the
// hibernate module. Return status indicates the validity of the data read.
// If the received data is valid, the 24-hour time format is converted to
// 12-hour format.
//
//*****************************************************************************
bool
DateTimeGet(struct tm *sTime)
{
HibernateCalendarGet(sTime); // Get the latest time.
sTime->tm_year += 1900;
if(((sTime->tm_sec < 0) || (sTime->tm_sec > 59)) ||
((sTime->tm_min < 0) || (sTime->tm_min > 59)) ||
((sTime->tm_hour < 0) || (sTime->tm_hour > 23)) ||
((sTime->tm_mday < 1) || (sTime->tm_mday > 31)) ||
((sTime->tm_mon < 0) || (sTime->tm_mon > 11)) ||
((sTime->tm_year < 1900) || (sTime->tm_year > 2099)))
{
return false;
}
return true;
}

Please let us know if you would like to know more details from us. If you are not the right person for contact please guide us by forwarding this request.

Thanks for your support

  • Hi,

     I have a few questions.

    • What do you mean by the RTC value is corrupt? Is the value totally wrong or is it off by a little?
    • How many parts in the field do you see the RTC value corrupted? What is the percentage?
    • You mentioned that you call DateTimeGet(&temp_time) in an infinite loop in the main program. The DateTimeGet() when called will return a boolean value. However, you didn't check if the returned value is true or false when you call it. Can you update the real_time only when the DateTimeGet returns true?

  • Thank you very much for your reply and support to resolve our problem.

     

    Please find our reply in light Blue color

    1, What do you mean by the RTC value is corrupt? Is the value totally wrong or is it off by a little?

    The value is totally wrong. Day, Month & Year values are completely erased. Please find below the picture where the Day is changed to 7, month is changed to 0 and Year is changed to 2000.

     

    After the above corruption, On 12th Oct 2018, we had reset the RTC value to 12-10-2018. After few days of operation, the RTC value is reset (Day value to 0, Month Value to 0 and Year to 2000). 

    2, How many parts in the field do you see the RTC value corrupted? What is the percentage?

    Around 500 parts are in Field. The above issue is occurring in almost all parts randomly.


    3, You mentioned that you call DateTimeGet(&temp_time) in an infinite loop in the main program. The DateTimeGet() when called will return a boolean value. However, you didn't check if the returned value is true or false when you call it. Can you update the real_time only when the DateTimeGet returns true?

    Yes. We are not checking the return value of DateTimeGet() function call. If the invalid value is returned by DateTimeGet(), our real_time structure variable might get some corrupt value (invalid value) during that time only (only in that read function call). In subsequent read, the correct value should have come. In our case, once the corrupt value is updated to the struct real_time, the corrupt value is always present in that structure afterwards. Means the RTC value inside MCU itself is having invalid value.

    Could you please clarify this point. 

    We are not calling the void DateTimeSet(void) function in our normal operation of the product. Hence there is no possibility of this invalid value is getting written back to MCU RTC registers.

    However we shall update the code to check the return value and update the struct real_time only when DateTimeGet returns true. Thank you for pointing out this. However this may not address our problem completely.

    Expecting your feedback.

    Thanks once again for your time and support to us.

  • Hi,

     I don't know what exactly is the problem. Th DateTimeGet() calls HibernateCalendarGet(). You should check the return value of HibernateCalendarGet() and handle the situation as described in red.  Please see below API description.

    15.2.2.3 HibernateCalendarGet
    Returns the Hibernation module’s date and time in calendar mode.
    Prototype:
    int
    HibernateCalendarGet(struct tm *psTime)
    Parameters:
    psTime is the structure that is filled with the current date and time.
    Description:
    This function returns the current date and time in the structure provided by the psTime parameter.
    Regardless of the calendar mode, the psTime parameter uses a 24-hour representation
    of the time. This function can only be called when the Hibernation module is configured in
    calendar mode using the HibernateCounterMode() function with one of the calendar modes.
    The only case where this function fails and returns a non-zero value is when the function
    detects that the counter is passing from the last second of the day to the first second of the
    next day. This exception must be handled in the application by waiting at least one second
    before calling again to get the updated calendar information.
    Note:
    The hibernate calendar mode is not available on all Tiva devices. Please consult the data sheet
    to determine if the device you are using supports this feature in the Hibernation module.
    Returns:
    Returns zero if the time and date were read successfully and returns a non-zero value if the
    psTime structure was not updated.