cancel
Showing results for 
Search instead for 
Did you mean: 

how to maximize STM32WB BLE throughput

Aishwarya
Associate III

Hello friends,

I am working on STM32WB on-chip Bluetooth low energy system to transmit data from server to client using notification property.

I want to transmit 46 bytes at the rate of 500Hz without any packet loss, to achieve this I have updated the following BLE connection parameters-

  • MTU Size: 512 Bytes
  • hci_le_set_data_length: 251 Bytes with Tx time: 2120 ms
  • Connection Interval: 11.25ms
  • TX_PHY & RX_PHY: 2M
  • Tx Power: 4dBm

but I face data loss at the receiver end.

To transmit 46 bytes of data using notify, I update the p2p service and Characteristic as-

  /**

   * Peer To Peer Service

   *

   * Max_Attribute_Records = 2*no_of_char + 1

   * service_max_attribute_record = 1 for Peer To Peer service +

   *                2 for P2P Write characteristic +

   *                2 for P2P Notify characteristic +

   *                1 for client char configuration descriptor +

   *                 

   */

  COPY_P2P_SERVICE_UUID(uuid16.Char_UUID_128);

  aci_gatt_add_service(UUID_TYPE_128,

           (Service_UUID_t *) &uuid16,

           PRIMARY_SERVICE,

           8,

           &(aPeerToPeerContext.PeerToPeerSvcHdle));

  /**

   * Add LED Characteristic

   */

  COPY_P2P_WRITE_CHAR_UUID(uuid16.Char_UUID_128);

  aci_gatt_add_char(aPeerToPeerContext.PeerToPeerSvcHdle,

           UUID_TYPE_128, &uuid16,

 BA_RX_DATA_PACKET_SIZE,

           CHAR_PROP_WRITE_WITHOUT_RESP|CHAR_PROP_READ,

           ATTR_PERMISSION_NONE,

           GATT_NOTIFY_ATTRIBUTE_WRITE, /* gattEvtMask */

           10, /* encryKeySize */

           1, /* isVariable */

           &(aPeerToPeerContext.P2PWriteClientToServerCharHdle));

  /**

   *  Add Button Characteristic

   */

  COPY_P2P_NOTIFY_UUID(uuid16.Char_UUID_128);

  aci_gatt_add_char(aPeerToPeerContext.PeerToPeerSvcHdle,

           UUID_TYPE_128, &uuid16,

 249,

           CHAR_PROP_NOTIFY,

           ATTR_PERMISSION_NONE,

           GATT_NOTIFY_ATTRIBUTE_WRITE, /* gattEvtMask */

           10, /* encryKeySize */

           1, /* isVariable: 1 */

           &(aPeerToPeerContext.P2PNotifyServerToClientCharHdle));

And send data from server to client using function -

tBleStatus P2PS_STM_App_Update_Char(uint16_t UUID, uint8_t *pPayload, uint8_t length)

{

 tBleStatus result = BLE_STATUS_INVALID_PARAMS;

 switch(UUID)

 {

  case P2P_NOTIFY_CHAR_UUID:

    

   result = aci_gatt_update_char_value(aPeerToPeerContext.PeerToPeerSvcHdle,

               aPeerToPeerContext.P2PNotifyServerToClientCharHdle,

               0, /* charValOffset */

               length, /* charValueLen */

               (uint8_t *) pPayload);

   

   break;

  default:

   break;

 }

 return result;

}

I need your tips and guidance to get lossless transmission using BLE.

0 REPLIES 0