BLESS Interrupt while in DeepSleep
user_503006941 Jun 21, 2017 7:20 AMThere seems to be limited information as to what the BLESS is doing while in DeepSleep. I can successfully put the BLESS into DeepSleep followed by placing the MCU into DeepSleep.
The BLE module is configured in the Central Role with a custom profile. It is connected to a peripheral device when I put both BLESS and MCU asleep. Immediately after putting the BLESS and MCU to sleep, it wakes right up. So I am not getting the very low microamps power level I am looking for.
The device is supposed to be asleep in very low power until a switch is pressed to wake it up. I can remove all external ISR's from the design and work only with the BLE to troubleshoot the problem and ensure nothing else is waking it up. All tests point to the BLESS is waking up the MCU as soon as it goes to sleep.
This is very frustrating and do not undertsand why or what I can do different. It appears that when it is connected to a peripheral, this occurs. If I try without a connection, then I get the expected results and the BLESS stays asleep. Is there a setting or missing code?
Here is the basic low power code which I see is used in multiple applications
/* Local variable to store the status of BLESS Hardware block */
CYBLE_LP_MODE_T sleepMode;
CYBLE_BLESS_STATE_T blessState;
uint8 intrStatus;
/* Put BLESS into Deep Sleep and check the return status */
sleepMode = CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);
/* Disable global interrupt to prevent changes from any other interrupt ISR */
// CyGlobalIntDisable;
intrStatus = CyEnterCriticalSection(); // disable interrupts
/* Check the Status of BLESS */
blessState = CyBle_GetBleSsState();
// isr_SW1_ClearPending();
// SW1_ClearInterrupt();
if(sleepMode == CYBLE_BLESS_DEEPSLEEP)
{
/* If the ECO has started or the BLESS can go to Deep Sleep, then place CPU
* to Deep Sleep */
if(blessState == CYBLE_BLESS_STATE_ECO_ON || blessState == CYBLE_BLESS_STATE_DEEPSLEEP)
{
CySysPmDeepSleep();
}
}
else
{
if(blessState != CYBLE_BLESS_STATE_EVENT_CLOSE)
{
/* If the BLESS hardware block cannot go to Deep Sleep and BLE Event has not
* closed yet, then place CPU to Sleep */
CySysPmSleep();
}
}
CyExitCriticalSection(intrStatus); // re-enable interrupts