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.

Low power mode with OSAL on cc2541

Other Parts Discussed in Thread: CC2541

Hi Guys,

I need to enter in sleep mode in cc2541, but it is important for our project to continue to count the second number passed from device startup ( osal_getClock() ).

Then, in sleep mode I dont want to handle the ble connection. The device will be invisible.

Do you know if in osal the microcontroller increment its internal counter for osal_getClock ? How to disable at all the BLE ?

Do you know how to entry in sleep mode with osal ?

Thanks

Mikael

  • Hello Mikael,

    The counter will be updated by the scheduler meaning it is not dependent upon any BLE connection. But it will not tick during sleep, but it will be updated after it wakes up from sleep.

    What do you mean by:

    "How to disable at all the BLE ?"

  • thanks Eirik,

    Actually my questions were:

    1) How to disable BLE during sleep mode ? Aftter the sleep mode, is the BLE will visible again without init ?

    2) Is it possible to change  "osal_pwrmgr_device( ...)" during the runtime ? After OSAL init ?

    3) What are the conditions for OSAL to enter in sleep mode ? In which sleep level the micro controller will be ?

    4) After the sleep mode,  how the OSAL will know how many time it was in sleep mode, since its very important for us to get an updated date .

     

    Thanks

    Mikael

  • 1) I think BLE will be disabled by itself when device is in sleep mode.

    2) Yes, I think you can do that. You can refer OSAL API Guide available at <BLE stack install dir>\Documents\osal

    3) I think based on the current usage of the device OR activity on the device, CC254x goes into power down mode on itself.

    4) If device is in sleep mode, it will remain in sleep mode till you won't awake it explicitly. Refer Chapter 4 of this user guide.

    Please click 'Verify Answer', if this has answered your question.

  • Thanks Dhaval,

    Regarding the question 4, I would like to be sure that the main clock, ( osal_getClock() ) will be updated after getting back to the main mode...

    Thanks 

  • Hello Mikael,

    If you are running your own OSAL task then the clock will be updated before you enter your task.

    In the osal_run_system loop the osalTimeUpdate function will be called which updates the time. But the time might be slightly offset as other higher priority low level radio tasks may interrupt the code execution and delay the time between the clock is updated and it enters your specific OSAL task.

  • Hi Guys,

    How can I cause OSAL to call "osal_pwrmgr_powerconserve" ?

    I see this function is never called ... and should be in case of sleep mode.

    I called for each task (including the radio tasks) the followings functions:

     - osal_clear_event( task_id, for each bit );

     - osal_stop_timerEx( task_id, for each bit );

    and osal_pwrmgr_task_state( for each task, PWRMGR_CONSERVE );

    And as far I understand, the microcontroller is not in sleep mode while this function is not called ...

    [Another questions]:

    - How can I stop the radio tasks, and restart them after the sleep mode ?

    Thanks

    Mikael

  • Hi Mikael,

    To take your peripheral device into deep sleep, disconnect it from the central device, stop advertising, stop all the timer events and put all your GPIOs as output HIGH. Also, put on board peripherals in power down mode to conserve power.

    You can refer Application Note AN092, Measuring Bluetooth Low Energy Power Consumption, for more insight.

    Thanks,

    Dhaval

    You can 'Verify Answer', if this answers your question!!

  • Thanks Dhaval 

    But my device is working as peripheral. Do you know which api I need to call in order to stop the discoverable mode and disconnect link if we are connecting ?

    After that you say that my SW should call osal-powerconserve right ?

    What is the effect of hal-sleep() in BLE API ?

    Thank you very much

    Mikael

  • Hi Mikael,

    To stop advertising, you can set 'GAPROLE_ADVERT_ENABLED' ti FALSE using 'GAPRole_SetParameter()'.

    To terminate the link from peripheral side you can call "GAPRole_TerminateConnection();" function.

    No, I meant you need to put the on board peripherals in power down mode. It doesn't mean that you need to call osal-powerconserve function.

    I didn't get your question, "What is the effect of hal-sleep() in BLE API?"

    Thanks,

    Dhaval

  • Thanks dhaval

    I mean if I call hal-sleep() API, is enough to enter in sleep mode without awake when timer or event will fire ?

  • I think you need not to call it explicitly.

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

    You can 'Verify Answer', if this has answered your question.

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

  • OK so you are saying that in order to enter in sleep mode, I only need:

    - to clear event and timer in my tasks only,

    - close the current connection 

    - disable the advertising.

    That's all ?

    By the way, in which sleep mode I will enter ? do you have an idea ?

    Thanks

    Mikael

  • Yes, after this steps your SoC will enter into power down state. I think. it should go in to PM3.