3 Replies Latest reply on May 30, 2019 11:05 PM by GyanC_36

    How to properly send BLE indications after a series of fast notifications?

    DaM._2104136

      Hi,

       

      We are updating the firmware of our product that uses a BLE module (CYBLE-212019-00 / CYBLE-212020-01) connected to a host processor, controlled via EZ-serial API. In short, we have a problem when an indication is sent just after fast notifications. The indication often fails to be received on iOS or Android devices. We implemented a mechanism to delay the indication, because we suppose that the indication is sent in the same connection interval than the notifications. With a delay equals to the connection interval, the indications are successfully sent and acknowledged. Does our assumption that the indication can be sent in the same connection interval than notification is right? Is there any proper way to ensure that an indication is sent in a new connection interval (because a buffer of operations on BLE module may break the delay strategy)?

       

      In details:

      The BLE module is configured as GATT server with custom services. Notifications are sent on a characteristic at high frequency and data loss for these notifications is not a problem. The command “gatts_notify_handle” of the EZ-serial API is used for the notifications. Sometimes notifications are sent with an interval of 3 to 5 milliseconds, and since iOS and Android limit the number of transfers in a single connection interval, some notifications are lost (which is expected).

      We use indications on another characteristic for data that need to be transmitted without loss. The command “gatts_indicate_handle” is used for sending indications, and we wait until the event “gatts_indication_confirmed” (or a timeout) to send new indications or notifications. Without any delay for sending the indication after a bunch of notifications, the indication is often lost. We implemented a delay mechanism to send indications. The delay for sending an indication is set to the connection interval to avoid multiple transmissions when the indication is sent. This works correctly but seems not optimal. Hence my question, how to properly send an indication when fast notifications have been sent.

       

      Thanks,

      David

        • 1. Re: How to properly send BLE indications after a series of fast notifications?
          GyanC_36

          Hi David,

           

             There should not be any problem even if you are sending both Notification and Indication packets concurrently.  How frequently you are sending the Notification packets ? If application pushes data down to the BLE stack at a very high speed there might be a chance that the internal BLE stack buffers get filled and some data might not be proceed in lower stack layers.  For proper operation , push the application data periodically down to the stack and keep the connection interval minimum (7.5 mS).

           

          -Gyan

          1 of 1 people found this helpful
          • 2. Re: How to properly send BLE indications after a series of fast notifications?
            DaM._2104136

            Hello Gyan,

             

            Thanks for your feedback.

            For proper operation , push the application data periodically down to the stack

            I am controlling the BLE module via UART using the EZ-serial API, so I have no control on the BLE stack flow. The BLE module uses the last version of EZ-serial: V1.1.1.

             

            The problem happens when 7 or 8 notifications are pushed with a delay of ~4 ms. Then, if an indication is pushed after this series of notifications, there is a high chance that it will be lost.

             

            If it is a buffer overflow problem, I am surprised that the host processor receives no system error event from the BLE module (see “system_error” ID=2/2 in EZ-Serial API).

             

            Up to now I am relying on the response code when an EZ-serial command is sent, and I also look at error events to know if everything is handled correctly by the module. Note that I am not sending new command to the module when waiting the response code. If the module cannot buffer a notification, it seems logical that an error code is returned by the module (for instance “EZS_ERR_CORE_BUFFER_OVERFLOW” 0x0103).

             

            Should I consider that I have to control the interval between GATT commands when I communicate with the BLE module (in addition to the response mechanism that already limit the interval between commands)?

             

            Best,

            David

            • 3. Re: How to properly send BLE indications after a series of fast notifications?
              GyanC_36

              Hi David,

               

                 We get a response of EZ - Serial Command as per BLE Host Stack which pushes the application data down to BLE Controller Stack and then it goes out over the air. With EZ Serial for a reliable periodic data transfer please have an interval of at least equal to connection interval set for your BLE link.

               

               

              -Gyan

              1 of 1 people found this helpful