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.

TM4C1290NCZAD: Unable to re-program the board after loading the firmware with configuration of MAIN OSCILLATOR disabled

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

Dear Sir/Madam,

Please provide the solution for the below issue:

We are using TM4C1290NCZAD for our project.

We have added external crystal 32.768 kHz for using hibernation module in the board.

We have configured the board with the below clock configuration:

SysCtlClockFreqSet( ( SYSCTL_OSC_EXT32 | SYSCTL_USE_OSC | SYSCTL_MAIN_OSC_DIS | SYSCTL_CFG_VCO_480), 40000000);

After that, we are unable to re-program the device. We have tried all possibilities by using reset pin, power off/on. But the board is not detected by the JTAG.

  • We have configured the board with the below clock configuration:

    SysCtlClockFreqSet( ( SYSCTL_OSC_EXT32 | SYSCTL_USE_OSC | SYSCTL_MAIN_OSC_DIS | SYSCTL_CFG_VCO_480), 40000000);

    What system clock frequency do you want to run the device at?

    While the ui32SysClock parameter in the SysCtlClockFreqSet() call is 40000000 (40 MHz), when using the hibernation 32.768 kHz the ui32SysClock parameter is ignored and the system clock frequency will be 32.768 kHz. The following table in the datasheet shows that the RTCOSC doesn't have the capability to drive the PLL:

    There is also the following note in Table 26-12. JTAG Characteristics of the datasheet:

    Which means for JTAG to be used the system clock frequency must be at least 8 times the JTAG TCK frequency.

    So, with the system clock frequency at 32.768 KHz the maximum JTAG TCK frequency which can be used is 4.096 KHz.

    But the board is not detected by the JTAG.

    Which JTAG probe are you using?

    Some allow the JTAG TCK frequency to be slowed down. If can select say 4KHz as the JTAG frequency you should be able to detect the board with JTAG again.

    Another option is to run the unlock sequence, which is a method to reset the TM4C12x microcontrollers to the factory state and erase the program in flash. See the Executing Unlock Sequence section in the TM4C JTAG Guide: http://www.ti.com/lit/spma075

  • Dear Chestor Gillon,

    Thanks for the inputs.

    I have tried the JTAG TCK frequency setting and unlock sequence but it is not working always in a consistent manner. It works after many failure attempts. Also, I would like to know the reason for why the board is getting locked.

    I am having struggling time with the usage of "SysCtlClockFreqSet" with one of the config as "SYSCTL_USE_OSC" making the board to gets locked as per my debugging.

    My intention is to configure the system clock at 16MHz and later on wanted to enter into hibernation mode using RTCOSC and upon wakeup would like to run my code at the system clock 16MHz. If you could share me code snippet for this clock configuration, it will resolve my issue.

    Looking forward to get your response at the earliest.

    Thanks and Regards

    Ram

  • Hi,

    My intention is to configure the system clock at 16MHz and later on wanted to enter into hibernation mode using RTCOSC and upon wakeup would like to run my code at the system clock 16MHz.

      There is an internal 16MHz PIOSC ( precision internal oscillator). To use the internal osc you can call:

    ui32SysClock = SysCtlClockFreqSet(SYSCTL_OSC_INT | SYSCTL_USE_OSC , 16000000);

    Suppose you have a external 16Mhz crystal that you want to use as SYSCLK then call:

    ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_16MHZ|
    SYSCTL_OSC_MAIN |
    SYSCTL_USE_OSC), 16000000);

    Please also refer to the hibernate examples at:

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

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

  • We were trying some hardware changes for other functionalities due to that I was unable to test it.

    I have another question regarding hibernation. May be next time, I will update with you quickly on my testing.

    Question is: My application enters hibernation mode upon power failure and wake up upon EXTERNAL Wake pin.

    It is waking up without any issues for the first time. From second time onwards, I am getting glitches for every 6 Seconds for WAKE and HIB pin.

    Due to that, my application never re-enters hibernation mode.

    If I do power reset, my application enter hibernation for the first time and second time onwards, the glitches are coming.

  • Hi,

    From second time onwards, I am getting glitches for every 6 Seconds for WAKE and HIB pin.

    - Not sure why there is a glitch. Can you show a scope cap of the WAKE and HIB pins? Please also show VBAT and VDD when glitch happens. 

    - Please compare your hibernate schematic with the example hibernate circuit shown in the datasheet. Do you have the proper Rbat and Cbat?

  • I have made the analysis and specified the snippet of HW schematics and tested with the application code in the document file "Hibernation Details" in the below link.

    The scope observations shows the glitches that is given in the file "Hibernation Details" in the below link. 

    Please suggest possible solutions from your end.

    https://docs.google.com/document/d/1gLuKtkwZ1Se7zAN7wxbN3xzzy566x0nI/edit?usp=sharing&ouid=113479432014330985313&rtpof=true&sd=true

  • Hi,

      My company blocks us from external file sharing sites. You can just drag your file to the forum window. 

      Please also do the below experiments.

     - Run your own application code on the LaunchPad. Do you see glitch on WAKE/HIB pins on LaunchPad? 

      - Run the TivaWare Hibernate example on your custom board. Do you see the glitches?

      The two experiments will help us narrow down if the problem is with your board or your code. 

  • Hi,

      - From the limited schematic you show, I don't spot a problem. 

      -Your schematic did not show the oscillator frequency. You firmware specifies 16Mhz . I just wanted to make sure you crystal is 16Mhz, not something else like 25Mhz. 

      - You wrote HibernateEnableExpClk(32768) and I think this has no bearing the result of the operation. See  below. Please also refer to the TivaWare Hibernate.c example. 

      - You have not answered my prior questions. Let me repeat here again.

      - Run your own application code on the LaunchPad. Do you see glitch on WAKE/HIB pins on LaunchPad? 

      - Run the TivaWare Hibernate example on your custom board. Do you see the glitches?

  • I am yet to try the experiments. To answer your questions I am using 32.768 kHZ External Crystal Oscilator.

    Please find the complete schematic and the source code attached here for your reference.

  • apiHibernate.c
    /*
     * apiHibernate.c
     *
     *  Created on: 28-OCT-2021
     *      Author: Ram, Basamma
     */
    
    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_hibernate.h"
    #include "inc/hw_gpio.h"
    #include "driverlib/hibernate.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/rom_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/gpio.h"
    #include "inc/hw_memmap.h"
    #include "drvKeyflow.h"
    #include "inc/hw_types.h"
    
    #define PIN_LOAD_CONTROL GPIO_PIN_2
    #define MWG_IDLE_DELAY 30 //144000 // 30
    
    typedef enum
    {
        POWER_MODE_NORMAL_INIT,
        POWER_MODE_NORMAL,
        POWER_MODE_BATTERY_INIT,
        POWER_MODE_BATTERY
    }ePowerModes;
    
    ePowerModes _ePowerModes;
    
    volatile bool g_bHibernate;
    uint32_t ui32Status, ui32HibernateCount;
    uint32_t ui32RTCWakeCount, ui32EXTWakeCount, ui32GPIOWakeCount, ui32RESETWakeCount;
    
    void vfnInitHibernate()
    {
        // If we comment this. after power reset we will get mwg error (shocking???)
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
        GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, PIN_LOAD_CONTROL);
        GPIOPinWrite(GPIO_PORTL_BASE,PIN_LOAD_CONTROL,0);
    
        // START: Configure PQ2 & Pk4 as input for Wake sources with respect to new hibernation board
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
        GPIOPinTypeGPIOInput(GPIO_PORTQ_BASE, GPIO_PIN_2); // PQ2 for HANDWHEEL key
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
        GPIOPinTypeGPIOInput(GPIO_PORTK_BASE, GPIO_PIN_4); // PK4 for CLOSE key
    
        // END: Configure PQ2 & Pk4 as input for Wake sources with respect to new hibernation board
    
        //
        // Need to enable the hibernation peripheral after wake/reset, before using
        // it.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
        //
        // Wait for the Hibernate module to be ready.
        //
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_HIBERNATE))
        {
        }
    
    }
    
    void HibEnterWakeExit()
    {
    //    vfnInitHibernate();
    
    
        //
        // Initialize these variables before they are used.
        //
        ui32Status = 0;
        ui32HibernateCount = 0;
        ui32RTCWakeCount = 0;
        ui32EXTWakeCount = 0;
        ui32GPIOWakeCount = 0;
        ui32RESETWakeCount = 0;
    
        //
        // Check to see if Hibernation module is already active, which could mean
        // that the processor is waking from a hibernation.
        //
        if(HibernateIsActive())
        {
            //
            // Read the status bits to see what caused the wake.  Clear the wake
            // source so that the device can be put into hibernation again.
            //
            ui32Status = HibernateIntStatus(0);
            HibernateIntClear(ui32Status);
    
            //
            // Wake was due to RTC match.
            //
            if(ui32Status & HIBERNATE_INT_RTC_MATCH_0)
            {
                ui32RTCWakeCount++;
            }
    
            //
            // Wake was due to Reset button.
            //
            else if(ui32Status & HIBERNATE_INT_RESET_WAKE)
            {
                ui32RESETWakeCount++;
            }
    
            //
            // Wake was due to the External Wake pin.
            //
            else if(ui32Status & HIBERNATE_INT_PIN_WAKE)
            {
                ui32EXTWakeCount++;
            }
    
            //
            // Wake was due to GPIO wake.
            //
            else if(ui32Status & HIBERNATE_INT_GPIO_WAKE)
            {
                ui32GPIOWakeCount++;
            }
    
            //
            // If the wake is due to any of the configured wake sources, then read
            // the first location from the battery backed memory, as the
            // hibernation count.
            //
            if(ui32Status & (HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_RTC_MATCH_0 |
                             HIBERNATE_INT_GPIO_WAKE | HIBERNATE_INT_RESET_WAKE))
            {
                HibernateDataGet(&ui32HibernateCount, 1);
            }
        }
    
        //
        // Configure Hibernate module clock.
        //
        HibernateEnableExpClk(32768);
    
        //
        // If the wake was not due to the above sources, then it was a system
        // reset.
        //
        if(!(ui32Status & (HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_RTC_MATCH_0 |
                           HIBERNATE_INT_GPIO_WAKE | HIBERNATE_INT_RESET_WAKE)))
        {
            //
            // Configure the module clock source.
            //
            HibernateClockConfig(HIBERNATE_OSC_LOWDRIVE);
    
        }
    
        //
        // Enable RTC mode.
        //
        HibernateRTCEnable();
    
        //
        // Set the RTC to 0 or an initial value. The RTC can be set once when the
        // system is initialized after the cold startup and then left to run. Or
        // it can be initialized before every hibernate.
        //
        HibernateRTCSet(0);
    
        //
        // Set the match 0 register for 30 seconds from now.
        //
        HibernateRTCMatchSet(0, HibernateRTCGet() + MWG_IDLE_DELAY);
    
        //
        // Configure GPIOs used as Hibernate wake source - PK4
        //
        GPIOPadConfigSet(GPIO_PORTK_BASE, 0x10, GPIO_STRENGTH_2MA,
                         (GPIO_PIN_TYPE_WAKE_LOW | GPIO_PIN_TYPE_STD_WPU));
    
        //
        // Enable processor interrupts.
        //
        IntMasterEnable();
    
        //
        // If hibernation count is very large, it may be that there was already
        // a value in the hibernate memory, so reset the count.
        //
        ui32HibernateCount = (ui32HibernateCount > 10000) ? 0 : ui32HibernateCount;
    
    
    
        //
        // Check if user wants to enter hibernation.
        //
        if(g_bHibernate == true)
        {
            //
            // Increment the hibernation count, and store it in the battery backed
            // memory.
            //
            ui32HibernateCount++;
            HibernateDataSet(&ui32HibernateCount, 1);
    
            //
            // Yes - Clear the flag.
            //
            g_bHibernate = false;
    
            //
            // Read and clear any status bits that might have been set since
            // last clearing them.
            //
            ui32Status = HibernateIntStatus(0);
            HibernateIntClear(ui32Status);
    
    //        HibernateGPIORetentionDisable();
            HibernateIntClear(HIBERNATE_INT_PIN_WAKE);
    
            //
            // Configure Hibernate wake sources.
            //
            HibernateWakeSet(HIBERNATE_WAKE_RTC | HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_GPIO |
                             HIBERNATE_WAKE_RESET);
    
            GPIOPinWrite(GPIO_PORTL_BASE,PIN_LOAD_CONTROL,PIN_LOAD_CONTROL);
    //        HibernateGPIORetentionEnable();
    
            //
            // Request Hibernation.
            //
            HibernateRequest();
    
            //
            // Wait for a while for hibernate to activate.  It should never get
            // past this point.
            //
            SysCtlDelay(100);
    
            //
            // Wait here.
            //
            while(1)
            {
            }
        }
    }
    
    
    void vfnProcessPowerModes()
    {
        static uint8_t counter = 0;
        static uint16_t prevVP = 0;
        static uint16_t currVP;
        static  bool pfiStatus;
        pfiStatus = vfnGetPFIStatus();
    
        switch(_ePowerModes)
        {
    
        case POWER_MODE_NORMAL_INIT:
            if(pfiStatus == false) // PK4 is used to monitor PFI condition. pfiStatus = false -> power OFF, pfiStatus = true -> power ON
            {
                _ePowerModes = POWER_MODE_BATTERY_INIT;
            }
            else
            {
                GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); // GLCD backlight white LED
                _ePowerModes = POWER_MODE_NORMAL;
            }
    
        break;
    
        case POWER_MODE_NORMAL:
            if(pfiStatus == false) // PK4 is used to monitor PFI condition. pfiStatus = false -> power OFF, pfiStatus = true -> power ON
            {
                _ePowerModes = POWER_MODE_BATTERY_INIT;
            }
            else
            {
                GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); // GLCD backlight white LED
                _ePowerModes = POWER_MODE_NORMAL;
            }
    
        break;
    
    
        case POWER_MODE_BATTERY_INIT:
            if(pfiStatus == false) // PK4 is used to monitor PFI condition. pfiStatus = false -> power OFF, pfiStatus = true -> power ON
            {
                _ePowerModes = POWER_MODE_BATTERY;
                vfn_default_lcd_screen_states();        // Show Valve Position Only
                vfn_getScreenDatafromFlash(0,S00101,1,AddressTable.aPosStatusScreens,SC001_1 - 1);
            }
            else
            {
                GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); // GLCD backlight white LED
                _ePowerModes = POWER_MODE_NORMAL;
            }
    
        break;
    
        case POWER_MODE_BATTERY:
            if(pfiStatus == false) // PK4 is used to monitor PFI condition. pfiStatus = false -> power OFF, pfiStatus = true -> power ON
            {
    
                                // Invoke the HibEnterWakeExit() function after delay of MWG_IDLE_DELAY
                if(counter++ > MWG_IDLE_DELAY)
                {
                    counter = 0;
                         //
                // Set the necessary flag before entering Hibernate function.
                //
                g_bHibernate = true;
    
                HibEnterWakeExit();
    
                }
                else
                {
                    // Read current mwg counts
                    currVP = vfngetVP();
    
                    // Check for more than 0.5% position change
                    if ( abs(currVP-prevVP) > 5 )
                    {
                        // Re-initialize counter
                        counter = 0;
                    }
    
                    // Store the current VP
                    prevVP = currVP;
    
                    g_bHibernate = false;
                }
    
                GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, 0); // GLCD backlight white LED
                _ePowerModes = POWER_MODE_BATTERY;
                // In case battery voltage goes below the threshold level, switch off the entire system/provide indication
            }
            else
            {
                GPIOPinWrite(GPIO_PORTL_BASE,PIN_LOAD_CONTROL,PIN_LOAD_CONTROL);
                GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); // GLCD backlight white LED
                SysCtlReset();
                   while(1)
                   {
                       // To hit watchdog timer
                   }
                // or call reset externally
                _ePowerModes = POWER_MODE_NORMAL;
            }
    
        break;
    
        }// switch(_ePowerModes)
    
    }// end of void vfnProcessPowerModes()
    
    uint8_t vfnGetPowerMode()
    {
        return _ePowerModes;
    }
    

  • SCH_AI_SECONDARY-04OCT.pdf

    Additionally, the below changes (page wise mentioned) are also done in our current board for testing purpose. (Attached schematic does NOT have the below correction)

    PAGE 4    Q14  REMOVED & PIN 2 AND PIN 3 SHORT

    PAGE 4   - Q6 REMOVED

    PAGE 4   - R14 IS USED FOR HIB & R207 NOT USED UNCONNECTED.

    PAGE 5   -  PQ2 & PK4 REMOVED

    PAGE 5    J19 REMOVED

    PAGE 6    R316 IS VBAT NOT VCC_A_UC &  R322 REMOVED

    PAGE 6    WAKE UP HANDWHEEL 10K PULL UP ADDED .

  • Hi,

      I looked at your schematic and it is quite complicated and I cannot just look at your schematic and decipher what is right or wrong.  For me to help you, you must help me first by answering the questions I asked earlier. Let me repeat again.

      - In your earlier code you wrote the below line to configure clock. 

        ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |SYSCTL_CFG_VCO_480),40000000);

        However, looking at your schematic, where is the external main crystal? I don't see OSC0 and OSC1. I'm really confused with your system. If you don't use external crystal then I suppose you use the internal 16Mhz PIOSC, correct? If that is the case then your configuration is wrong. You should be writing like below:

           ui32SysClock = SysCtlClockFreqSet( SYSCTL_OSC_INT | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 40000000);

      - You said you have an external 32.768kHz crystal. Where is that? I only see you connect a WDI-PG6 to XOSC0 input. Looks like WDI-PG6 is a Watchdog. Why are you connecting like this?

      - You said you have glitches on WAKE and HIB pins after six seconds? Again, show me the scope capture VDD, VBAT, WAKE, HIB during hibernate entry and exit and when the glitches happened. I must have at least these signals to make sense what happened. 

      - Run your own application code on the LaunchPad. Do you see glitch on WAKE/HIB pins on LaunchPad? 

      - Run the TivaWare Hibernate example on your custom board. Do you see the glitches?

  • Please find the updated schematic with the crystal details also in it. Unfortunately, the launchpad got burnt after we apply high voltage. Hence we could not try the experiments you have suggested. secandary card schematic.pdfSCH_AI_CPU_PB_V5_2.pdf

  • Please find the updated schematic with the crystal details also in it. Unfortunately, the launchpad got burnt after we apply high voltage. Hence we could not try the experiments you have suggested. secandary card schematic.pdfSCH_AI_CPU_PB_V5_2.pdf

    Also, let us know the behaviour of RESET pin during hibernation entry and exit.

  • Hi,

    Also, let us know the behaviour of RESET pin during hibernation entry and exit.

    Nothing really to the RESET pin during entry and exit. But the device will go through a POR when coming out of the hibernation by a wake up. See below from the datasheet. 

    The return of VDD causes a POR to
    be executed. The time from when the WAKE signal is asserted to when code begins execution is
    equal to the wake-up time (tWAKE_TO_HIB) plus the power-on reset time (TPOR).

    - I don't particularly spot anything wrong with the RST, OSC0 and XOSC0/XOSC1 connections. 

      - What is the relationship between relationship between SCH_AI_CPU_PB_V and secondary_card?

      - You never answered my questions. Understand that your don't have a working LaunchPad for cross-checking. But at least please answer the below two questions. 

      - You said you have glitches on WAKE and HIB pins after six seconds? Again, show me the scope capture RESET, VDD, VBAT, WAKE, HIB during hibernate entry and exit and when the glitches happened. I must have at least these signals to make sense what happened. 

      - Run the TivaWare Hibernate example on your custom board. Do you see the glitches?

    Again, if you don't answer any of my questions, I cannot help you.

  • 5241.Waveforms.docx

    Please find the observations scope waveforms captured in the above document. Unfortunately I could not measure VDD. Other 4 signals, I have captured.

    Also, I have ran the sample code and my code in my custom board. Sample code is not causing the device to enter any hibernation mode, I guess I need to modify little bit to sample code to enter my custom board into hibernation. I have captured both power ON and OFF condition. 

    For my code the custom board is supposed to enter hibernation once power is OFF. However, it is not entering due to the glitches shown.

  • Hi,

     A couple of comments.

     - I see you run TivaWare example C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c129x\hibernate\ccs\Debug\hibernate.out. This is an example for the DK board with LCD on it. TivaWare 2.1.4.178 is an older version. Did you modify this example to remove all the code that is related to LCD? I don't expect this example to work on your board if your custom board doesn't have the same LCD as on DK board.  Why don't you run the latest TivaWare examples in C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\hibernate and C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\hibernate_calendar?

     - On page 3 where you show Customized code is loaded in the custom board – POWER ON condition. The RESET will dip when HIB is asserted. Who is controlling your RESET input? See below. You will have more knowledge on how RESET is driven. Is RESET coming from U88? Is it true that whenever HIB is asserted it will also trigger WD reset? Again, it is your circuit, you should know better on how it works. 

      - For Customized code is loaded in the custom board – POWER OFF condition, You have several scope captures. It all looks like there is RESET. You really need to investigate why RESET (perhaps coming from your WD) is asserted when power is turned off. You need to stop WD from asserting when the device is hibernation. Please bear in mind the RESET is considered a wakeup source. When RESET is asserted, it wakes up the device. You either need to prevent RESET from asserting or try to disable the RESET as a wake up source in your firmware. You wrote below to wake up device using RESET. 

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

      - 

  • I ran the latest TivaWare examples in C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\hibernate and C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\hibernate_calendar in my custom board and found that upon power ON and OFF condition, there are no glitches observed in the HIB and WAKE pins. However, the board is not entering into hibernation mode.

    Also in my custom code, i have disabled RESET as wake source as per your suggestion. And, WD also disabled in my latest code. But still, I am observing the glitches across HIB, WAKE and RESET pins. 

  • On Power ON condition, there are no assertion of RESET pin. 

    On power OFF condition, The RESET will dip when HIB is asserted for every 20 seconds (20 seconds is programmed in firmware to invoke hibernation request on power off condition).

    Who is controlling your RESET input? ------> No control circuitry for RESET.

    Is RESET coming from U88? ---->  No, U88 does not have any control and it is removed.

    Is it true that whenever HIB is asserted it will also trigger WD reset? ---->  No, WD is also removed from the circuitry and as well from the firmware.

  • On power OFF condition, The RESET will dip when HIB is asserted for every 20 seconds (20 seconds is programmed in firmware to invoke hibernation request on power off condition).

    Who is controlling your RESET input? ------> No control circuitry for RESET.

    Is RESET coming from U88? ---->  No, U88 does not have any control and it is removed.

    Is it true that whenever HIB is asserted it will also trigger WD reset? ---->  No, WD is also removed from the circuitry and as well from the firmware.

    Thank you for answering my questions. I really don't know what else to suggest. RESET pin is an input pin to MCU. MCU doesn't assert this pin. Someone must be asserting RESET. If you said it is not coming from your circuit on the board, I really don't know who is driving it then and can't help you debug your circuit as I'm not knowledgeable enough for it. 

     If RESET is not the wake up source, then I suppose you use either WAKEn pin or some GPIO pins as wake sources, right? Can you check these pins? Do you have GPIO pins like PQ2 & Pk4 which  are forcing the device to wake up? 

     Please get a working LaunchPad so you can run your custom code on it and see what happens. This way you can compare the behaviors between the two. 

     I will also suggest you modify your program to start simple. Don't configure the device to wake by WAKE or RESET or GPIO but only RTC. What is the behavior?

  • I have tried by enabling the RTC only and the device entered the hibernation mode but although i have configured the firmware to wake after 30 seconds by confuguring  RTC WAKE as wake source, the device is not at all waked up. Also during this time, the RESET pin also asserted and did not come back. Both HIB and RESET follow the same state throughout the observation.

  • 25_OCT.txt
    /*
     * apiHibernate.c
     *
     *  Created on: 28-Sep-2021
     *      Author: Ram, Basamma
     */
    
    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_hibernate.h"
    #include "inc/hw_gpio.h"
    #include "driverlib/hibernate.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/rom.h"
    #include "driverlib/rom_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/gpio.h"
    #include "inc/hw_memmap.h"
    #include "drvKeyflow.h"
    #include "inc/hw_types.h"
    
    #define PIN_LOAD_CONTROL GPIO_PIN_2
    #define MWG_IDLE_DELAY 30 //144000 // 30
    
    typedef enum
    {
        POWER_MODE_NORMAL_INIT,
        POWER_MODE_NORMAL,
        POWER_MODE_BATTERY_INIT,
        POWER_MODE_BATTERY
    }ePowerModes;
    
    ePowerModes _ePowerModes;
    
    volatile bool g_bHibernate;
    uint32_t ui32Status, ui32HibernateCount;
    uint32_t ui32RTCWakeCount, ui32EXTWakeCount, ui32GPIOWakeCount, ui32RESETWakeCount;
    
    void vfnInitHibernate()
    {
        // If we comment this. after power reset we will get mwg error (shocking???)
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
        GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, PIN_LOAD_CONTROL);
        GPIOPinWrite(GPIO_PORTL_BASE,PIN_LOAD_CONTROL,0);
    
        // START: Configure PQ2 & Pk4 as input for Wake sources with respect to new hibernation board
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
        GPIOPinTypeGPIOInput(GPIO_PORTQ_BASE, GPIO_PIN_2); // PQ2 for HANDWHEEL key
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
        GPIOPinTypeGPIOInput(GPIO_PORTK_BASE, GPIO_PIN_4); // PK4 for CLOSE key
    
        // END: Configure PQ2 & Pk4 as input for Wake sources with respect to new hibernation board
    
        //
        // Need to enable the hibernation peripheral after wake/reset, before using
        // it.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
        //
        // Wait for the Hibernate module to be ready.
        //
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_HIBERNATE))
        {
        }
    
    }
    
    void HibEnterWakeExit()
    {
    //    vfnInitHibernate();
    
    
        //
        // Initialize these variables before they are used.
        //
        ui32Status = 0;
        ui32HibernateCount = 0;
        ui32RTCWakeCount = 0;
        ui32EXTWakeCount = 0;
        ui32GPIOWakeCount = 0;
        ui32RESETWakeCount = 0;
    
        //
        // Check to see if Hibernation module is already active, which could mean
        // that the processor is waking from a hibernation.
        //
        if(HibernateIsActive())
        {
            //
            // Read the status bits to see what caused the wake.  Clear the wake
            // source so that the device can be put into hibernation again.
            //
            ui32Status = HibernateIntStatus(0);
            HibernateIntClear(ui32Status);
    
            //
            // Wake was due to RTC match.
            //
            if(ui32Status & HIBERNATE_INT_RTC_MATCH_0)
            {
                ui32RTCWakeCount++;
            }
    
            //
            // Wake was due to Reset button.
            //
            else if(ui32Status & HIBERNATE_INT_RESET_WAKE)
            {
                ui32RESETWakeCount++;
            }
    
            //
            // Wake was due to the External Wake pin.
            //
            else if(ui32Status & HIBERNATE_INT_PIN_WAKE)
            {
                ui32EXTWakeCount++;
            }
    
            //
            // Wake was due to GPIO wake.
            //
            else if(ui32Status & HIBERNATE_INT_GPIO_WAKE)
            {
                ui32GPIOWakeCount++;
            }
    
            //
            // If the wake is due to any of the configured wake sources, then read
            // the first location from the battery backed memory, as the
            // hibernation count.
            //
            if(ui32Status & (HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_RTC_MATCH_0 |
                             HIBERNATE_INT_GPIO_WAKE | HIBERNATE_INT_RESET_WAKE))
            {
                HibernateDataGet(&ui32HibernateCount, 1);
            }
        }
    
        //
        // Configure Hibernate module clock.
        //
        HibernateEnableExpClk(32768);
    
        //
        // If the wake was not due to the above sources, then it was a system
        // reset.
        //
        if(!(ui32Status & (HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_RTC_MATCH_0 |
                           HIBERNATE_INT_GPIO_WAKE | HIBERNATE_INT_RESET_WAKE)))
        {
            //
            // Configure the module clock source.
            //
            HibernateClockConfig(HIBERNATE_OSC_LOWDRIVE);
    
        }
    
        //
        // Enable RTC mode.
        //
        HibernateRTCEnable();
    
        //
        // Set the RTC to 0 or an initial value. The RTC can be set once when the
        // system is initialized after the cold startup and then left to run. Or
        // it can be initialized before every hibernate.
        //
        HibernateRTCSet(0);
    
        //
        // Set the match 0 register for 30 seconds from now.
        //
        HibernateRTCMatchSet(0, HibernateRTCGet() + MWG_IDLE_DELAY);
    
        //
        // Configure GPIOs used as Hibernate wake source - PK4
        //
        GPIOPadConfigSet(GPIO_PORTK_BASE, 0x10, GPIO_STRENGTH_2MA,
                         (GPIO_PIN_TYPE_WAKE_LOW | GPIO_PIN_TYPE_STD_WPU));
    
        //
        // Enable processor interrupts.
        //
        IntMasterEnable();
    
        //
        // If hibernation count is very large, it may be that there was already
        // a value in the hibernate memory, so reset the count.
        //
        ui32HibernateCount = (ui32HibernateCount > 10000) ? 0 : ui32HibernateCount;
    
    
    
        //
        // Check if user wants to enter hibernation.
        //
        if(g_bHibernate == true)
        {
            //
            // Increment the hibernation count, and store it in the battery backed
            // memory.
            //
            ui32HibernateCount++;
            HibernateDataSet(&ui32HibernateCount, 1);
    
            //
            // Yes - Clear the flag.
            //
            g_bHibernate = false;
    
            //
            // Read and clear any status bits that might have been set since
            // last clearing them.
            //
            ui32Status = HibernateIntStatus(0);
            HibernateIntClear(ui32Status);
    
    //        HibernateGPIORetentionDisable();
            HibernateIntClear(HIBERNATE_INT_PIN_WAKE);
    
            //
            // Configure Hibernate wake sources.
            //
            HibernateWakeSet(HIBERNATE_WAKE_RTC | HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_GPIO |
                             HIBERNATE_WAKE_RESET);
    
            GPIOPinWrite(GPIO_PORTL_BASE,PIN_LOAD_CONTROL,PIN_LOAD_CONTROL);
    //        HibernateGPIORetentionEnable();
    
            //
            // Request Hibernation.
            //
            HibernateRequest();
    
            //
            // Wait for a while for hibernate to activate.  It should never get
            // past this point.
            //
            SysCtlDelay(100);
    
            //
            // Wait here.
            //
            while(1)
            {
            }
        }
    }
    
    
    void vfnProcessPowerModes()
    {
        static uint8_t counter = 0;
        static uint16_t prevMWGCount = 0;
        static uint16_t currMWGCount;
        static  bool pfiStatus;
        pfiStatus = vfnGetPFIStatus();
    
        switch(_ePowerModes)
        {
    
        case POWER_MODE_NORMAL_INIT:
            if(pfiStatus == false) // PK4 is used to monitor PFI condition. pfiStatus = false -> power OFF, pfiStatus = true -> power ON
            {
                _ePowerModes = POWER_MODE_BATTERY_INIT;
            }
            else
            {
                GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); // GLCD backlight white LED
    //            SysCtlReset();
                _ePowerModes = POWER_MODE_NORMAL;
            }
    
        break;
    
        case POWER_MODE_NORMAL:
            if(pfiStatus == false) // PK4 is used to monitor PFI condition. pfiStatus = false -> power OFF, pfiStatus = true -> power ON
            {
                _ePowerModes = POWER_MODE_BATTERY_INIT;
            }
            else
            {
                GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); // GLCD backlight white LED
                _ePowerModes = POWER_MODE_NORMAL;
            }
    
        break;
    
    
        case POWER_MODE_BATTERY_INIT:
            if(pfiStatus == false) // PK4 is used to monitor PFI condition. pfiStatus = false -> power OFF, pfiStatus = true -> power ON
            {
                _ePowerModes = POWER_MODE_BATTERY;
                vfn_default_lcd_screen_states();        // Show Valve Position Only
                vfn_getScreenDatafromFlash(0,S00101,1,AddressTable.aPosStatusScreens,SC001_1 - 1);
            }
            else
            {
                GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); // GLCD backlight white LED
                _ePowerModes = POWER_MODE_NORMAL;
            }
    
        break;
    
        case POWER_MODE_BATTERY:
            if(pfiStatus == false) // PK4 is used to monitor PFI condition. pfiStatus = false -> power OFF, pfiStatus = true -> power ON
            {
                //
                // Set the necessary flag before entering Hibernate function.
                //
                g_bHibernate = true;
    
                HibEnterWakeExit();
    
                GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, 0); // GLCD backlight white LED
                _ePowerModes = POWER_MODE_BATTERY;
                // In case battery voltage goes below the threshold level, switch off the entire system/provide indication
            }
            else
            {
                GPIOPinWrite(GPIO_PORTL_BASE,PIN_LOAD_CONTROL,PIN_LOAD_CONTROL);
                GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); // GLCD backlight white LED
                   while(1)
                   {
                       // To hit watchdog timer
                   }
                // or call reset externally
                _ePowerModes = POWER_MODE_NORMAL;
            }
    
        break;
    
        }// switch(_ePowerModes)
    
    }// end of void vfnProcessPowerModes()
    
    uint8_t vfnGetPowerMode()
    {
        return _ePowerModes;
    }
    
    
    

    Attached the firmware code used.

  • Both HIB and RESET follow the same state throughout the observation.

    I think this is the biggest mystery. Again, MCU does not control RESET. Your external circuit control RESET input to the MCU. However, you keep saying there is not external circuit that would assert RESET low. There must be someone who is driving RESET low. It must be your external circuit that reacts to the HIB. When HIB is asserted, it is suppose to cut off the power to your voltage supply. Check your board and see if you have circuit that reacts to voltage dip or Watchdog timeout that leads to the assertion of RESET. I start to wonder if your RESET is pulled up to VDD that is no longer 3.3V after HIB is asserted. You need to make sure RESET is pulled up to 3.3V while in hibernate so that a real RESET event can wake up the device. The RESET cannot just stay low because the main power is removed. 

      See below my scope when I run hibernate example on the DK EVM board. The HIB is asserted and the RTC will wake up the device after 5 seconds. Ch1 is HIB and Ch2 is RESET. As you can see RESET is not changed. Do you have a DK board or LaunchPad. Can you please run your code on either the board to see if you can replicate the problem? This will prove that RESET is only affected by your custom board or not.