PSoC4 BLE Power Management

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I'm very new to BLE for PSoC4 so I'm making a lot of assumptions I want to check:

   
        
  1. Can I call CyBle_EnterLPM() basically any time, in any state?  Why doesn't BLE just do this automatically then?
  2.     
  3. Should I only call this immediately before a CPU sleep? ie. does it change CPU clock/speed?
  4.     
  5. Will an interrupt will always be fired when CyBle_GetBleSsState changes?
  6.    
   

(history as to why I'm asking:)

   

I have a relatively large system of software pieces that may or may not be active, with different tolerances for sleep states, so I've implemented some power savings code to help with that.

   

Each piece, including interrupts, indicates what sleep state is acceptable at the time.  Here my attempt at BLE - this function is called basically any time there is a BLE interrupt, whenever the main loop changes a BLE condition, and after any call to CyBle_ProcessEvents.

   
void UpdateSleepState(void) {     CYBLE_LP_MODE_T bleMode;      if(CyBle_GetState() != CYBLE_STATE_CONNECTED) // Is this even necessary?     {         RequestSleep(SL_AWAKE);         return;     }          /* Request BLE subsystem to enter into Deep-Sleep mode between connection and advertising intervals */     bleMode = CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);      switch(CyBle_GetBleSsState())     {         case CYBLE_BLESS_STATE_DEEPSLEEP:         case CYBLE_BLESS_STATE_ECO_ON:         case CYBLE_BLESS_STATE_HIBERNATE: /* Hibernate is not documented, aside from saying CPU can deep sleep. */             RequestSleep(SL_DEEP_SLEEP);             break;         case CYBLE_BLESS_STATE_ECO_STABLE:         case CYBLE_BLESS_STATE_SLEEP:         case CYBLE_BLESS_STATE_ACTIVE:             RequestSleep(SL_SLEEP);             break;         case CYBLE_BLESS_STATE_EVENT_CLOSE:             RequestSleep(SL_AWAKE); /* Force the CPU to stay awake even if other things have requested sleep */             break;         case CYBLE_BLESS_STATE_INVALID:             break; /* We don't anticipate this state. */     } }
   

This only works if there is always an interrupt for every time there is a change in the need for sleep.

0 Likes
1 Solution
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

   

We recommend you to have a look at the Application Note:AN92584 - Designing for Low Power and Estimating Battery Life for BLE Applications (Link:http://www.cypress.com/documentation/application-notes/an92584-designing-low-power-and-estimating-ba...).

   

1)Can I call CyBle_EnterLPM() basically any time, in any state?  Why doesn't BLE just do this automatically then?

   

A: You can call this API anywhere. 

   


2)Should I only call this immediately before a CPU sleep? ie. does it change CPU clock/speed?

   

A:Ideally the BLE application device will be kept in deepsleep, then the periodic task has been done and the CPU can be kept in sleep.

   


3)Will an interrupt will always be fired when CyBle_GetBleSsState changes?

   

A:Any BLE activity will trigger BLESS interupt and wake the device up.

   

 

   

Thanks,

   

Hima

View solution in original post

0 Likes
1 Reply
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

   

We recommend you to have a look at the Application Note:AN92584 - Designing for Low Power and Estimating Battery Life for BLE Applications (Link:http://www.cypress.com/documentation/application-notes/an92584-designing-low-power-and-estimating-ba...).

   

1)Can I call CyBle_EnterLPM() basically any time, in any state?  Why doesn't BLE just do this automatically then?

   

A: You can call this API anywhere. 

   


2)Should I only call this immediately before a CPU sleep? ie. does it change CPU clock/speed?

   

A:Ideally the BLE application device will be kept in deepsleep, then the periodic task has been done and the CPU can be kept in sleep.

   


3)Will an interrupt will always be fired when CyBle_GetBleSsState changes?

   

A:Any BLE activity will trigger BLESS interupt and wake the device up.

   

 

   

Thanks,

   

Hima

0 Likes