2023-12-08 11:48 AM
I'm working on a BLE application which uses a pair of BLE characteristics to transfer packets of data (similar to a cable replacement service). I believe I have followed the recommendations in AN5289 8.6.9 to mazimize throughput.
When I read packets from the STM32WB device from a PC, using the 1M PHY, I get a transfer rate of about 40 kB/s, which seems pretty good. Looking at the transfer in Wireshark, I get the capture attached here as "read.7z".
However, when I write packets to the STM32WB device from a PC, I get a transfer rate of about 2 kB/s. The Wireshark capture for this transfer is attached as "write.7z".
On the central side, I'm using a TP-Link USB500 Bluetooth adapter and a Python script using Bleak for the BLE interface. I've run the script both on Windows 10 and on Ubuntu 22.04 with the same results.
On the device side, I'm using an STM32WB5MMG with a custom CRS profile.
Looking at messages when the connection is being established, the adapter requests an MTU of 527, and the STM32WB responds with an MTU of 250. The adapter sends a length request with RX/TX octets set to 251 and RX/TX time set to 2120 us, and the STM32WB responds with exactly the same parameters (set using `hci_le_set_data_length` when the connection is being established).
However, looking at the data transfer messages, when reading, we see notifications with length 247, with about 16 of these sent during what I believe is a 60 ms connection interval. When writing, we see this data broken down into L2CAP fragments no larger than 54 bytes, with only 7 of these being sent in a 60 ms connection interval.
I'm at a bit of a loss to explain why this is--given the parameters I see exchanged when the connection is being established, I would have thought the read and write would be similar. I'm hoping someone here can help me understand why the "write" packets are being broken down into smaller parts.
Thank you!
2024-01-08 02:45 AM
Hello @crwper
I suggest you to
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-01-08 08:18 AM
Thanks for your reply.
I have confirmed that CFG_BLE_MAX_ATT_MTU is set to 250 in app_conf.h. This agrees with what we see in the Wireshark output. As I mentioned previously, we can see in those logs that the adapter on my PC requests an MTU of 527, and the STM32WB responds with an MTU of 250.
What additional details would the Ellisys unit provide that you think would be helpful here?