This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Nr of Packets available

I am modifying the BLE UART example, client and server, in order to have a higher throughput. I have selected that the connection interval is 7.5ms with a total number of 50 bytes to be transmitted.

On the BLE-NUS example, when I try to modify NRF_BLE_GATT_MAX_MTU_SIZE (currently 158 bytes) the program gives me an error, where can I change this without getting an error?

I am using the function ble_nus_string_send() to do the transmission,does this function split the message already in different packets?

If NRF_BLE_GATT_MAX_MTU_SIZE  is 158? How many packets are available there? 

Would it be better if I reduce the NRF_BLE_GATT_MAX_MTU_SIZE to 23? How many packets would I have there? This is settled by S132 no?

I am sorry for all the questions!!

Thank you in advance!

  • This link could be helpful to configure a greater NRF_BLE_GATT_MAX_MTU_SIZE than the default value of 23 bytes. I am assuming you are using SDK 14.2

    Take a look at the ble_nus_string_send() function in ble_nus.c. You notice that there is an if statement which compares the string length (i.e. *p_length) to the BLE_NUS_MAX_DATA_LEN, which is defined as 20 bytes if you use the default NRF_BLE_GATT_MAX_MTU_SIZE. uart_event_handle() is the event handling function defined in main.c that calls ble_nus_string_send() in the peripheral UART example & it is the event handling function that makes sure that the string will not be longer than the NRF_BLE_GATT_MAX_MTU_SIZE.

    Difficult to say how many packets are available if you set the NRF_BLE_GATT_MAX_MTU_SIZE to 158. It is definitely less than the max of 6 packets per connection interval using a connection interval of 7.5 ms in the softdevice S132 v5.1 (see Table 27 in the softdevice specs). You should theoretically get a greater throughput if you increase the NRF_BLE_GATT_MAX_MTU_SIZE because you will have more space to send useful data because you do not lose as much space to the header bytes in NRF_BLE_GATT_MAX_MTU_SIZE. Beware that if you have a lot of packet loss due to packet collisions from other Bluetooth devices, your throughput might be greater by decreasing the NRF_BLE_GATT_MAX_MTU_SIZE. You will have to test this to see how many packets you can send per connection interval.

    I already answered above how many packets you can theoretically send if you set NRF_BLE_GATT_MAX_MTU_SIZE to 23 in the paragraph above. Again, test this to see how many packets you can send. Yes, this is settled by the S132 softdevice. 

    Last but not least, take a look at the throughput demo, which gives a good explanation of how to achieve high throughput. Hope that helps!

     

Related