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.

CC2540: - How to enter power management mode and toggle to active mode by port 0 pin 1

Part Number: CC2540

Hi,

I am new to CC2540. Please allow me to describe my set up first.

I am using SimpleBLEperipheral project. I have temperature sensor event measuring temperature every 3 sec and broadcast out by the interval defined in SimpleBLEperipheral.

I have already done that set up. With that set up, what I would like to achieve is, to have control input (lets say we use port 0 pin 1) into CC2540. As long as that port 0 pin 1 is high, my CC2540 will keep doing above mentioned operation. Once that Port 0 Pin 1 goes low, I want CC2540 to go lowest power consumption mode, until port 0 pin 1 is high again, then CC2540 will resume temperature sampling and broadcasting again. It not required to save any data during low power consumption mode. There will be no fix duration between when Port 0 Pin 1, will be high or low. It could be 5sec or 1 minute or longer.

Can anyone give me direction of example project or related post for it? Thank a lot.

Regards,

LB

  • You can detect high/low change on Port 0/Pin 1 and call osal_pwrmgr_device( PWRMGR_BATTERY )/osal_pwrmgr_device( PWRMGR_ALWAYS_ON) to set device to power saving or not. When you do this, you also have to define POWER_SAVING in project compile options.
  • Hi YiKai Chen,

    Thanks a lot for your reply. Please allow me to ask following things too.

    ------------------------------------------------------------------------------------------------------------------------------------------

    Q1. Is it true that, OSAL will auto handle Power management (assume that we have defined it), when there is no pending tasks or periodic tasks to perform?

    ------------------------------------------------------------------------------------------------------------------------------------------

    Q2. I have read somewhere in the web(i cant recall the link) that, since OSAL will auto handle power management, we shouldn't be calling power management mode directly by ourself.

    Is above statement correct too?

    ------------------------------------------------------------------------------------------------------------------------------------------

     

    YiKai Chen said:
    You can detect high/low change on Port 0/Pin 1 and call osal_pwrmgr_device( PWRMGR_BATTERY )/osal_pwrmgr_device( PWRMGR_ALWAYS_ON) to set device to power saving or not. When you do this, you also have to define POWER_SAVING in project compile options.

    Q3. Regarding  with your suggestion, since there are periodic tasks running in my simpleBLEPeripheral project, which part of the code should I be doing condition check?

    Should I do like as below in "simpleBLEPeripheral.c"?

    if  ( ( events & SBP_PERIODIC_EVT ) && P0_1 == 1) )

    Thanks a lot for your help.

    Regards,

    LB

  • Q1&Q2: If you define POWER_SAVING in your project, OSAL will automatically handle Power management, when there is no pending tasks or periodic tasks to perform. However, you still can use osal_pwrmgr_device( PWRMGR_BATTERY )/osal_pwrmgr_device( PWRMGR_ALWAYS_ON) to set device to power saving or not according to your application.
    Q3: It looks feasible.
  • Hi YiKai Chen,

    Thanks a lot indeed for your help.

    I am now able to put that condition in the event.

    I would like to monitor its current consumption during normal operation and during sleep.

    How much current consumption should i expect during sleep?

    And, during sleep mode, oled display should off by itself or, should i put clear screen function?


    Thank you.

    Regards,
    LB

  • Noted with thanks. :)

    LB