3 Replies Latest reply on Jul 19, 2018 8:25 PM by ssl.huynh_3143771

    Bluetooth Fails to Advertise While Entering Deep Sleep

    ssl.huynh_3143771

      Hi there,

       

      We are having issues with bluetooth advertisement. To preface, we are using single core (cm0+) for Bluetooth, and have registered a callback function for the AppHost using Cy_BLE_RegisterAppHostCallBack() which Processes Events. As suggested in this discussion, Ble connection stops working after 'Max num. of ble connections' times , we have modified the cy_ble_hal_int.c file so that the callback is called during certain events.


      Bluetooth can start advertisement, time out, restart, and so on successfully as long as no device has ever been connected. However, after the first connection proceeded by the first disconnection, once advertising times out it fails to restart again. We can confirm it as an issue with the device entering deep sleep while bluetooth is advertising since the issue doesn't occur when we put it into sleep mode instead. Our low-power code is as follows:

       

      for(;;)

      {

           if(!Cy_SysPm_Cm0IsLowPower())

          {

              Cy_SysPm_EnterLowPowerMode();

          }

         

          cy_en_ble_bless_state_t bleSsState = Cy_BLE_StackGetBleSsState();

         

          if(bleSsState == CY_BLE_BLESS_STATE_ACTIVE || bleSsState == CY_BLE_BLESS_STATE_ECO_STABLE)

          {

              cy_en_syspm_status_t apiResult = Cy_SysPm_Sleep(CY_SYSPM_WAIT_FOR_INTERRUPT);

          }

          else

          {       

              cy_en_syspm_status_t apiResult = Cy_SysPm_DeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT);

          }   

      }

       

      We are wondering what is the problem? Also, what is the best way to debug and stress test functionalities with deep sleep? In debugger mode, the described problem does not occur because the device does not enter deep sleep as it would during regular programming. Thank you.