HCI_UART: Data Length Extension on NRF52840 make an error #ble #nrf52840 #uart #hci


Nico.Platen@...
 

1.       Overview

1.1.   Hardware

-       nRF52840 DK (PC10056)

-       nRF52840 Module (u-blox NINA-B302)

1.2.   Software

1.2.1.   nRF52840 DK

-       zephyr 1.9.2

-       HCI_UART Example

-       nrf5.conf:

o   +CONFIG_BT_CTLR_TX_BUFFER_SIZE=251

o   +CONFIG_BT_RX_BUF_LEN=258

o   +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251

o   (found in https://lists.zephyrproject.org/g/users/topic/data_length_extension_on/23297993?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,60,23297993)

1.2.2.   nRF52840 Module

-       Application created with Nordic SDK

1.2.3.   PC

-       Ubuntu 16.04

-       Bluez 5.48

-       Tools: btattach, gatttool

o   btattach –B /dev/ttyACM0 –S 1000000

o   gatttool –t random –b d8:74:5d:31:a7:73 –I

2.       Challenge

Attempting to use Data Length Extension (DLE) and set the message size to 247 bytes.

3.       Background

On the nRF52840 Module is a adapted Nordic example, with working DLE (tested with another BLE Dongle [no HCI])

For the first test, I use the btattach and gatttool tools for the communication. The normal communication with the default 27 bytes is working. In the next step (using DLE), the MTU Change Request is send, but never set. The transfer is with the default 27 bytes; see btmon log.

In the LL_LENGTH_REQ and LL_LENGTH_RSP both the RX/TX octets are 251 and in the LL_FEATURE_REQ and LL_FEATURE_RSP the DLE is true. Only the Sent Error Response - Request Not Supported shows that there is an error, but I down now why; see btmon log or Wireshark table.

4.       Info

4.1.   hciconfig

hci0:   Type: Primary  Bus: UART

        BD Address: E8:39:01:20:E0:39  ACL MTU: 251:7  SCO MTU: 0:0

        UP RUNNING

        RX bytes:252 acl:0 sco:0 events:19 errors:0

        TX bytes:139 acl:0 sco:0 commands:19 errors:0

        Features: 0x00 0x00 0x00 0x00 0x60 0x00 0x00 0x00

        Packet type: DM1 DH1 HV1

        Link policy:

        Link mode: SLAVE ACCEPT

 

4.2.   Wireshark (On Air)

No.

Time

Delta time (start to start)

Delta time (end to start)

Source

Destination

Protocol

Length

Info

11089

351.198.475

502

150

e8:39:00:20:e0:39

d8:74:5d:31:a7:73

LE LL

60

CONNECT_REQ

11091

351.199.263

230

150

Slave

Master

ATT

33

Rcvd Exchange MTU Request, Client Rx MTU: 247

11092

351.299.875

49769

49633

Master

Slave

LE LL

35

Control Opcode: LL_FEATURE_REQ

11093

351.300.528

302

150

Slave

Master

LE LL

35

Control Opcode: LL_LENGTH_REQ

11094

351.301.070

49697

49545

Master

Slave

LE LL

35

Control Opcode: LL_LENGTH_RSP

11097

351.403.509

230

150

Slave

Master

LE LL

35

Control Opcode: LL_FEATURE_RSP

11098

351.403.923

49768

49616

Master

Slave

ATT

35

Sent Error Response - Request Not Supported, Handle: 0x0000 (Unknown)

11288

356.215.909

230

150

Slave

Master

L2CAP

42

Connection Parameter Update Request

11289

356.216.315

49769

49561

Master

Slave

LE LL

38

Control Opcode: LL_CONNECTION_UPDATE_REQ

11291

356.217.089

230

150

Master

Slave

L2CAP

36

Connection Parameter Update Response (Accepted)

11292

356.318.420

49441

49281

Master

Slave

L2CAP

36

Connection Parameter Update Response (Accepted)

 

Frame 11098: 35 bytes on wire (280 bits), 35 bytes captured (280 bits) on interface 0

Nordic BLE Sniffer

Bluetooth Low Energy Link Layer

    Access Address: 0x59062c3c

    [Master Address: e8:39:00:20:e0:39 (e8:39:00:20:e0:39)]

    [Slave Address: d8:74:5d:31:a7:73 (d8:74:5d:31:a7:73)]

    Data Header: 0x0902

        .... ..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: 9

    [L2CAP Index: 1]

    CRC: 0xda49fb

Bluetooth L2CAP Protocol

Bluetooth Attribute Protocol

    Opcode: Error Response (0x01)

        0... .... = Authentication Signature: False

        .0.. .... = Command: False

        ..00 0001 = Method: Error Response (0x01)

    Request Opcode in Error: Exchange MTU Request (0x02)

        0... .... = Authentication Signature: False

        .0.. .... = Command: False

        ..00 0010 = Method: Exchange MTU Request (0x02)

    Handle in Error: 0x0000 (Unknown)

    Error Code: Request Not Supported (0x06)

    [Request in Frame: 11091]

 

0000  14 1c 00 02 5f 86 06 0a 03 0b 3c 04 00 d0 c1 00   ...._.....<.....

0010  00 3c 2c 06 59 02 09 05 00 04 00 01 02 00 00 06   .<,.Y...........

0020  5b 92 df                                          [..

 

4.3.   Btmon

MTU change:

> ACL Data RX: Handle 0 flags 0x02 dlen 7                  #15 [hci0] 17.474908

      ATT: Exchange MTU Request (0x02) len 2

        Client RX MTU: 247

> HCI Event: Command Status (0x0f) plen 4                  #16 [hci0] 17.476373

      LE Read Remote Used Features (0x08|0x0016) ncmd 1

        Status: Success (0x00)

> HCI Event: LE Meta Event (0x3e) plen 11                  #17 [hci0] 17.570383

      LE Data Length Change (0x07)

        Handle: 0

        Max TX octets: 251

        Max TX time: 2120

        Max RX octets: 251

        Max RX time: 2120

> HCI Event: LE Meta Event (0x3e) plen 12                  #18 [hci0] 17.622330

      LE Read Remote Used Features (0x04)

        Status: Success (0x00)

        Handle: 0

        Features: 0x25 0x49 0x00 0x00 0x00 0x00 0x00 0x00

          LE Encryption

          Extended Reject Indication

          LE Data Packet Length Extension

          LE 2M PHY

          LE Coded PHY

          Channel Selection Algorithm #2

< ACL Data TX: Handle 0 flags 0x00 dlen 9                  #19 [hci0] 17.622779

      ATT: Error Response (0x01) len 4

        Exchange MTU Request (0x02)

        Handle: 0x0000

        Error: Request Not Supported (0x06)

> HCI Event: Number of Completed Packets (0x13) plen 5     #20 [hci0] 17.672283

        Num handles: 1

        Handle: 0

        Count: 1

 

Data send:

< ACL Data TX: Handle 0 flags 0x00 dlen 5                 #73 [hci0] 546.735550

      ATT: Handle Value Confirmation (0x1e) len 0

> ACL Data RX: Handle 0 flags 0x02 dlen 27                #74 [hci0] 546.736425

      ATT: Handle Value Notification (0x1b) len 22

        Handle: 0x001d

          Data: 00000000fff870fff7dafff792fff7abfff828ff

> ACL Data RX: Handle 0 flags 0x02 dlen 27                #75 [hci0] 546.736524

      ATT: Handle Value Notification (0x1b) len 22

        Handle: 0x001d

          Data: 10000000f8effff9d0fffaa9fffb69fffc02fffc

 

5.       Question

Are in the Zephyr firmware other option to set the max DLE value?

What means the error Message (Frame 11098)? Are there more information, except that it does not work.

Is there a Project working with the nrf52840 with DLE?

Perhaps it is an issue in the bluez config, can be?


Thanks for help.

Join users@lists.zephyrproject.org to automatically receive all group messages.