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.

Compiler/TM4C129EKCPDT: Hibernate

Part Number: TM4C129EKCPDT

Tool/software: TI C/C++ Compiler

We're using the TM4C129EKCPDT chip.

I want to do that every time the IO port state is changed, the state (variable data of uint32_t) is saved to HIBDATA register (call HibernateDataSet), and the IO state previously recorded can be read out again when the power is re-energized.(HibernateDataGet function is read out)
The hardware operation is to supply power to the VBAT (PIN 68) PIN via button battery, not to XSOC0 or XSOC1 (PIN 66/67) and crystal vibration.Is there a problem?

Referring to the TI demo, I wrote the following simplified code (actually I not sure how to configure it) :

uint32_t pin_vel = 0x00000001;
uint32_t bk_pin = 0x00000000;
set_hibernate()
{
   HibernateDataSet(&pin_vel,1);   //pin_vel is change depending on the state of the IO
}

get_hibernate()
{
    SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);    // Enable the hibernate module.
    HibernateClockConfig(HIBERNATE_OSC_LOWDRIVE);
    ui32Status = HibernateIntStatus(0);
    HibernateIntClear(ui32Status);
    if(HibernateIsActive())
    {
        HibernateDataGet(&bk_pin,1); //read data to bk_pin
        rt_kprintf("read value =%ld\r\n",bk_pin);  //Gets the value written before power off and prints it out
    }
}

void hib_thread()
{
    //other init

    get_hibernate()
    while(1)
    {
        get_hibernate();  //Constantly writing "pin_vel" value ,"pin_vel "is will change
        delay();
    }
}

The program runs printing to get a value of 0, not written value. How should the software be modified?

I need detailed configuration .I tried to configure it myself many times, but the test didn't work.
Because I'm using TI's chip for the first time, it's not very familiar.I'd better be able to give me a simple program that only implements what I want.

thank you !

  • Here is a simple program that configures the hibernation module and reads a 32 bit integer from the battery backed up memory. It prints that value out the UART and allows the user to change the value from the UART. If you have properly connected the battery, the last value entered will be retained during a power loss. The main routine is shown below and the full project is attached in a .zip file.

    //*****************************************************************************
    int
    main(void)
    {
    	unsigned int hibernateData;
    	char buffer[32];
    	//
        // Run from the PLL at 120 MHz.
        //
        g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                    SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
                    SYSCTL_CFG_VCO_480), 120000000);
    
        //
        // Initialize the UART.
        //
        ConfigureUART();
    
        // Initialize Hibernation module
        SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
        //
        // Wait for the Hibernate module to be ready.
        //
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_HIBERNATE))
        {
        }
        HibernateEnableExpClk(g_ui32SysClock);
        HibernateClockConfig(HIBERNATE_OSC_LFIOSC);
    
        // Read data stored in hibernate memory
        HibernateDataGet(&hibernateData, 1);
    
        while(1)
        {
            UARTprintf("Current Value stored in hibernate memory is: %d\n",hibernateData);
            UARTprintf("Enter new value: ");
            UARTgets(buffer,32);
            sscanf(buffer,"%d", &hibernateData);
    
            // Store new value in hibernate memory
            HibernateDataSet(&hibernateData, 1);
        }
    }
    

    /cfs-file/__key/communityserver-discussions-components-files/908/EK_2D00_HibernateData.zip

  • thank you very much!!