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

How to receive notification with size greater than 20 bytes?

I am trying to build a BLE client on Ubuntu using bluepy (a python based BLE library) to receive BLE notification from the NRF board.

For my project, I need a package size of 60 while the maximum size of the packet I can receive is 20.

I tried to set the MTU to a higher value like 64, after that, I am able to read a package of size 60 from the package. However, the data I got from the notification is still limited at 20 bytes per packet. 

Is there anyway I can make the packet size of the notification larger?

Thanks!

Parents
  • Hi,

    If you set the ATT_MTU to 64 (3 bytes for header, 61 bytes for attribute data) you can send a single 61-byte notification to the SoftDevice, and the link layer will automatically do the fragmentation and re-assembly for you, so it looks like the notification is being sent in a single operation.

    Is the Data Length Extensions used in this project? 

    Without data length extension the maximum link layer MTU is 27 bytes, where 4 bytes are used for the L2CAP header and 3 bytes normally for the ATT header, leaving 20 bytes for user data.

    ATT_MTU has to be negotiated between the two peers, that is correct. Usually, this happens sometime after connection establishment, and the minimum supported value for the two peers will set the limit.

    For maximum throughput, you should change NRF_SDH_BLE_GAP_DATA_LENGTH to 67 (applies to SDKv15, in sdk_config.h).

    You also can see this post and the blog it links to.

    -Amanda

Reply
  • Hi,

    If you set the ATT_MTU to 64 (3 bytes for header, 61 bytes for attribute data) you can send a single 61-byte notification to the SoftDevice, and the link layer will automatically do the fragmentation and re-assembly for you, so it looks like the notification is being sent in a single operation.

    Is the Data Length Extensions used in this project? 

    Without data length extension the maximum link layer MTU is 27 bytes, where 4 bytes are used for the L2CAP header and 3 bytes normally for the ATT header, leaving 20 bytes for user data.

    ATT_MTU has to be negotiated between the two peers, that is correct. Usually, this happens sometime after connection establishment, and the minimum supported value for the two peers will set the limit.

    For maximum throughput, you should change NRF_SDH_BLE_GAP_DATA_LENGTH to 67 (applies to SDKv15, in sdk_config.h).

    You also can see this post and the blog it links to.

    -Amanda

Children
Related