Hello,
I am creating a read-only characteristic with sd_ble_gatts_characteristic_add (specifically, characteristic_add). The value is 31 bytes.
On a Read Request, it is sending 22 bytes, and Wireshark gives the full packet a length of 27 (Nordic nRF Sniffer on PCA10040).
The debug output for the connect and bonding is:
<debug> nrf_sdh_ble: BLE event: 0x10.
<debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x4.
<debug> nrf_ble_gatt: Updating data length to 251 on connection 0x4.
<debug> nrf_sdh_ble: BLE event: 0x13.
<debug> peer_manager_handler: Event PM_EVT_CONN_SEC_START
<debug> peer_manager_handler: Connection security procedure started: role: Peripheral, conn_handle: 4, procedure: Bonding
<debug> peer_manager_handler: Event PM_EVT_CONN_SEC_PARAMS_REQ
<debug> peer_manager_handler: Security parameter request
<debug> nrf_sdh_ble: BLE event: 0x24.
<debug> nrf_ble_gatt: Data length updated to 27 on connection 0x4.
<debug> nrf_ble_gatt: max_rx_octets: 27
<debug> nrf_ble_gatt: max_tx_octets: 27
<debug> nrf_ble_gatt: max_rx_time: 328
<debug> nrf_ble_gatt: max_tx_time: 328
<debug> nrf_sdh_ble: BLE event: 0x3A.
<debug> nrf_ble_gatt: ATT MTU updated to 23 bytes on connection 0x4 (response).
<debug> nrf_sdh_ble: BLE event: 0x1A.
<debug> nrf_sdh_ble: BLE event: 0x19.
<debug> peer_manager_handler: Event PM_EVT_CONN_SEC_SUCCEEDED
<info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 4, procedure: Bonding
<debug> peer_manager_handler: pm_peer_rank_highest() returned NRF_ERROR_NOT_SUPPORTED for peer id 0
<debug> peer_manager_handler: Event PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
<debug> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Bonding data, action: Update
<debug> peer_manager_handler: Event PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
<debug> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Local database, action: Update
<debug> nrf_sdh_ble: BLE event: 0x35.
<debug> peer_manager_handler: Event PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
<debug> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Central address resolution, action: Update
<debug> nrf_sdh_ble: BLE event: 0x55.
<debug> nrf_ble_gatt: Peer on connection 0x4 requested an ATT MTU of 525 bytes.
<debug> nrf_ble_gatt: Updating ATT MTU to 247 bytes (desired: 247) on connection 0x4.
<debug> nrf_sdh_ble: BLE event: 0x12.
<debug> nrf_sdh_ble: BLE event: 0x52.
<debug> peer_manager_handler: Event PM_EVT_LOCAL_DB_CACHE_APPLIED
<debug> peer_manager_handler: Previously stored local DB applied: conn_handle: 4, peer_id: 0
<debug> nrf_sdh_ble: BLE event: 0x12.
<debug> nrf_sdh_ble: BLE event: 0x50.
<debug> peer_manager_handler: Event PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
<debug> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Local database, action: Update
<debug> nrf_sdh_ble: BLE event: 0x12.
So you can see in the end that the ATT MTU is 247 bytes. A single packet would be 27 bytes, but it ought to fragment and chain them together.
Wireshark shows this request from Windows 8:
Bluetooth Low Energy Link Layer
Access Address: 0x50657d1d
[Master Address: Cc&CTech_8a:4b:bd (5c:f3:70:8a:4b:bd)]
[Slave Address: d0:7f:aa:59:7c:03 (d0:7f:aa:59:7c:03)]
Data Header: 0x0706
.... ..10 = LLID: Start of an L2CAP message or a complete L2CAP message with no fragmentation (0x2)
.... .1.. = Next Expected Sequence Number: 1
.... 0... = Sequence Number: 0 [OK]
...0 .... = More Data: False
000. .... = RFU: 0
Length: 7
[L2CAP Index: 92]
CRC: 0x26089e
Bluetooth L2CAP Protocol
Length: 3
CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
Opcode: Read Request (0x0a)
0... .... = Authentication Signature: False
.0.. .... = Command: False
..00 1010 = Method: Read Request (0x0a)
Handle: 0x0022 (Human Interface Device: Report Map)
[Service UUID: Human Interface Device (0x1812)]
[UUID: Report Map (0x2a4b)]
The response is:
Bluetooth Low Energy Link Layer
Access Address: 0x50657d1d
[Master Address: Cc&CTech_8a:4b:bd (5c:f3:70:8a:4b:bd)]
[Slave Address: d0:7f:aa:59:7c:03 (d0:7f:aa:59:7c:03)]
Data Header: 0x1b02
.... ..10 = LLID: Start of an L2CAP message or a complete L2CAP message with no fragmentation (0x2)
.... .0.. = Next Expected Sequence Number: 0
.... 0... = Sequence Number: 0 [OK]
...0 .... = More Data: False
000. .... = RFU: 0
Length: 27
Bluetooth L2CAP Protocol
Length: 23
CID: Attribute Protocol (0x0004)
Bluetooth Attribute Protocol
Opcode: Read Response (0x0b)
0... .... = Authentication Signature: False
.0.. .... = Command: False
..00 1011 = Method: Read Response (0x0b)
[Handle: 0x0022 (Human Interface Device: Report Map)]
[Service UUID: Human Interface Device (0x1812)]
[UUID: Report Map (0x2a4b)]
HID Report
Global item (Usage)
Global item (Logical minimum)
Global item (Logical maximum)
Global item (Report size)
Local item (Usage)
Main item (Collection)
[Malformed Packet: BT ATT]
[Expert Info (Error/Malformed): Malformed Packet (Exception occurred)]
[Malformed Packet (Exception occurred)]
[Severity level: Error]
[Group: Malformed]
As a result Windows only receives part of the Report Descriptor. Why might it not be fragmenting and reassembling?
Thanks!
James