4

After establishing a connection with a CC2652 BLE Peripheral device, an Android app I'm using sends an MTU update request

requestMtu (65)

Does this update the MTU size for outgoing data(Android App) only? Or should I be able to now receive notifications of size up to 65 bytes?

I am able to only receive notifications of size less than 20 bytes, even after requesting the MTU update.

P.S: I have verified that the same peripheral device can send notifications of size greater than 20 bytes to another CC2652 BLE Central device.

4
  • You may be running up against limitations originating in the (BLE 4.0) spec that would require switching to a multi-packet transfer. Typically things that stream data through characteristic change notifications only move 20 bytes per iteration. Commented Mar 15, 2019 at 17:31
  • 2
    Have you checked the resulting mtu in the onMtuChange callback? Anyway, even if you have a large mtu the sending device can of course still send how small packets it wants.
    – Emil
    Commented Mar 15, 2019 at 18:38
  • 1
    You also need to ensure that the remote device can support attributes that are larger than 20 bytes. If the other device only has data that are in 20 bytes chunk, you will always receive 20 bytes even if the ATT_MTU is +240 bytes. Commented Mar 16, 2019 at 10:45
  • Do you have a Bluetooth sniffer? Analyzing the traffic between both CCs would be interesting.
    – maze
    Commented Mar 27, 2019 at 9:36

1 Answer 1

2

We also had this issue in a project and found out that normal data transfer is affected by the MTU size while the size of notifications stays at 20 bytes.

In the bluetooth specification Vol 3, Part F, Section 3.4.7.1 is stated (thanks comment from Emil):

A server can send a notification of an attribute’s value at any time. Size of Attribute Value is 0 to (ATT_MTU-3)

But below the table is also stated:

Note: for a client to get a long attribute, it would have to use the Read Blob Request following the receipt of this notification.

It seems a bit confusing to me. What is meant by "long"? Longer than default MTU size? Or longer than negotiated MTU size?

At the end we tried but didn't get it working. We now use the notification as trigger and then our app needs to actively read the characteristic.

Note that on Android you also need to set the MTU size actively from your app. Otherwise the phone will stay on 20 byte. iPhone does this automatically.

6
  • 2
    No this is incorrect. "It is also stated in the BT spec somewhere." Please pinpoint this information and read it out before assuming something. If you read section 3.4.7.1 in the Attribute Protocol (ATT) chapter, then you will clearly see that the notified value is between 0 and (ATT_MTU-3) bytes. So if you have an MTU of 515, you can send a notification of 512 bytes if you want.
    – Emil
    Commented Mar 27, 2019 at 12:55
  • Thank you. I will correct my entry and have a look at the spec again.
    – maze
    Commented Mar 27, 2019 at 13:13
  • If I read Vol 3 Part F section 3.4.7.1 I also see that there is stated: "Note: For a client to get a long attribute, it would have to use the Read Blob Request following the receipt of this notification.". This the behaviour I described above I think.
    – maze
    Commented Mar 27, 2019 at 14:30
  • "Long" means longer than can be transferred in a single packet due to the current MTU. So if the current MTU is 103, a "long" attribute here means an attribute longer than 100 bytes.
    – Emil
    Commented Mar 27, 2019 at 16:48
  • Or actually, per 3.2.9, a long attribtue is an attribute that is larger than (ATT_MTU-1) bytes. But obviously that relates to the Read Request since there a value can be up to ATT_MTU-1. But for notifications I would say a "long attribute" is an attribute longer than ATT_MTU-3 since that makes most sense.
    – Emil
    Commented Mar 27, 2019 at 16:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.