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.

TM4C129XNCZAD: the counter from HibernateRTCSSGet would be reset to 0 at 0x200.

Part Number: TM4C129XNCZAD
Other Parts Discussed in Thread: EK-TM4C1294XL

hi,

My customer found a board and run the attachment code. The count is always reset to 0 when count to 0x200.

It only happens on one board and issue follows with TM4C129 after ABA swap.

2022/05/03 17:11:12.176 ==>> Get RTC: 000001FF
2022/05/03 17:11:13.225 ==>> Get RTC: 00000001

//*****************************************************************************
//
// hibernate.c - Hibernation Example.
//
// Copyright (c) 2013-2017 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 2.1.4.178 of the DK-TM4C129X Firmware Package.
//
//*****************************************************************************

#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include "inc/hw_gpio.h"
#include "inc/hw_hibernate.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/hibernate.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "grlib/grlib.h"
#include "grlib/widget.h"
#include "grlib/canvas.h"
#include "grlib/pushbutton.h"
#include "drivers/frame.h"
#include "drivers/kentec320x240x16_ssd2119.h"
#include "drivers/pinout.h"
#include "drivers/touch.h"
#include "utils/ustdlib.h"

//*****************************************************************************
//
//! \addtogroup example_list
//! <h1>Hibernate Example (hibernate)</h1>
//!
//! An example to demonstrate the use of the Hibernation module.  The user
//! can put the microcontroller in hibernation by touching the display.  The
//! microcontroller will then wake on its own after 5 seconds, or immediately
//! if the user presses the RESET button.  External WAKE pin and GPIO (PK5)
//! wake sources can also be used to wake immediately from hibernation.  The
//! following wiring enables the use of these pins as wake sources.
//!     WAKE on J27 to SEL on J37
//!     PK5 on J28 to UP on J37
//!
//! The program keeps a count of the number of times it has entered
//! hibernation.  The value of the counter is stored in the battery backed
//! memory of the Hibernation module so that it can be retrieved when the
//! microcontroller wakes.  The program displays the wall time and date by
//! making use of the calendar function of the Hibernate module.  User can
//! modify the date and time if so desired.
//
//*****************************************************************************


//*****************************************************************************
//
// This example demonstrates the different hibernate wake sources.  The
// microcontroller is put into hibernation by the user and wakes up based on
// timeout or one of the user inputs.  This example also demonstrates the RTC
// calendar function that keeps track of date and time.
//
//*****************************************************************************
int
main(void)
{



    uint32_t ui32SysClock;
    static uint32_t CurrentRTC, CurrentRTC_old;
    uint32_t pui32RTC[2];
    //
    // Run from the PLL at 120 MHz.
    //
    ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                           SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
                                           SYSCTL_CFG_VCO_480), 120000000);

    //
    // Configure the device pins.
    //
    PinoutSet();
    //
    // Initialize the UART for console I/O.
    //
    UARTStdioConfig(0, 115200, ui32SysClock);
    UARTprintf("ui32SysClock: %d\n", ui32SysClock);
    //
// Hibernation initialization
//
HibernateEnableExpClk(ui32SysClock);
HibernateClockConfig(HIBERNATE_OSC_HIGHDRIVE);
HibernateRTCEnable();
HibernateCounterMode(HIBERNATE_COUNTER_RTC);

//
// Set RTC to 0 to start the test
//
HibernateRTCSet(0);


    //
    // Loop forever.
    //
    while(1)
    {
    //
// Read RTC via USB virtual COM every second
//
        do
        {
            pui32RTC[0] = HibernateRTCGet();
            pui32RTC[1] = HibernateRTCSSGet();
        }
        while(pui32RTC[0] != HibernateRTCGet());

        CurrentRTC = pui32RTC[0];
        if(CurrentRTC_old!=CurrentRTC){
            UARTprintf("Get RTC: %08x\n", CurrentRTC);
            CurrentRTC_old = CurrentRTC;
            }
    }
}

Can I know how to debug it?

BR,

frank

  • Hi Frank,

      In the latest TivaWare library, there is a hibernate example that uses RTC to count and upon a match value is reached will generate an interrupt. Please ask your customer to run this example and see if you have problem with it. 

    The example can be found at:

    C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\hibernate

  • Charles,

    My customer's board doesn't have LCD screen but they can use UART. So, not sure how to test with hibernate example.

    Also, my customer never gets into hibernate mode. they just enable HibernateRTCEnable then use the counter. Any issue for this?

    Also, I saw the date sometimes restart randomly. so, I print out the date with UART as below. The date randomly reset the "min".

    date Aug 29, 2013 08 : 31 : 44 AM
    date Aug 29, 2013 08 : 31 : 45 AM
    date Aug 29, 2013 08 : 31 : 46 AM
    date Aug 29, 2013 08 : 30 : 47 AM
    date Aug 29, 2013 08 : 30 : 48 AM
    date Aug 29, 2013 08 : 30 : 49 AM

    BR,

    frank

  • Hi Frank,

      I run the customer's code and I don't see a problem. It just keeps incrementing the RTC count beyond 0x200. See below.  If this is a isolated issue with one board then what type of ABA swap test did you do? If you swap in a new MCU to the same board and the problem still exist then it is a board problem. Did you swap the suspected MCU to another good known board? What did you see?

  • Charles,

    Yes, customer did ABA swap. The issue follows with issued IC.

    But they told me that they only found this issue on this IC. There is no other issue, which means that the IC should be normal except this HB_RTC?

    I wonder if I miss something. If no, I will ask them to issue the RMA process.

    BR,

    frank

  • Frank,

      Can you observe HIB_RTCC and confirm that after 0x1FF it is rolled over to 0x1 again?

  • hi Charles,

    Yes, as my first post.

    I read the HIB_RTCC by using HibernateRTCGet().

    On issued IC, it always return to 1 as below.

    2022/05/03 17:11:12.176 ==>> Get RTC: 000001FF
    2022/05/03 17:11:13.225 ==>> Get RTC: 00000001

    BR,

    frank

  • Hi Frank,

      I understand that you read a 1 by calling HibernateRTCGet(). I'm asking if you monitor the register window for HIB_RTCC register, do you see that it rolls over from 0x!FF to 0x1. You need to set the register window to "continuous refresh". 

  • hi Charles,

    from memory, it still roll over from 0x200 to 0x1. any suggestion?

    BR,

    frank

  • Hi Frank,

      I have replied you via email.