BLE won't go to deepsleep for 125ms with CyBle_EnterLPM() every 45 seconds

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

cross mob
user_1669321
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

Hi,

I'm using CYBLE-014008-00 and I have an issue with the BLE deep sleep.

Basically, I'm waking up every 40 ms to start a PWM that lasts 1 ms, get a timer sample and add it to my buffer, then I go to deepsleep until the next WDT interrupt. When I have enough samples, I send a notification with the data. The system works perfectly, but every ~45 seconds, the following line doesn't let me go to deepsleep for 125-240 ms, only to sleep.

sleepMode = CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);

I've attached a screen capture of my logic analyzer. Here are the signals :

dpslp_sleep: When CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP) returned SLEEP instead of deepsleep

dpslp_dpslp: When entering deepsleep after CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP)

sleep: when entering sleep after CyBle_EnterLPM(CYBLE_BLESS_SLEEP)

dpslp_sleep_event: when entering sleep instead of deepsleep because of a pending event in the application that requires HFCLK

PWM start: self explanatory

PWM stop: self explanatory

ADC timer: self explanatory

CyBle_Process: Before and after entering CyBle_ProcessEvents();

CyBle_EnterLPM_sleep_deepsleep.PNG

As you see, every ~45 seconds, the first signal (dpslp_sleep) will go to high and toggle there for a duration of 125-240 ms a couple of times, meaning that I don't go to deepsleep. I could go to sleep, but it results in peaks of current. I'd much rather go to deepsleep. Here is a zoom of the same figure:

CyBle_EnterLPM_sleep_deepsleep_zoom.PNG

Isn't this a really long time to not be able to go to deep sleep? Is this normal?

Thank you,

Fred

0 Likes
1 Solution
user_1669321
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

I got it working by never going to sleep when CyBle_EnterLPM(CYBLE_BLESS_SLEEP) returns CYBLE_BLESS_SLEEP instead of CYBLE_BLESS_DEEPSLEEP. I figured that if the BLESS does not return CYBLE_BLESS_DEEPSLEEP, it's because it's busy with a BLE transaction.

So what happens now is I stay awake for a little bit more by polling CyBle_EnterLPM(CYBLE_BLESS_SLEEP) a bit, but I'm able to go to sleep and then deepsleep.

Thank you for your time,

Fred

View solution in original post

0 Likes
3 Replies
GyanC_36
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Hello Fred,

    Apart from the WDT interrupt the BLESS interrupt ( .cydwr-> Interrupts ) will also wake up the BLESS as well as System from the DeepSleep at every connection/advertising interval.

Please confirm the issue keeping in mind both WDT and BLESS Interrupt or any other interrupt source , if they are preventing to go the BLESS in DeepSleep.

Please attach the project here  if you have any observations/further queries.

Regards,

Gyan

0 Likes

Hi,

Yes, I took that into account. I can see the device waking up every connection interval (240 ms), but the 125-240 ms of staying awake every 45 seconds doesn't look like it's related, except for the longer timer (240 ms) being equivalent to the connection interval.

0 Likes
user_1669321
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

I got it working by never going to sleep when CyBle_EnterLPM(CYBLE_BLESS_SLEEP) returns CYBLE_BLESS_SLEEP instead of CYBLE_BLESS_DEEPSLEEP. I figured that if the BLESS does not return CYBLE_BLESS_DEEPSLEEP, it's because it's busy with a BLE transaction.

So what happens now is I stay awake for a little bit more by polling CyBle_EnterLPM(CYBLE_BLESS_SLEEP) a bit, but I'm able to go to sleep and then deepsleep.

Thank you for your time,

Fred

0 Likes