WICED Smart Sleep/Deep-Sleep Explanation and Techniques Design Guide

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

cross mob
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Just an FYI that there is a new document available on the community which discusses Sleep and Deep Sleep operation on the BCM20736/37.

WICED Smart Sleep/Deep-Sleep Explanation and Techniques Design Guide

Note that this is based on j.t very popular Sleep Blog here: Sleep Deep_Sleep Explanation and Techniques

Special thanks to psiegal for spending the time needed to convert this information into a succinct document for the community.

0 Likes
1 Solution
Anonymous
Not applicable

Hello Gurpal,

Please sees previous comments as these are correct:

Here is a code snippet:

 

if(!P_UART_RX_FIFO_NOT_EMPTY() && P_UART_TX_FIFO_IS_EMPTY())

 

                return ~0;       ////// TX FIFO is empty and RX FIFO is empty. Allow sleep.

 

else

                  return 0;          // Either TX or RX is not empty. Don’t sleep.

"The sleep callback will be invoked whenever the FW is ready to sleep. What you should do is if PUART TX or RX FIFO is not empty, return 0 (for don't sleep - the app will get polled again in a few hundred uS) and if both are empty, return 0xFFFFFFFF (for sleep for however long you want to - other modules in the FW will decide the actual time to sleep based on adv/connection/scan intervals/timers etc)."

"Have you looked at Re: Peripheral UART missing bytes?"

Thanks

JT

View solution in original post

9 Replies
Anonymous
Not applicable

Hello,

Thanks for putting this document together, it is very helpful!

I had one question, however, when using peripheral UART and disabling the sleep modes, does that mean that from then on throughout the program, all sleep modes will be disabled?

If that callback function is in the list of functions and returns a value of 0x00, is there any way to reverse that callback when you know the program is not using peripheral UART? I am trying to do this by recalling that same callback but this time returning 0xFFFFFFFF, but I can tell that the chip is not going into sleep or deep-sleep. Is there another method that will work?

Your help is much appreciated.

Cheers,

Gurpal

0 Likes

So are you trying to figure out how to keep the part in sleep mode except when the PUART is being used?

0 Likes
Anonymous
Not applicable

Yes, when I am not communicating through PUART, I would like the chip to go through the regular sleep mode cycles and deep sleep. Is it possible to only disable sleep during PUART communication?

I think I could get away with changing the callback function to a non 0 number which would only prevent the chip from going into sleep modes for a certain amount of time, depending on what the return number is. At least that's what I got from the document above.

Just wondering if there is a better more efficient way.

Cheers

0 Likes
Anonymous
Not applicable

Yea, that was actually a question I asked also

Not sure how to only disable sleep for a portion of the time. Anything you can suggest or point me in the direction of?

Cheers,

0 Likes

The sleep callback will be invoked whenever the FW is ready to sleep. What you should do is if PUART TX or RX FIFO is not empty, return 0 (for don't sleep - the app will get polled again in a few hundred uS) and if both are empty, return 0xFFFFFFFF (for sleep for however long you want to - other modules in the FW will decide the actual time to sleep based on adv/connection/scan intervals/timers etc).

Anonymous
Not applicable

I see, do I use the same exact callback function and return different values depending on the situation? Or do I enter different callback functions with different names?

When I have tried something like this, I see the chip doesn't go into sleep. When you return 0 for the callback function, won't the device always get this value when trying to go into sleep modes and therefore never enter sleep?

Are these callback functions permanent? If i enter a callback function with return value 0, is this action irreversible?

I'm using the BCM20732 (chip only), by the way so I can only use the SDK 1.1

Really appreciate the help.

Cheers,

Anonymous
Not applicable

Hello Gurpal,

Please sees previous comments as these are correct:

Here is a code snippet:

 

if(!P_UART_RX_FIFO_NOT_EMPTY() && P_UART_TX_FIFO_IS_EMPTY())

 

                return ~0;       ////// TX FIFO is empty and RX FIFO is empty. Allow sleep.

 

else

                  return 0;          // Either TX or RX is not empty. Don’t sleep.

"The sleep callback will be invoked whenever the FW is ready to sleep. What you should do is if PUART TX or RX FIFO is not empty, return 0 (for don't sleep - the app will get polled again in a few hundred uS) and if both are empty, return 0xFFFFFFFF (for sleep for however long you want to - other modules in the FW will decide the actual time to sleep based on adv/connection/scan intervals/timers etc)."

"Have you looked at Re: Peripheral UART missing bytes?"

Thanks

JT

Anonymous
Not applicable

Thanks JT,

this worked! Really appreciate the help.

Cheers,

0 Likes