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.

CCS/TM4C123GE6PM: Hibernation Mode

Part Number: TM4C123GE6PM

Tool/software: Code Composer Studio

Hi 

i'm trying to check if my board went into Hibernation module or it didn't. I'm using TM4C123G LaunchPad and i managed to configure it to go into Hibernation by the use of sw1 and here is the soft i did. 

void
ConfigureUART(void)
{
    //
    // Enable the GPIO Peripheral used by the UART.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    //
    // Enable UART0
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

    //
    // Configure GPIO Pins for UART mode.
    //
    ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
    ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
    ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    //
    // Use the internal 16MHz oscillator as the UART clock source.
    //
    UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

    //
    // Initialize the UART for console I/O.
    //
    UARTStdioConfig(0, 115200, 16000000);
}

//*****************************************************************************
//
// The interrupt handler for the Buttons.
//
//*****************************************************************************

void BottonsHandler(void){
      if((GPIOIntStatus(GPIO_PORTF_BASE,true)& Buttoninit1))
      {
          GPIOIntClear(GPIO_PORTF_BASE,Buttoninit1);// Clear interrupt flag
          TimerEnable(TIMER0_BASE, TIMER_A);//Enables the timer
      }
      else if((GPIOIntStatus(GPIO_PORTF_BASE,true)& Buttoninit0))
            {
                GPIOIntClear(GPIO_PORTF_BASE,Buttoninit0);// Clear interrupt flag
                TimerDisable(TIMER0_BASE, TIMER_A);//Disables the timer
                SysCtlPeripheralDisable(SYSCTL_PERIPH_HIBERNATE);//Disables the Hibernation module
                HibernateGPIORetentionDisable();//Disable GPIO retention
                HibernateDisable();//Disables the Hibernation module for operation.

            }
}
void configureButtons(void){
//configureButton0
      GPIOPinTypeGPIOInput(ButtonBase, Button0);
      GPIOPadConfigSet(ButtonBase ,Button0,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU);// Register our handler function for port F
      GPIOIntTypeSet(GPIO_PORTF_BASE,GPIO_PIN_0,GPIO_FALLING_EDGE);// Configure PF4 for falling edge trigger
      GPIOIntRegister(GPIO_PORTF_BASE,BottonsHandler); // Register our handler function for port F
      GPIOIntEnable(GPIO_PORTF_BASE, GPIO_INT_PIN_0);// Enable interrupt for PF0
//configureButton1
      GPIOPinTypeGPIOInput(ButtonBase, Button1);
      GPIOPadConfigSet(ButtonBase ,Button1,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU);// Register our handler function for port F
      GPIOIntTypeSet(GPIO_PORTF_BASE,GPIO_PIN_4,GPIO_FALLING_EDGE);// Configure PF4 for falling edge trigger
      GPIOIntRegister(GPIO_PORTF_BASE,BottonsHandler);// Register our handler function for port F
      GPIOIntEnable(GPIO_PORTF_BASE, GPIO_INT_PIN_4);// Enable interrupt for PF4

}

void
Timer0IntHandler(void)
{

   //
   // Clear the timer interrupt.
   //
   TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);

   UARTprintf("Hibernate mode is on!\n");

   SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);// enable the hibernation module
   HibernateEnableExpClk(SysCtlClockGet());//defines the clock supplied to the hibernation module
   HibernateGPIORetentionEnable(); //Calling this function enables the GPIO pin state to be maintained during hibernation .
   SysCtlDelay(SysCtlClockGet()/10 );

   HibernateWakeSet(HIBERNATE_WAKE_PIN);//set the wake condition to the wake pin
   SysCtlDelay(SysCtlClockGet()/10 );
   //GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3, 0);//turn off the green LED before the device goes to sleep.

   /*function requests the Hibernation module to disable the external regulator, removing power from the
   processor and all peripherals.*/

   HibernateRequest();
}



//*****************************************************************************
//
// Print "Hello World!" to the UART on the evaluation board.
//
//*****************************************************************************
int
main(void)

