4 Replies Latest reply on Sep 15, 2019 12:14 PM by PY_21

    EZ-BLE-Proc not detecting broken link with other BLE device

    JiWa_1379161

      There are two EZ-BLE modules in the system design. One acts as a peripheral and the other acts as a central device. The central device uses the BLE stack to verify connection and if it is lost, the central device will shut off. What is happening but on very rare occasion, the link is broken between central and peripheral but the central never detects it and continues to run thinking it is connected. Has anyone seen this problem or know what can be done. It is causing significant issues with customers.

       

      The devices work great 99% of the time. The peripheral is typically powered off and the central device detects this, then powers off itself because the link is broken from the power down. In the situation described, both units are running and for whatever reason the BLE link between the two is broken possibly by another strong BLE or radio signal. The peripheral detects the link being gone and goes into advertise mode however, the central device keeps running thinking it is still connected

        • 1. Re: EZ-BLE-Proc not detecting broken link with other BLE device
          PY_21

          Hello,

           

          Please check the below points in your central device:

           

          1. Please make sure that the BLE subsystem (BLESS) interrupt has the highest priority i.e., the priority should be 0.

          2. Make sure that CyBle_ProcessEvents is called at regular intervals in the firmware. If a custom function consumes more time for execution, please call CyBle_ProcessEvents inside it.

          3. If you have any interrupt routine in your code then don't write big code inside ISR. Instead, set a variable inside ISR and check the variable status and call the function in main loop.

          4. Please refer to the ECO capacitor trim values for your EZ BLE module in this KBA link.

           

          Please check the disconnection reason in your peripheral device. The parameter returned with the event "CYBLE_EVT_GAP_DEVICE_DISCONNECTED" contains a pointer to the reason for disconnection. In the firmware, you can get the event parameter value from the CYBLE_EVT_GAP_DEVICE_DISCONNECTED event as follows:

          printf("Error code is: 0x%x \r\n", *(uint8 *) eventParam);

          Please check the error code in the BLE_Stack.h file in project or find the corresponding description from the "HCI error commands" section in the BLE Core Specifications in version 4.2, vol2, Part D, Section 1.3: List of error codes.

           

          Thanks,

          P Yugandhar.

          1 of 1 people found this helpful
          • 2. Re: EZ-BLE-Proc not detecting broken link with other BLE device
            JiWa_1379161

            Hi

             

            Thank you for the response. I did update the priority levels as they were all set to 3 (two gpio, BLE and ADC). The calling of CyBle_ProcessEvents is called many times especially in long loops.

             

            Non of the GPIO IRQ routines call anything else, they are just set a flag and return to main loop to be processed. However, there is one item I didn't mention in my thread. After 10 seconds of inactivity, I put the radio and MCU to sleep. At some period, the device wakes up and then goes back to sleep. I am assuming this wakeup is coming from the BLE stack to maintain connectivity to the peripheral. When it wakes up, it goes through the main loop which does check CyBle_ProcessEvents. Is there anything that I need to do in this sleep mode to ensure a disconnect is detected?

             

             

            Here is my sleep routine.

             

             

            void HandleLowPowerMode(void)

            {

            #ifdef ENABLE_LOW_POWER_MODE

            /* Local variable to store the status of BLESS Hardware block */

            CYBLE_LP_MODE_T sleepMode;

            CYBLE_BLESS_STATE_T blessState;

             

            /* 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;

                   

                    /* Check the Status of BLESS */

            blessState = CyBle_GetBleSsState();

                    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)&& (CyBle_GetState() != CYBLE_STATE_DISCONNECTED))

                {

                   

                            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();

                }

            }

             

            CyGlobalIntEnable;

             

             

             

            #endif

            }

             

            Thanks JIm

            • 3. Re: EZ-BLE-Proc not detecting broken link with other BLE device
              PY_21

              Hello Jim,

               

              Could you please share your complete project so that we can check at our end.

               

              Thanks,

              P Yugandhar.

              • 4. Re: EZ-BLE-Proc not detecting broken link with other BLE device
                PY_21

                Hello Jim,

                 

                Could you please share your complete project so that we can check at our end.

                 

                Thanks,

                P Yugandhar.