BLE Connection with Deep Sleep | Cypress Semiconductor
BLE Connection with Deep Sleep
I've been trying to get deep sleep functionality to work on a PSoC module and have not been able to get it to operate correctly. My intended code flow is to do the following:
- Come out of hibernate with a button press
- Connect to a BLE host
- Configure sensors and watchdog and go into deep sleep loop
- Waking up via watchdog every 5/30 seconds to read and send data over BLE then going back to deep sleep
- Return to hibernate when BLE is disconnected for a set amount of time
The hibernate functionality works fine but the MCU locks up whenever I try to enter deep sleep. I pulled a HandleLowPowerMode function out of a project similar to this one (http://www.cypress.com/blog/100-projects-100-days/project-027-ble-power-...) but it hasn't worked correctly. I also tried speedycat's EasySleep library (http://www.cypress.com/forum/psoc-4-ble/library-called-easysleep) to the same result.
When I use HandleLowPowerMode without the CyEnterCriticalSection function calls, the deep sleep loop actually works but causes the BLE to drop. From what I saw in the documentation (and an example project), the BLE connection should remain active through the deep sleep call unless I missed something.
void HandleLowPowerMode(uint8 lpmSel)
if (lpmSel == DEEPSLEEP)
sleepMode = CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);
blessState = CyBle_GetBleSsState();
interruptStatus = CyEnterCriticalSection();
if(sleepMode == CYBLE_BLESS_DEEPSLEEP)
if(blessState == CYBLE_BLESS_STATE_ECO_ON || blessState == CYBLE_BLESS_STATE_DEEPSLEEP)
UART_UartPutString("Entering Deep Sleep...");
else if (blessState != CYBLE_BLESS_STATE_EVENT_CLOSE)
I have the project attached in addition to the above code block. Any assistance would be appreciated!