{
    //volatile uint32_t ui32Loop;

    //
    // Enable lazy stacking for interrupt handlers.  This allows floating-point
    // instructions to be used within interrupt handlers, but at the expense of
    // extra stack usage.
    //
    //ROM_FPULazyStackingEnable();

    //
    // Set the clocking to run directly from the crystal.
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ |
                       SYSCTL_OSC_MAIN);

    //
    // Enable the GPIO port that is used for the on-board LED.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

    //
    // Enable the GPIO pins for the LED (PF2 & PF3).
    //
    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);

    //
    // Enable the peripherals used by this example.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
    //
    // Registers an interrupt handler for the timer interrupt.
    //
    TimerIntRegister(TIMER0_BASE,TIMER_A,Timer0IntHandler);
    //
    // Enable processor interrupts.
    //
    ROM_IntMasterEnable();

    //
    // Configure the two 32-bit periodic timers.
    //
    ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
    ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ROM_SysCtlClockGet());

    //
    // Setup the interrupts for the timer timeouts.
    //
    ROM_IntEnable(INT_TIMER0A);
    ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);

    //
    // Initialize the UART.
    //
    ConfigureUART();
    //
    //Initialize the Buttons.
    //
    configureButtons();
    //
    // Hello!
    //
    UARTprintf("Hello, world!\n");
    SysCtlDelay(SysCtlClockGet());

    while(1)
    {
        UARTprintf("Run mode is on!\n");
        SysCtlDelay(SysCtlClockGet());
        GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3,GPIO_PIN_3 );
        SysCtlDelay(SysCtlClockGet()/10 );
        GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3,0);
        SysCtlDelay(SysCtlClockGet()/10 );

    }
}

 

So what i did is that i removed the jumper from the lunchpad and i tried to mesure the current in the different modes but the DMM doesn't show any differences during the different modes.

so if you know how to check if the board went into hibernation with the use of some command and the terminal i would be gratefull.

thank you.

Best regards

Amine. 

  • What current levels are you measuring? Note that (certain) DMMs require a "relocation of probes" to switch to "Current Measurement."

    You may check the "performance of your DMM" by creating a simple, high resistance circuit - and thus, "prove" that your DMM functions properly - at such low current levels.

    Fewer variables, "speeds, eases, enhances" your discovery & eventual success...
  • hi,

    i'm sure my DMM works properly, the thing is i'm trying to make sure that my code does actually enter the board into hibernate mode, even though when i'm interracting with the terminal everything goes right, so i though about measuring the current and it seems that it has to respect these mesurments:

  • Thank you - yet "all here" (still) have "No idea" as to what current you ARE measuring!

    I must thus ask - are you able to "Confirm the currents presented by that chart" - w/in ANY of the six modes presented?

    You write (only) that your "DMM doesn't show ANY differences" when in "different modes." (and this assumes that you have "entered into" such "different modes" - does it not?

    Again - what measurement values have you achieved? (actual measurements, s'il vous plait.)
  •  i'm measuring Idd, since my soft only present two modes : Run mode and hibernate so i'm trying to get this value on those two modes:

    The current on my DMM is the same all the times and and equal to 00.02/ on DC current above 20mA.

    i don't get it.

    Ps: if you have any other idea about making sure that the board did actually go into hibernation i would be happy to try it.

    thank you. 

     

  • Have you noted - and taken the proper actions to insure:

    • ALL MCU Peripherals are OFF
    • System Clock is, "ordered as described" w/in the "hibernation section of the MCU Manual" - when hibernation mode is sought
    • VDD is "switched from 3V3 to 0V" - if entry into either of the two "right-most" hibernate modes is desired
    • a proper (and measured) V_Bat is being supplied during hibernate

    Your meter's reading of 0.02 indicates - I believe - either "set to far "too high" a scale" or (very) basic meter

    Hibernate software functions should be (very) well covered w/in the, "Peripheral Driver Library User Guide" and likely w/in several API Examples  (found examples\peripherals\hibernate  (maybe)   I'm unsure if hibernate "made example inclusion."