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.

CC254x - Developing a Standby mode

Other Parts Discussed in Thread: CC2540

Hello everyone

I am currently developing a BLE enabled sensor based on the DK-MINI "Keyfob" development board. The sensor is to be placed in the hull of a small boat, and will therefore not be easily accessible. My plan is therefore to create a Standby mode where if the boat have not been moving for approximately 10 minutes (because the boat is put on land) the sensor should go to Standby mode and only wake up every x minutes to check if the boat has moved since last measurement (within some threshold of cause). Movements will be measured by the on-board accelerometer, and will wake up the processor in advertising mode.

I have looked into the power saving feature in the KeyFobDemo and found that each “task” can voluntarily accept the processor going into low power mode. Furthermore when GAP is in states ‘waiting’ or ‘waiting_after_timeout’ the only task running the battery service; not even the link layer is running.

What all this means is that when the Keyfob is not connected, not advertising and no other peripherals or services is turned on, the processor can stay in low power mode for a long time without being woken up.

My question is then; is it sensible to enforce tasks to accept low power mode, and what would be a good way to do it?

Best Regards

Rasmus

  • Hi Rasmus,

    I'm successfully using a combination of GPIO-pins, an IRQ and osal_pwrmgr_device() to switch between 'always on' (for UART communications) and 'low power mode' to preserve power.

    HTH

    Andre

  • Hey Andre

    I suppose you let the active tasks decide if and when the processor should go into 'low power mode'; especially when Bluetooth is connected to a central.

    Say I want to force the processor to go into 'low power mode' because of a timeout and stay there till a button is pressed. If Bluetooth is connected, I would have to terminate the connection, if some tasks have timers running, I would have to stop these timers. Does this make sense or am I completely off?

    I am also considereng what should happen when the processor wakes up from this Standby mode. If I successfully can force the processor to sleep for a long period, I might accidentally have interrupted some important measurement that eventually would be ruined by a long sleep. Therefore I am considering a 'Soft Reset' when the processor wakes up from Standby.

    Please contribute with suggestions for how to implement a 'force to sleep' functionallity (I'm not asking for code :-) ) and tell me if this doesn't make sense at all.

  • Hi Rasmus,

    I'm still not sure what you want to accomplish. Generally the cc2540 is running in a 'low power mode' when it does no advertising and no connection is active (given that you switched to POWERMODE_BATTERY as mentioned above). The KeyFob firmware as well as the SensorTag are working like this. They can be woken up by a keypress (aka an PIO IRQ) and then start advertising, etc. These devices manage to sleep/run for month with a coin cell...

    You can switch the cc2540 to 'active' mode by setting the power mode to ALWAYS_ON if you use stuff like UART communication, etc (because power saving messes with the clocks and e.g. the UART clock is derived from the main clock). I never used task base power modes, because I didn't need that complexity of it.

    In both modes you can register timer tasks at the OSAL to do you stuff which will wake up the CPU. Or you can start advertising or establish a connection, you don't have to switch the power mode for that. OSAL and the BLE stack take care of that.

    HTH

    Andre