4 Replies Latest reply on Jun 18, 2020 11:51 PM by PY_21

    PSoC 4 BLE disconnect after 30 seconds

    DaJa_1421871

      I've got an application that communicates over BLE. It uses 2 characteristics to transfer data via notification to an iOS app. Everything connects just fine and if I let it just sit there without enabling notifications on the characteristics then it stays connected indefinitely. However, when I enable notifications, data is transmitted from the device to the app and then disconnects after exactly 30 seconds.

       

      I've read a few suggestions but none of them have worked:

       

      - Make sure the characteristic and descriptor have different UUIDs

      - Verify the BLE timing parameters match Apple's guidelines

      - Make sure the BLE interrupt is a higher priority than other system interrupts

       

      In my BLE callback I can see the error code that's returned when it disconnects. The event is CYBLE_EVT_GAP_DEVICE_DISCONNECTED and the parameter value is CYBLE_HCI_CONNECTION_TERMINATED_USER_ERROR (0x13). This error makes it sound like it's the app side that's causing the disconnect but that shouldn't be the case. I get the same behavior whether I use our custom app or a BLE debugging app (Light Blue Explorer). Both disconnect exactly 30 seconds after notifications are enabled.

       

      There's nothing in my code that happens after 30 seconds. It just keeps transmitting data indefinitely.

       

      Any guesses? Thanks.

        • 1. Re: PSoC 4 BLE disconnect after 30 seconds
          DaJa_1421871

          More data:

           

          I am only getting the disconnection when I enable notifications on the 2nd characteristic. If I only enable notifications on the first characteristic it stays connected and stream data consistently. As soon as I enable notifications on the 2nd one, whether the first one has notifications enabled or not, 30 seconds later I get a disconnect.

           

          The 2 characteristics are defined exactly the same in the BLE component. They both simply contain a single byte of data. The odd thing is that when I probe the service using Light Blue Explorer I see that the descriptor UUID for the 1st characteristic (the good one) is 0xFFF1 (length 2 bytes) when it is configured to be 0x2901 in the BLE component, and the descriptor UUID for the 2nd characteristic (the bad one) is just 0. It is also configured to be 0x2901 in the BLE component.

           

          I'm really confused by this. The descriptor UUID for the 1st characteristic is appearing the same as the characteristic's UUID. I don't know if that matters but I can't explain it.

          • 2. Re: PSoC 4 BLE disconnect after 30 seconds
            PY_21

            Hello,

             

            If possible, could you please share your complete project so that we can check at our end ? If not, please share the ble configuration. In the BLE component, use the Save Configuration button to save the current configuration as shown in attached image.

             

            Thanks,
            P Yugandhar.

            • 3. Re: PSoC 4 BLE disconnect after 30 seconds
              DaJa_1421871

              See attached BLE config file.

               

              I have sort of moved on but I'd still like to know the answer to this problem. I changed my project to use a single BLE characteristic to transfer 2 bytes of data rather than using 2 characteristics to transfer 1 byte each. It works, I can enable notifications on the 2-byte characteristic and transfer data indefinitely with no disconnections. The weird thing is that the 2nd characteristic still appears even though I have deleted it from the service profile as you'll see in the configuration. Not only does it still appear, but if you enable notifications on that characteristic it still causes a disconnect after 30 seconds even though no data is ever transmitted on it. Very strange.

               

              I would definitely like to understand what's going on though so let me know if you see anything in the config that looks wrong.

               

              Thanks.

              • 4. Re: PSoC 4 BLE disconnect after 30 seconds
                PY_21

                Hello,

                 

                I'm not seeing the second characteristic in your BLE configuration as shown in attached image. Could you please send some screenshots of your observations ?
                Which version of BLE component you are using ? If you are using the old version, then please upgrade to the latest version v3.65 in the PSoC Creator(In the PSoC Creator, Goto Projects ->Update components ->update BLE to v3.65).

                 

                Thanks,
                P Yugandhar.