1 Reply Latest reply on Feb 9, 2017 4:49 AM by hima

    CyBle_GattsNotification overruns

    bri_2235981

      I'm implementing a GATT server on a PSoC 4 BLE.

         

      I'm investigating the usage of CyBle_GattsNotification(), and the proper approach to send multiple notifications in series.  I plan on using this to send a short burst (several seconds) at maximum bandwidth, while inbound GATT writes are occurring at the same time (but at a low bandwidth) I have not been able to find any documentation on this.

         

      I have seen a couple approaches when using CyBle_GattsNotification().  One in the Cypress example project Day042_PSoC_4_BLE_Frequency_Measurement, is to capture the busy status via a BLE event:

         
          

      case CYBLE_EVT_STACK_BUSY_STATUS:
      /* This event is generated when the internal stack buffer is full and no more
      * data can be accepted or the stack has buffer available and can accept data.
      * This event is used by application to prevent pushing lot of data to stack. */
      /* Extract the present stack status */
      busyStatus = * (uint8*)eventParam;

         
         

      and then use that status before writing notifications with:

         
          

      if(busyStatus == CYBLE_STACK_STATE_FREE)
      {
      ...
      /* Report data to BLE component for sending data by notifications*/
      CyBle_GattsNotification(connectionHandle,&notificationHandle);
      }

         
         

      The other approach, which perhaps is equivalent, is in example project Day024_Throughput:

         
          

      /* Send new data only when the previous data has gone out,
      * which is indicated by Stack being Free.
      */
      if(CyBle_GattGetBusStatus() == CYBLE_STACK_STATE_FREE)
      {
      SendNotification();
      }

         
         

      (Note: there appears to be a typo in the above function, and it has been deprecated in favor of the more applicable name that uses "Busy" not "Bus").  However, the above function appears to be undocumented (Bus or Busy versions) - at least, it's not in the BLE component PDF (BLE_v1_0_001-91490_B.pdf).

         

      What is the best approach for sending out multiple notifications from a GATT server to client?  What if there may be concurrent GATT writes?  Can the stack be free but then a notification still fail because some inbound (GATT write) BLE traffic occurs?  Any app notes or other documentation on this?

         

      Thanks!

         

      Brian

        • 1. Re: CyBle_GattsNotification overruns
          hima

          Hello,

             

          In case of notifications, the packet will be usually transmitted. In case of errors the Link layer tries to retransmit the packet again.There is a flow control mechanism implemented in the Link layer. This will make sure that packet will be re-transmitted in case of number mismatch. But please note that the notification will not a get response back.

             

          If you need a response back then you need to use indication instead of notification.

             

          Thanks,

             

          Hima