2 Replies Latest reply on Mar 29, 2016 7:25 AM by user_34551312

    No Deep Sleep when Ble connected to iPhone5

    user_34551312

      I'm Using a CYBLE-022001 module and trying to keep the current consumption down to a minimum.

         

      I noticed higher than normal current levels when connecting to the module using an iPhone5. The behavior is not apparent when using an iPad, an Android phone or the CySmart App on a PC.

         

      When I connect with the iPhone the BLESS will transition in and out of DeepSleep for the first few events and then refuses to go back into DeepSleep for up to a minute and then at random decides to drop back into DeepSleep as it should, just waking at each connection event.

         

      For an iPad, Android and CySmart on PC the following are a typical event logs:

         

      ** CySmart 1.2 **

         

      GATT_CONNECT_IND
      GAP_DEVICE_CONNECTED
      L2CAP_CONN_PARAM_UPDATE_RSP (ACCEPT)
      GATTS_XCNHG_MTU_REQ
      GAP_CONNECTION_UPDATE_COMPLETE
      ....
      GATTS_READ_CHAR_VAL_ACCESS_REQ

         


      ** iPad **

         

      GATT_CONNECT_IND
      GAP_DEVICE_CONNECTED
      GATTS_XCNHG_MTU_REQ
      L2CAP_CONN_PARAM_UPDATE_RSP (ACCEPT)
      HCI_STATUS (Error 04 - PAGE TIMEOUT)
      GAP_CONNECTION_UPDATE_COMPLETE
      ....
      GATTS_READ_CHAR_VAL_ACCESS_REQ
       

         

       

         

      The iPhone typically produces an event log as follows:

         

      GATT_CONNECT_IND
      GAP_DEVICE_CONNECTED
      GATTS_XCNHG_MTU_REQ
      L2CAP_CONN_PARAM_UPDATE_RSP (ACCEPT)
      HCI_STATUS (Error 04 - PAGE TIMEOUT)
      ....
      GATTS_READ_CHAR_VAL_ACCESS_REQ
       

         

      Notably the iPhone connection doesn't include the 'Connection Update complete' event and if I suppress the connection interval update, the problem doesn't arise with the iPhone.

         

      A common DeepSleep lockout occurs shortly after the L2CAP_CONN_PARAM_UPDATE_RSP (ACCEPT) event occurs as with all of the clients but doesn't return to normal in the case of the iPhone, presumably due to the lack of GAP_CONNECTION_UPDATE_COMPLETE event?

         

      Also with iOS it seems that the Page Timeout error occurs in both cases. I am not sure what this is referring to unless its the lack of connection update response in the case of the iPhone but doesn't seem to be a problem for the iPad connection??

         

      Just to add to the confusion I can sometimes get the iPhone to connect without the DeepSleep problem when initially powering up the ez-ble module!

         

      The connection parameters I am trying to use are shown below but have tried many other combinations, keeping within the apple guidelines:

         

      CYBLE_GAP_CONN_UPDATE_PARAM_T connParamsSlow =
      {
          152,                /* Minimum connection interval - 152 x 1.25 = 190 ms */
          168,                /* Maximum connection interval - 168 x 1.25 = 210 ms */
          0,                  /* Slave latency - 0 */
          200                 /* Supervision timeout - 200 x 10 = 2000 ms */
      };

         

      I was originally using the BLE component v2.20 but updated it to V2.30 without any improvement.

         

      Can anyone shed light onto what I am seeing here and offer a possible workaround to get the module to go back into DeepSleep correctly?

        • 1. Re: No Deep Sleep when Ble connected to iPhone5
          vavc

          Hi Dan,

             

          1) Update the component to BLE 3.1 . it solves the low power mode issue. In the previous versions of stack, when there is any connection update process or channel map process is going on , device doesn't go to deepsleep until the parameters are updates.

             

          2) Connection update process won;t get started immediately once peripheral gets L2Caap update acceptance.

             

          After sending L2Cap update response, central will check the new connection parameters. if the parameters are as per spec, then link layer of central send LL_CONN_UPDATE_REQ command to peripheral. In this command it will mention the new connection parameters and the event counter from which the new parameters has to be used. The event counter from which it has connection parameters has to be update should be atleast 6 event more to compared to the current connection event counter. Central can send any value >=6. 

             

          Read the registers 

             

           BLE_BLELL_CONN_CE_COUNTER and 

             

          BLE_BLELL_CONN_CE_INSTANT (refer psoc 4 ble register trm for details about these registers http://www.cypress.com/file/135861/download)

             

           

             

          in the CYBLE_EVT_GAP_CONNECTION_UPDATE_COMPLETE event. If these are same then iphone5 might be sending a value which is grater than 6 which causes this delay.

             

          You can also capture the air log to find the exact behavior of iphone5.

             

           

             

          Regards,
          Vikas

          • 2. Re: No Deep Sleep when Ble connected to iPhone5
            user_34551312

            Hi Vikas,

               

            Thanks for the update.

               

            If you have kept track of the addition info I added to the support case I opened, you will know the deep sleep issue has gone away which I am very pleased about.

               

            In the screenshots I provided, the CYBLE_EVT_GAP_CONNECTION_UPDATE_COMPLETE event appears to be received after 55 to 60 seconds and the new connection interval comes in to play some 200ms later.

               

            I suppose the big question is - why is the phone waiting so long to send back the agreed connection parameters to the peripheral so it can complete the update?

               

            I'll try and get hold of a sniffer to see exactly what the timing is between the two devices.

               

            Regards,

               

            Dan.