Data length update not correct.

Hello DevZone,

I am using a nRF52840 with sdk 17.0.2 with Windows 10

I am trying to setup a connection to my Windows PC but I noticed data fragmentation and a queue buildup.

I changed the data length and MTU in the sdk config, data length to 251 and MTU to 500.

I am trying to transmit roughly 250 bytes each connection interval at 10 ms interval. Most of the times this works perfectly out of the box but sometimes I notice a buildup in the notification queue.

After using the nRF BLE sniffer and wireshark I saw that in the data length negotiation, the correct amount of bytes is negotiated (251) but the amount of time I get does not.

My request is RX 251B & 2120us TX 251B & 2120us and my response is TX 251B 9576us RX 251B 328us.

I do not know why Im only allowed to have 328us communication time to transmit my payload. Seeing the datastream in wireshark I notice that my 250 byte payload is fragmented in 4 frames to not exceed this time.


I started my project based on the blinky example so I thought nothing further about setting up the Bluetooth connection correctly.
I also noticed other BLE Periphertal examples having the same issue where the request is done for  RX 251B & 2120us TX 251B & 2120us  and the response always has the 328us time, limiting my thoughput.

This same behavior is seen on Windows 11, android phone and a macbook. Only Linux allows our request.


Is there a configuration set I am missing or how do I tackle this.

Kind regards

Parents
  • Hi

    Most devices don't accept Attribute data sizes larger than 244 I'm afraid, so setting the NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 247 will make room for the 3 byte ATT header and also allow you to send the 244 bytes of attribute data.

    Depending on the BLE stack on your PC, it could also be the case that it only supports up to 27 bytes of attribute data. What data length negotiation issues are you seeing exactly?

    Best regards,

    Simon

Reply
  • Hi

    Most devices don't accept Attribute data sizes larger than 244 I'm afraid, so setting the NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 247 will make room for the 3 byte ATT header and also allow you to send the 244 bytes of attribute data.

    Depending on the BLE stack on your PC, it could also be the case that it only supports up to 27 bytes of attribute data. What data length negotiation issues are you seeing exactly?

    Best regards,

    Simon

Children
Related