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.

Deep Sleep with TI-RTOS

Other Parts Discussed in Thread: SYSBIOS, CC3200

I am trying to get the power management to work with the TI-RTOS and am not having much luck.  I am calling PRCMDeepSleepEnter() when I want to go to sleep but this does not seem to have any effect.  I was reading the Technical Reference Manual in section 5 it said we have to call PRCMCC3200MCUInit(); when booting from Power-Off the routine is expected to be called but this locks the MCU up when I execute it.  I see in the deepsleep_nw example MAP_PRCMDeepSleepEnter(); is called, how does that differ from the PRCMDeepSleepEnter(); call?  Where is the MAP_PRCMDeepSleepEnter(); included?  Does the PRCMCC3200MCUInit() need to be called?  If I call PRCMDeepSleepEnter(); before calling BIOS_start(); the processor goes to sleep.  I am calling PRCMDeepSleepEnter(); from an idle thread that I created.  I can see it being called but the code keeps running.


Thank you


al

  • Al,

    What could be happening is that a resource is preventing you from going into DeepSleep.

    You said "If I call PRCMDeepSleepEnter(); before calling BIOS_start(); the processor goes to sleep." which seems to support this.

    If you are using SYSBIOS, can you let me know what version you are using?  By default I believe, we use the SYSTICK Timer which may prevent you from going to sleep.  You might have to make a few configuration changes to use the RTC clock or disable the Timer altogether just to see if it works for you.

    Anyways, let me know what version of TIRTOS and SYSBIOS and CCS you are using and I can try to help you.

    Judah

  • Hi Judah,

    I am using Version: 6.0.1.00040 of ccs and here are the includes that we are using for the TROS and SYSBIOS

    I have been scratching my head over this one today, any help you can provide would be greatly appreciated.

    al

  • So I added the SysTickDisable and Enable calls around the DeepSleepEnter in my idle task,

    SysTickDisable();
    PRCMDeepSleepEnter();
    SysTickEnable();

    I go to sleep but I don't wake up on a GPIO interrupt that was working before entering sleep mode.

    How do I wake up?

    thank you Judah

  • Allen,

    Any interrupt should wake up the CPU from DeepSleep mode.  Are you sure the GPIO interrupt is still firing?

    Do you know if you need the BIOS timer to be enabled?  Like are you using timeouts or other services that use the Clock?  If not, then I would suggest, lets disable the BIOS clock so you can remove those SysTickDisable()/SysTickEnable() calls to see if it makes any difference.  I don't know what the SysTickDisable() call does...perhaps its disabling interrupts?


    Do the following in your .cfg file to disable the BIOS clock:

    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    BIOS.clockEnabled= false;

    Judah

  • Hi Judah,

    When I add the BIOS.clockEnabled = false; the OS does not appear to be running, nothing seems to happen. It does not appear that my code is running.

    Before the DeepSleepState is entered, if I drop pin 55 from high to low an interrupt is generated and processed correctly.  Once deep sleep is entered, if I drop that line nothing happens, I have a power monitor across J14 on the CC3200 Launchpad board, I can see the power level go down as deep sleep is entered, but when I drop the input on P55 nothing changes - power level still stays low??  I have the same type of interrupt set up on pins 63, 50, 57, 59, and 18.  All of them operate before deep sleep is entered, none of them raise the power level back to where it was? 

    SysTickDisable() has one line in it: HWREG(NVIC_ST_CTRL) &= ~(NVIC_ST_CTRL_ENABLE);

    SysTickEnable() has one line in it: HWREG(NVIC_ST_CTRL) |= NVIC_ST_CTRL_CLK_SRC | NVIC_ST_CTRL_ENABLE;

    If I comment out the call toPRCMDeepSleepEnter() but leave in the calls to SysTickDisable() and SysTickEnable() everything functions fine. 

    Any idea why the GPIO interupt would not wake up the CC3200?

    al

  • Correction, I am measuring power across J13, NOT J14.

  • Allen,

    So looks like your program requires the BIOS clock to be enabled.
    We do support the RTC for CC3200.   If you add the following statements to your .cfg file,
    it should use the RTC clock and not SysTick.

    Clock.TimerProxy = xdc.useModule("ti.sysbios.family.arm.cc32xx.Timer");
    Clock.tickMode = Clock.TickMode_DYNAMIC;

    However, I am not sure why the CPU is not waking up from deep sleep.  I might have to see if I can get someone who knows more about the hardware to chime in.  I know that I've gone into deep sleep and have woken up via the RTC timer.

    Judah

  • Judah,

    I get a clock is not defined message when I add those instructions.  What is the definition?

    The interrupts are working if the systick has been disabled, I wrote some test code to check.

    Please let me know what the hardware experts have to say.

    thank you

    al

  • Hi Judah,

    Any word from the Hardware guys?

    al

  • Al,

    I just got back today.  I haven't seen anything from the hardware guys and I just pinged them again.

    Judah

  • Hi Allen,

    The clocks to the peripherals are gated on entering DeepSleep. In order to keep the peripheral active, the deepsleep clock has to enabled. You may try the following:

    Update the line that enables the clock to GPIO as below -

    MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK|PRCM_DSLP_MODE_CLK);

    Please use the base for the GPIO port you use (PRCM_GPIOAx).

    Do let us know if it helps.

    Best regards,

    Naveen

  • Hi Naveen,
    I am finally getting back to looking at this.
    I added the PRCMPeripheralClkEnable(PRCM_GPIOA1|PRCM_GPIOA0, PRCM_RUN_MODE_CLK|PRCM_DSLP_MODE_CLK); call in my initialization code.
    Here is the routine in my idle loop to call the deep sleep function:
    void ff_Idle()
    {
    if (timeForSleep == 1)
    {
    timeForSleep = 0;
    GPIOPinWrite(GPIOA3_BASE, 0x80,0x80); // Set pin 45 high
    SysTickDisable();
    PRCMDeepSleepEnter();
    SysTickEnable();
    GPIOPinWrite(GPIOA3_BASE, 0x80,0x00); // Set pin 45 low
    }
    }

    And here is my test infinite loop that is running in a high priority task:

    volatile static int i, j;
    while (1)
    {
    j++;
    GPIOPinWrite(GPIOA1_BASE, 0x02, 0x02); // Set pin 64 high
    Task_sleep(100);
    GPIOPinWrite(GPIOA1_BASE, 0x02, 0x00); // Set pin 64 low
    Task_sleep(50);
    if (j > 25)
    {
    j = 0;
    timeForSleep = 1;
    }
    }
    I see pin 64 toggle up and down on my scope until the processor goes into sleep mode, I know it is in sleep mode because I can see the current draw go down from ~18mA to ~8mA, pin 64 stops toggling and is high, pin 45 goes high. After I push SW3 on the Launchpad to generate an interrupt I see pin 45 go low, 100 mS later pin 64 goes low for 50 mS followed by it going high for 100 mS followed by it going low forever?? The power level returns to ~18mA and stays there. What have I done wrong??
    Thank you for your help.
    al
  • Hi Naveen,

    I figured it out, I had another task running in the background that I thought I had disabled. Deep Sleep Mode is working for me. Thank you for your help.

    al