7 Replies Latest reply on Jul 15, 2015 5:21 AM by rohit.kumar

    UART - BLE project, CyBle_GattsNotification()

    tp-atec

      Hi,

         

      I'm developing an application based on this UART TO BLE BRIDGE project:

         

      http://www.cypress.com/blog/100-projects-100-days/project-020-uart-ble-bridge.

         

      When data com from the UART interface, function CyBle_GattsNotification() is used to send data to the Central device.

         

      For small frames ( tested with 15-16 bytes), it's works well.

         

      For bigger frames ( tested with 24 bytes ), CyBle_GattsNotification() return an error ( CYBLE_ERROR_INVALID_PARAMETER ).

         
            
      • My MTU is bigger than 24 ( actually 300 set on GAP settings , BLE component )
      •     
      • Data characteristic size is bigger than 24 (30)
      •    
         

      Do you have any idea about this problem ? Why i can't send more datas ?

         

       

         

      Regards,

         

      Thomas POINSOT,

         

      ATEC Electronique
       

        • 1. Re: UART - BLE project, CyBle_GattsNotification()
          rohit.kumar

          Are you using CySmart PC Tool to communicate with the BLE Pioneer Kit?

             

          If yes, then CySmart PC Tool, being the Central device, may negotiate for a smaller MTU size. You may want to try out changing the size in CySmart PC Tool GUI -> Select a BLE Dongle -> "Configure Master Settings" button -> "Others" -> GATT MTU exchange set to true with size of your choice.

          • 2. Re: UART - BLE project, CyBle_GattsNotification()
            tp-atec

            No,

               

            I'm using an android tablet with a debugger.

               

            Regards,

            • 3. Re: UART - BLE project, CyBle_GattsNotification()
              rohit.kumar

              To confirm what is the exact MTU size that is negotiated, please check the value of parameter '' which is returned as part of the 'CYBLE_EVT_GATTS_XCNHG_MTU_REQ' event received in your BLE generic event handler function. Note, this is the same function with which CyBle_Start() API would have been called in your design.

                 

              In this function, place the following case inside switch(event) :

                 

              case CYBLE_EVT_GATTS_XCNHG_MTU_REQ:
                          
                          mtuExchgParam = *(CYBLE_GATT_XCHG_MTU_PARAM_T*)eventParam;
                break;

                 

              where 

                 

              CYBLE_GATT_XCHG_MTU_PARAM_T        mtuExchgParam;

                 

              Check what is the value of 'mtuExchgParam.mtu' and whether it is above 23 bytes or not. This should give us a starting point.

                 

              In case you have a BLE sniffer, then you can directly see the MTU exchange data and the value.

              • 4. Re: UART - BLE project, CyBle_GattsNotification()
                tp-atec

                Event CYBLE_EVT_GATTS_XCNHG_MTU_REQ is never asserted. Tested with 2 different app on two different devices.

                   

                CYBLE_EVT_GATTS_XCNHG_MTU_REQ case was already présent in the code like this :

                   
                    

                   case CYBLE_EVT_GATTS_XCNHG_MTU_REQ:
                            
                            if(CYBLE_GATT_MTU > ((CYBLE_GATT_XCHG_MTU_PARAM_T *)eventParam)->mtu)
                            {
                                mtuSize = ((CYBLE_GATT_XCHG_MTU_PARAM_T *)eventParam)->mtu;
                            }
                            else
                            {
                                mtuSize = CYBLE_GATT_MTU;
                            }
                            
                            break;

                   
                • 5. Re: UART - BLE project, CyBle_GattsNotification()
                  tp-atec

                  I've added CyBle_GattcExchangeMtuReq() on the connected event. It solves the problem.

                     

                  MTU negociation doesn't occur automatically at connection...

                     

                  Regards

                  • 6. Re: UART - BLE project, CyBle_GattsNotification()
                    rohit.kumar

                    File a technical support case -

                       

                    www.cypress.com -> Design Support -> Support -> Create a Support Case -> Contact Technical Support.

                       

                    In case you have not, you will be asked to register on Cypress web site first.