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.

CC2640: Transitioning into sleep after PIN_init() is called in main() in simple_central sample program

Part Number: CC2640
Other Parts Discussed in Thread: BLE-STACK

What needs to be done to put the cc2640 into sleep mode after PIN_init() is called in main() in simple_central sample program?

Is it possible to call the routine Power_sleep() at this point?
We're trying to reduce power consumption as much as possible before going into shutdown.
We need to be able to start a timer, put the chip into sleep mode, then after the time expires, put the chip into shutdown mode.
We're successful at putting the chip into shutdown mode at this point, however, we have 3 more steps to complete our objective.
1) Start a timer - we would like to kick of a timer very early on in the main() function (after PIN_init and possibly after
calling the power policy).


2) Put the chip in sleep mode - the function Power_sleep() says 'This function must be called with interrupts disabled, and should not be called directly by the application'. However, I'm wondering whether we could violate this requirement if we are in main before calling iCall and before starting the BIOS.

3) After the timer expires, bring the chip out of sleep mode.

The reason we're wanting to do this is so we can reduce power consumption during the period of time that the other chips on the board are powering up.

Regards,
John

  • Hi John,

    All you need to do to make the device goes to sleep is to make sure POWER_SAVING is defined, and make sure there are no active tasks. (E.g. all tasks are in Task_sleep(), pending on event etc). You don't have to call an API to make the device go to a sleep.

    You can use a power analyzer to make sure the device is indeed goind into standby/sleep. Please see this app note: http://www.ti.com/lit/swra478
  • Thanks Marie,

    Even though POWER_SAVING is defined, it doesn't go into sleep mode.

    I am taking current measurements using an N6705B DC Power Analyzer.

    I've studied the app note www.ti.com/.../swra478 and it helps, however, I haven't been able to resolve the issue.

    I use 2 setups to measure current.

    Setup 1) DC Power Analyzer drives cc2640 VDD domain (3.3V) of the cc2640.

    Setup 2) DC Power Analyzer drives the battery domain, which powers the board's power booster.

    I use Setup 2) to watch the cc2640 go in and out of shutdown mode. However, it's very challenging to see the cc2640 go into and out of sleep mode using this setup.

    I may need to change to Setup 1) to see enough detail to understand why it's not going into standby/sleep.

    Is there a way to tell whether a task is active?

    John

  • Hi John,

    You can use the TI-RTOS Object Viewer to see the status of the tasks at runtime. Please see dev.ti.com/.../debugging-index.html

    BTW, what version of the BLE-Stack/SDK are you using?
  • Marie,

    We're using ble_sdk_2_02_00_31

    John

  • Hi John,

    In that case you dan find the description for ROV here: http://www.ti.com/lit/swru393 , chapter 9.5 TI-RTOS Object Viewer.
  • Thanks, Marie,

    I had been working against version c (swru393e.pdf).

    I'm sure this will clear some things up for me.

    We are onto the smoking gun. Sleep is being dis-allowed by the mask...just need to track down where this is being done.

    Regards,

    John

  • Marie,

    The app sits in the Simple_Central application wait forever state, then transitions out of it in order to process a user-initiated event. It appears the radio is setting the constraints mask to 0x04. As in, disallow standby, correct ?

    Then, when the application finishes its handling of the event and it returns to the wait forever state, the presence of the 0x04 constraint prevents it from going into standby.

    We do not need the radio except rarely.. Perhaps 0.0001 percent of the time. Or less.

    How do we turn the radio on and off ? Conversely, in our use of the simple_central example as a base to our code, what part of the example code turns the radio on?

    We tried calling Power_releaseConstraint(PowerCC26xx_SB_DISALLOW) just for fun in the application event processing loop --- and it worked for a moment sometimes, but the constraint always returns, sooner rather than later, and often almost immediately.

    Looks like we need to tell the radio to quit...

    How do we do that?

    Regards,
    John
  • Hi John,

    We have a known issue in ble_sdk_2_02_00_31 where the device is not always able to return to standby between connection events. If you have a power analyzer you should be able to identify this issue on a power trace. (This issue was fixed in ble_sdk_2_02_02_25.)

    What kind of code changes have you made in simple_central?

    All radio commands are sent from the BLE-Stack. As you may know, the radio in the CC2640 device has a separate core (M0) so there is no reason for the main processor (M3) to be disallowed from standby when the radio is running..
  • Thanks Marie,

    I'll get those changes to you soon.

    What RTOS version do you recommend running with version 2_02_02_25 of the BLE stack?

    Regards,

    John

  • Marie,

    It looks like TI is recommending using version 2_21_01_08 of the RTOS, since this is the version that is downloaded along with version 2_02_02_25 of the stack.
    Can you tell me what version of Sensor Controller Studio I should be using?
    I'm currently using v2.4.

    Thanks,
    John
  • Hi John,

    Sensor Controller Studio v. 2.4 should be fine. You may have to go to Check for updated and enable some patches. (Open SCS and select Updates → Check for Updates. If any new patches were found, select Updates → Manage Updates and apply all the new patches.)