MuSAELab/BLE-Toolkit-LabVIEW

Adjust GATT mtu size

Closed this issue · 5 comments

Hi guys,
is there any chance to adjust the GATT max mtu size.
I need to read more than 20ish Byte.
Dived into the SubVIs and stumbled over the ble_read_message.vi, which is pretty much the VISA read on the COM port.
Am I right on that track or is there a simpler way to get the max bytes per read?

Thanks

Hello,

The solution is to use the Read Long command instead of Read by handle. While parsing Attribute client use message ID of 0x08 instead of 0x04.
Afterwords cycle through reading on VISA com port and track packet payload size. If below 22 continue reading in a while loop. Parameters are explained on https://www.silabs.com/documents/public/reference-manuals/Bluetooth-LE-Software-API%20Reference-Manual-for-BLE-Version-1.10.pdf/ page 59.

Here are modified vi's if interested :
https://drive.google.com/file/d/1TI2hrPDVpciMO7tJ9CVEhvzHnfogAvo7/view?usp=sharing

@rcassani This could be implemented in a future release if wanted. Maybe under a dedicated function ble_read_by_handle_long.vi
Also, I found helpful to have total execution time on reading data. Device wait after reset time could be reduced from actual 8s.

Hi @CristianGlavana, thank you for the VIs and the detailed information.
I'll implement it in the next days. So far the plan is:

  1. Move the for loop to the ble_evt_attclient_attribute_value
  2. Thus no changes in ble_read_message
  3. Then ble_read_by_service_characteristic will have boolean Long? (Default false), this will be passed to ble_read_by_handle which in turn will pass it to ble_cmd_attclient_read_by_handle and to ble_rsp_attclient_read_by_handlei to select the proper MessageID (either 0x04 or 0x08).

I found helpful to have total execution time on reading data

With the modifications above the user could add their own timers before and after ble_read_by_service_characteristic

Device wait after reset time could be reduced from actual 8s.

This 8s wait was added to be extra sure the dongle is up and ready again. I think this could be an input (Default 8s).

AFAIK I don't have a BLE device to test this update in the toolkit. I wonder if you (@CristianGlavana and @Sicklicker) could test the changes once they are done.

@CristianGlavana @Sicklicker
Support for Read long is added in 1926f79.
Read long is the default and is compatible even if the attribute is shorter than 22 bytes.
Please test the release 10.0.1, and open an new Issue if there is a problem. I don't have a BLE device to test it.

@rcassani There is just a small detail, in ble_evt_attclient_attribute_value change Less Or Equal? comparison to 22 with Less?. (22 is maximal payload in long read mode)
Otherwise, on my device, everything is ok. Default reading for long values is also fine for small payloads. Payloads of 22 bytes (limit of one transition) does not cause unwanted behavior.

@CristianGlavana thanks for the observation it is now solved in 0c5b57c