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

pc-ble-driver: sd_ble_gattc_read() why length is (ATT-1) instead (ATT-3) ?

Hi 
I use nrf-ble-driver ver.4.1.1 with PCA10031 dongle (nRF51844 chip on board) and "connectivity_4.1.1_1m_with_s130_2.0.1.hex" firmware for that dongle. in this case ATT_MTU = 23.

In description of function sd_ble_gattc_read() says: 
"If the Characteristic or Descriptor to be read is longer than ATT_MTU-1, this function must be called multiple times with appropriate offset to read the complete value."

Its all ok and work fine, but I have a stupid question: why ATT_MTU-1  but not ATT_MTU-3 ?

In peripheral I have characteristic 23 bytes len and really after call 2 times an sd_ble_gattc_read(),  I receive first 22 bytes and second 1 bytes in 2 packets. in other words I receive all data, but I assumed that first packet should be 20 bytes len (ATT_MTU-3) and second packet = 3 bytes len.

Continuing this one more question: when I enable notification for this characteristic, on BLE_GATTC_EVT_HVX event I receive only 20 bytes and can't get more, but if to follow the logic of ATT_MTU description, I have to receive 22 bytes.

Tell me please, where could I get confused?

Thanks.

Parents
  • I will answer myself, maybe someone will help:

    In core spec. Vol.3 Part F, 3.4.4.6 "Read BLob Responce" in Table 3.2 we see format of response packet and really attribute value = att_mtu-1 because service data (opcode) have len = 1.

    And about notification: In core spec. Vol.3 Part F, 3.4.7.1 "Handle Value Notification" in Table 3.34 we see that service data have 3 bytes len (opcode - 1byte  and handle - 2 bytes). And If the attribute value is longer than (ATT_MTU-3) octets, then only the first (ATT_MTU-3) octets of this attributes value can be sent in a notification.

Reply
  • I will answer myself, maybe someone will help:

    In core spec. Vol.3 Part F, 3.4.4.6 "Read BLob Responce" in Table 3.2 we see format of response packet and really attribute value = att_mtu-1 because service data (opcode) have len = 1.

    And about notification: In core spec. Vol.3 Part F, 3.4.7.1 "Handle Value Notification" in Table 3.34 we see that service data have 3 bytes len (opcode - 1byte  and handle - 2 bytes). And If the attribute value is longer than (ATT_MTU-3) octets, then only the first (ATT_MTU-3) octets of this attributes value can be sent in a notification.

Children
No Data
Related