hci_usb, zephyr and bluez

Hi, 

There seems to be an issue somewhere between the hci_usb sample, zephyr, and bluez on linux. It's really easy to recreate the issue for me:

  • Flash an nrf52840 dongle with the hci_usb sample
  • flash any nordic board with a ble sample like I have peripheral hr
  • connect dongle to linux host, using bluetoothctl scan and connect to the nordic board
  • Using btmon to log the initial connection, when there is NO cache (the linux host has NEVER connected to this board before), I can see it gets to the MTU negotiation and then times out, and disconnects

On second attempt the connection always succeeds, and then further connection attemps always do succeed,  but if I delete the bluetooth cache from /var/lib/bluetooth/ and reconnect, the same issue occurs on the first connection attempt. I'm not sure where exactly the issue lays but with those exact steps I'm able to recreate it constantly. Here is the btmon log when I connect to the device:

< HCI Command: LE Set Random Address (0x08|0x0005) plen 6                                                                                                   #174 [hci0] 13.870590
        Address: E2:25:60:FB:F0:A7 (Static)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                 #175 [hci0] 13.877470
      LE Set Random Address (0x08|0x0005) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Add Device To Accept List (0x08|0x0011) plen 7                                                                                            #176 [hci0] 13.878615
        Address type: Random (0x01)
        Address: E4:05:AA:E4:7B:4E (Static)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                 #177 [hci0] 13.880710
      LE Add Device To Accept List (0x08|0x0011) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7                                                                                                  #178 [hci0] 13.881419
        Type: Passive (0x00)
        Interval: 60.000 msec (0x0060)
        Window: 60.000 msec (0x0060)
        Own address type: Random (0x01)
        Filter policy: Ignore not in accept list (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                 #179 [hci0] 13.883711
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                      #180 [hci0] 13.883755
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                 #181 [hci0] 13.885864
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 23                                                                                                                   #182 [hci0] 13.945714
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: E4:05:AA:E4:7B:4E (Static)
        Data length: 11
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        16-bit Service UUIDs (complete): 3 entries
          Heart Rate (0x180d)
          Battery Service (0x180f)
          Device Information (0x180a)
        RSSI: -51 dBm (0xcd)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                      #183 [hci0] 13.945976
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                 #184 [hci0] 13.948713
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Create Connection (0x08|0x000d) plen 25                                                                                                   #185 [hci0] 13.948957
        Scan interval: 60.000 msec (0x0060)
        Scan window: 60.000 msec (0x0060)
        Filter policy: Accept list is not used (0x00)
        Peer address type: Random (0x01)
        Peer address: E4:05:AA:E4:7B:4E (Static)
        Own address type: Random (0x01)
        Min connection interval: 30.00 msec (0x0018)
        Max connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                                                                                                                   #186 [hci0] 13.952002
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 31                                                                                                                   #187 [hci0] 14.062627
      LE Enhanced Connection Complete (0x0a)
        Status: Success (0x00)
        Handle: 0
        Role: Central (0x00)
        Peer address type: Random (0x01)
        Peer address: E4:05:AA:E4:7B:4E (Static)
        Local resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Central clock accuracy: 0x00
@ MGMT Event: Device Connected (0x000b) plen 24                                                                                                         {0x0001} [hci0] 14.062729
        LE Address: E4:05:AA:E4:7B:4E (Static)
        Flags: 0x00000008
          Connection Locally Initiated
        Data length: 11
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        16-bit Service UUIDs (complete): 3 entries
          Heart Rate (0x180d)
          Battery Service (0x180f)
          Device Information (0x180a)
> HCI Event: LE Meta Event (0x3e) plen 4                                                                                                                    #188 [hci0] 14.064959
      LE Channel Selection Algorithm (0x14)
        Handle: 0
        Algorithm: #2 (0x01)
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2                                                                                            #189 [hci0] 14.081529
        Handle: 0
> HCI Event: Command Status (0x0f) plen 4                                                                                                                   #190 [hci0] 14.085101
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 11                                                                                                                   #191 [hci0] 14.280425
      LE Data Length Change (0x07)
        Handle: 0
        Max TX octets: 27
        Max TX time: 2120
        Max RX octets: 27
        Max RX time: 2120
> HCI Event: LE Meta Event (0x3e) plen 12                                                                                                                   #192 [hci0] 14.334617
      LE Read Remote Used Features (0x04)
        Status: Success (0x00)
        Handle: 0
        Features: 0x2d 0x41 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Extended Reject Indication
          Peripheral-initiated Features Exchange
          LE Data Packet Length Extension
          LE 2M PHY
          Channel Selection Algorithm #2
= bluetoothd: src/device.c:load_gatt_db() No cache for E4:05:AA:E4:7B:4E                                                                                                14.336637
< ACL Data TX: Handle 0 flags 0x00 dlen 7                                                                                                                   #193 [hci0] 14.337850
      ATT: Exchange MTU Request (0x02) len 2
        Client RX MTU: 517
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                      #194 [hci0] 14.388916
        Num handles: 1
        Handle: 0
        Count: 1

On the sniffer, we see basically the same thing, after that last message, there is just EMPTY PDU's until the connection times out
Edit: For comparison, here is me connecting to the same nrf52 peripheral from my galaxy S23 and connection succeeds first time:
  • Here is the log, I also have

    CONFIG_BT_CTLR_PHY_2M=n
    CONFIG_BT_AUTO_DATA_LEN_UPDATE=n
    CONFIG_BT_AUTO_PHY_UPDATE=n
    All set to see if it is any of those negotiations causing the issue, but it seems the same

    failed connect, auto DL extension disabled.pcapng

  • Hello again, 

    Do you also have the btmon log of second attempt that succeeds?

    Edit: Which release of ncs are you using btw?

    Kenneth

  • Hi Kenneth, 

    Sure thing. Here is the btmon log for when I delete all device cache from 

    /var/lib/bluetooth/static-XX:XX:XX:XX:XX:XX

    < HCI Command: LE Set Random Address (0x08|0x0005) plen 6                                                                                                   #636 [hci0] 22.534586
            Address: C2:1B:F6:8A:19:72 (Static)
    > HCI Event: Command Complete (0x0e) plen 4                                                                                                                 #637 [hci0] 22.536541
          LE Set Random Address (0x08|0x0005) ncmd 1
            Status: Success (0x00)
    < HCI Command: LE Add Device To Accept List (0x08|0x0011) plen 7                                                                                            #638 [hci0] 22.538022
            Address type: Random (0x01)
            Address: E4:05:AA:E4:7B:4E (Static)
    > HCI Event: Command Complete (0x0e) plen 4                                                                                                                 #639 [hci0] 22.540766
          LE Add Device To Accept List (0x08|0x0011) ncmd 1
            Status: Success (0x00)
    < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7                                                                                                  #640 [hci0] 22.541309
            Type: Passive (0x00)
            Interval: 60.000 msec (0x0060)
            Window: 60.000 msec (0x0060)
            Own address type: Random (0x01)
            Filter policy: Ignore not in accept list (0x01)
    > HCI Event: Command Complete (0x0e) plen 4                                                                                                                 #641 [hci0] 22.543977
          LE Set Scan Parameters (0x08|0x000b) ncmd 1
            Status: Success (0x00)
    < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                      #642 [hci0] 22.544203
            Scanning: Enabled (0x01)
            Filter duplicates: Enabled (0x01)
    > HCI Event: Command Complete (0x0e) plen 4                                                                                                                 #643 [hci0] 22.547272
          LE Set Scan Enable (0x08|0x000c) ncmd 1
            Status: Success (0x00)
    > HCI Event: LE Meta Event (0x3e) plen 33                                                                                                                   #644 [hci0] 22.558118
          LE Advertising Report (0x02)
            Num reports: 1
            Event type: Connectable undirected - ADV_IND (0x00)
            Address type: Random (0x01)
            Address: E4:05:AA:E4:7B:4E (Static)
            Data length: 21
            Flags: 0x06
              LE General Discoverable Mode
              BR/EDR Not Supported
            128-bit Service UUIDs (complete): 1 entry
              Vendor specific
            RSSI: -54 dBm (0xca)
    < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                      #645 [hci0] 22.558734
            Scanning: Disabled (0x00)
            Filter duplicates: Disabled (0x00)
    > HCI Event: Command Complete (0x0e) plen 4                                                                                                                 #646 [hci0] 22.560328
          LE Set Scan Enable (0x08|0x000c) ncmd 1
            Status: Success (0x00)
    < HCI Command: LE Create Connection (0x08|0x000d) plen 25                                                                                                   #647 [hci0] 22.560563
            Scan interval: 60.000 msec (0x0060)
            Scan window: 60.000 msec (0x0060)
            Filter policy: Accept list is not used (0x00)
            Peer address type: Random (0x01)
            Peer address: E4:05:AA:E4:7B:4E (Static)
            Own address type: Random (0x01)
            Min connection interval: 30.00 msec (0x0018)
            Max connection interval: 50.00 msec (0x0028)
            Connection latency: 0 (0x0000)
            Supervision timeout: 420 msec (0x002a)
            Min connection length: 0.000 msec (0x0000)
            Max connection length: 0.000 msec (0x0000)
    > HCI Event: Command Status (0x0f) plen 4                                                                                                                   #648 [hci0] 22.562509
          LE Create Connection (0x08|0x000d) ncmd 1
            Status: Success (0x00)
    > HCI Event: LE Meta Event (0x3e) plen 31                                                                                                                   #649 [hci0] 22.669880
          LE Enhanced Connection Complete (0x0a)
            Status: Success (0x00)
            Handle: 0
            Role: Central (0x00)
            Peer address type: Random (0x01)
            Peer address: E4:05:AA:E4:7B:4E (Static)
            Local resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
            Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
            Connection interval: 50.00 msec (0x0028)
            Connection latency: 0 (0x0000)
            Supervision timeout: 420 msec (0x002a)
            Central clock accuracy: 0x00
    @ MGMT Event: Device Connected (0x000b) plen 34                                                                                                         {0x0001} [hci0] 22.670060
            LE Address: E4:05:AA:E4:7B:4E (Static)
            Flags: 0x00000008
              Connection Locally Initiated
            Data length: 21
            Flags: 0x06
              LE General Discoverable Mode
              BR/EDR Not Supported
            128-bit Service UUIDs (complete): 1 entry
              Vendor specific
    > HCI Event: LE Meta Event (0x3e) plen 4                                                                                                                    #650 [hci0] 22.673147
          LE Channel Selection Algorithm (0x14)
            Handle: 0
            Algorithm: #2 (0x01)
    < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2                                                                                            #651 [hci0] 22.690059
            Handle: 0
    > HCI Event: Command Status (0x0f) plen 4                                                                                                                   #652 [hci0] 22.691466
          LE Read Remote Used Features (0x08|0x0016) ncmd 1
            Status: Success (0x00)
    > HCI Event: LE Meta Event (0x3e) plen 11                                                                                                                   #653 [hci0] 22.780370
          LE Data Length Change (0x07)
            Handle: 0
            Max TX octets: 27
            Max TX time: 2120
            Max RX octets: 27
            Max RX time: 2120
    > HCI Event: LE Meta Event (0x3e) plen 12                                                                                                                   #654 [hci0] 22.834449
          LE Read Remote Used Features (0x04)
            Status: Success (0x00)
            Handle: 0
            Features: 0x2d 0x41 0x00 0x00 0x00 0x00 0x00 0x00
              LE Encryption
              Extended Reject Indication
              Peripheral-initiated Features Exchange
              LE Data Packet Length Extension
              LE 2M PHY
              Channel Selection Algorithm #2
    = bluetoothd: src/device.c:load_gatt_db() No cache for E4:05:AA:E4:7B:4E                                                                                                22.838793
    < ACL Data TX: Handle 0 flags 0x00 dlen 7                                                                                                                   #655 [hci0] 22.838264
          ATT: Exchange MTU Request (0x02) len 2
            Client RX MTU: 517
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                      #656 [hci0] 22.888721
            Num handles: 1
            Handle: 0
            Count: 1
    < HCI Command: Disconnect (0x01|0x0006) plen 3                                                                                                              #657 [hci0] 54.958014
            Handle: 0
            Reason: Remote User Terminated Connection (0x13)
    > HCI Event: Command Status (0x0f) plen 4                                                                                                                   #658 [hci0] 54.961438
          Disconnect (0x01|0x0006) ncmd 1
            Status: Success (0x00)
    > HCI Event: Disconnect Complete (0x05) plen 4                                                                                                              #659 [hci0] 55.062179
            Status: Success (0x00)
            Handle: 0
            Reason: Connection Terminated By Local Host (0x16)
    @ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                       {0x0001} [hci0] 55.062295
            LE Address: E4:05:AA:E4:7B:4E (Static)
            Reason: Connection terminated by local host (0x02)

    And here is the btmon log now on the 2nd connection attempt, keeping the device cache now:

    < HCI Command: LE Set Random Address (0x08|0x0005) plen 6                                                                                                 #1008 [hci0] 178.408369
            Address: C2:1B:F6:8A:19:72 (Static)
    > HCI Event: Command Complete (0x0e) plen 4                                                                                                               #1009 [hci0] 178.410590
          LE Set Random Address (0x08|0x0005) ncmd 1
            Status: Success (0x00)
    < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7                                                                                                #1010 [hci0] 178.410656
            Type: Passive (0x00)
            Interval: 60.000 msec (0x0060)
            Window: 60.000 msec (0x0060)
            Own address type: Random (0x01)
            Filter policy: Ignore not in accept list (0x01)
    > HCI Event: Command Complete (0x0e) plen 4                                                                                                               #1011 [hci0] 178.413844
          LE Set Scan Parameters (0x08|0x000b) ncmd 1
            Status: Success (0x00)
    < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                    #1012 [hci0] 178.413918
            Scanning: Enabled (0x01)
            Filter duplicates: Enabled (0x01)
    > HCI Event: Command Complete (0x0e) plen 4                                                                                                               #1013 [hci0] 178.417104
          LE Set Scan Enable (0x08|0x000c) ncmd 1
            Status: Success (0x00)
    > HCI Event: LE Meta Event (0x3e) plen 33                                                                                                                 #1014 [hci0] 178.487598
          LE Advertising Report (0x02)
            Num reports: 1
            Event type: Connectable undirected - ADV_IND (0x00)
            Address type: Random (0x01)
            Address: E4:05:AA:E4:7B:4E (Static)
            Data length: 21
            Flags: 0x06
              LE General Discoverable Mode
              BR/EDR Not Supported
            128-bit Service UUIDs (complete): 1 entry
              Vendor specific
            RSSI: -55 dBm (0xc9)
    < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                    #1015 [hci0] 178.487664
            Scanning: Disabled (0x00)
            Filter duplicates: Disabled (0x00)
    > HCI Event: Command Complete (0x0e) plen 4                                                                                                               #1016 [hci0] 178.490795
          LE Set Scan Enable (0x08|0x000c) ncmd 1
            Status: Success (0x00)
    < HCI Command: LE Create Connection (0x08|0x000d) plen 25                                                                                                 #1017 [hci0] 178.490891
            Scan interval: 60.000 msec (0x0060)
            Scan window: 60.000 msec (0x0060)
            Filter policy: Accept list is not used (0x00)
            Peer address type: Random (0x01)
            Peer address: E4:05:AA:E4:7B:4E (Static)
            Own address type: Random (0x01)
            Min connection interval: 30.00 msec (0x0018)
            Max connection interval: 50.00 msec (0x0028)
            Connection latency: 0 (0x0000)
            Supervision timeout: 420 msec (0x002a)
            Min connection length: 0.000 msec (0x0000)
            Max connection length: 0.000 msec (0x0000)
    > HCI Event: Command Status (0x0f) plen 4                                                                                                                 #1018 [hci0] 178.494044
          LE Create Connection (0x08|0x000d) ncmd 1
            Status: Success (0x00)
    > HCI Event: LE Meta Event (0x3e) plen 31                                                                                                                 #1019 [hci0] 178.710815
          LE Enhanced Connection Complete (0x0a)
            Status: Success (0x00)
            Handle: 0
            Role: Central (0x00)
            Peer address type: Random (0x01)
            Peer address: E4:05:AA:E4:7B:4E (Static)
            Local resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
            Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
            Connection interval: 50.00 msec (0x0028)
            Connection latency: 0 (0x0000)
            Supervision timeout: 420 msec (0x002a)
            Central clock accuracy: 0x00
    @ MGMT Event: Device Connected (0x000b) plen 34                                                                                                        {0x0001} [hci0] 178.710935
            LE Address: E4:05:AA:E4:7B:4E (Static)
            Flags: 0x00000008
              Connection Locally Initiated
            Data length: 21
            Flags: 0x06
              LE General Discoverable Mode
              BR/EDR Not Supported
            128-bit Service UUIDs (complete): 1 entry
              Vendor specific
    > HCI Event: LE Meta Event (0x3e) plen 4                                                                                                                  #1020 [hci0] 178.713131
          LE Channel Selection Algorithm (0x14)
            Handle: 0
            Algorithm: #2 (0x01)
    < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2                                                                                          #1021 [hci0] 178.730017
            Handle: 0
    > HCI Event: Command Status (0x0f) plen 4                                                                                                                 #1022 [hci0] 178.731280
          LE Read Remote Used Features (0x08|0x0016) ncmd 1
            Status: Success (0x00)
    > HCI Event: LE Meta Event (0x3e) plen 11                                                                                                                 #1023 [hci0] 178.821351
          LE Data Length Change (0x07)
            Handle: 0
            Max TX octets: 27
            Max TX time: 2120
            Max RX octets: 27
            Max RX time: 2120
    > HCI Event: LE Meta Event (0x3e) plen 12                                                                                                                 #1024 [hci0] 178.875574
          LE Read Remote Used Features (0x04)
            Status: Success (0x00)
            Handle: 0
            Features: 0x2d 0x41 0x00 0x00 0x00 0x00 0x00 0x00
              LE Encryption
              Extended Reject Indication
              Peripheral-initiated Features Exchange
              LE Data Packet Length Extension
              LE 2M PHY
              Channel Selection Algorithm #2
    = bluetoothd: src/device.c:load_gatt_db() No cache for E4:05:AA:E4:7B:4E                                                                                               178.876464
    < ACL Data TX: Handle 0 flags 0x00 dlen 7                                                                                                                 #1025 [hci0] 178.877312
          ATT: Exchange MTU Request (0x02) len 2
            Client RX MTU: 517
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1026 [hci0] 178.928551
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 7                                                                                                                 #1027 [hci0] 179.036965
          ATT: Exchange MTU Response (0x03) len 2
            Server RX MTU: 498
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1028 [hci0] 179.037497
          ATT: Read By Type Request (0x08) len 6
            Handle range: 0x0001-0xffff
            Attribute type: Server Supported Features (0x2b3a)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1029 [hci0] 179.092234
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 9                                                                                                                 #1030 [hci0] 179.145242
          ATT: Error Response (0x01) len 4
            Read By Type Request (0x08)
            Handle: 0x0001
            Error: Attribute Not Found (0x0a)
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1031 [hci0] 179.146071
          ATT: Read By Group Type Request (0x10) len 6
            Handle range: 0x0001-0xffff
            Attribute group type: Primary Service (0x2800)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1032 [hci0] 179.254730
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 18                                                                                                                #1033 [hci0] 179.307787
          ATT: Read By Group Type Response (0x11) len 13
            Attribute data length: 6
            Attribute group list: 2 entries
            Handle range: 0x0001-0x0008
            UUID: Generic Attribute Profile (0x1801)
            Handle range: 0x0009-0x000f
            UUID: Generic Access Profile (0x1800)
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1034 [hci0] 179.308215
          ATT: Read By Group Type Request (0x10) len 6
            Handle range: 0x0010-0xffff
            Attribute group type: Primary Service (0x2800)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1035 [hci0] 179.363051
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 26                                                                                                                #1036 [hci0] 179.416189
          ATT: Read By Group Type Response (0x11) len 21
            Attribute data length: 20
            Attribute group list: 1 entry
            Handle range: 0x0010-0x0013
            UUID: Vendor specific (8d53dc1d-1db7-4cd3-868b-8a527460aa84)
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1037 [hci0] 179.416630
          ATT: Read By Group Type Request (0x10) len 6
            Handle range: 0x0014-0xffff
            Attribute group type: Primary Service (0x2800)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1038 [hci0] 179.471264
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 9                                                                                                                 #1039 [hci0] 179.524255
          ATT: Error Response (0x01) len 4
            Read By Group Type Request (0x10)
            Handle: 0x0014
            Error: Attribute Not Found (0x0a)
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1040 [hci0] 179.524596
          ATT: Read By Group Type Request (0x10) len 6
            Handle range: 0x0001-0xffff
            Attribute group type: Secondary Service (0x2801)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1041 [hci0] 179.579608
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 9                                                                                                                 #1042 [hci0] 179.632597
          ATT: Error Response (0x01) len 4
            Read By Group Type Request (0x10)
            Handle: 0x0001
            Error: Attribute Not Found (0x0a)
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1043 [hci0] 179.633199
          ATT: Read By Type Request (0x08) len 6
            Handle range: 0x0001-0x0013
            Attribute type: Include (0x2802)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1044 [hci0] 179.686980
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 9                                                                                                                 #1045 [hci0] 179.741089
          ATT: Error Response (0x01) len 4
            Read By Type Request (0x08)
            Handle: 0x0001
            Error: Attribute Not Found (0x0a)
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1046 [hci0] 179.741625
          ATT: Read By Type Request (0x08) len 6
            Handle range: 0x0001-0x0013
            Attribute type: Characteristic (0x2803)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1047 [hci0] 179.795247
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 27                                                                                                                #1048 [hci0] 179.849269
    > ACL Data RX: Handle 0 flags 0x01 dlen 21                                                                                                                #1049 [hci0] 179.850236
          ATT: Read By Type Response (0x09) len 43
            Attribute data length: 7
            Attribute data list: 6 entries
            Handle: 0x0002
            Value: 200300052a
            Handle: 0x0005
            Value: 0a0600292b
            Handle: 0x0007
            Value: 0208002a2b
            Handle: 0x000a
            Value: 0a0b00002a
            Handle: 0x000c
            Value: 020d00012a
            Handle: 0x000e
            Value: 020f00042a
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1050 [hci0] 179.850465
          ATT: Read By Type Request (0x08) len 6
            Handle range: 0x000f-0x0013
            Attribute type: Characteristic (0x2803)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1051 [hci0] 179.903692
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 27                                                                                                                #1052 [hci0] 179.957987
          ATT: Read By Type Response (0x09) len 22
            Attribute data length: 21
            Attribute data list: 1 entry
            Handle: 0x0011
            Value: 141200487c997411269eae014ecefb28782eda
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1053 [hci0] 179.958628
          ATT: Read By Type Request (0x08) len 6
            Handle range: 0x0012-0x0013
            Attribute type: Characteristic (0x2803)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1054 [hci0] 180.011926
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 9                                                                                                                 #1055 [hci0] 180.066114
          ATT: Error Response (0x01) len 4
            Read By Type Request (0x08)
            Handle: 0x0012
            Error: Attribute Not Found (0x0a)
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1056 [hci0] 180.066656
          ATT: Read By Type Request (0x08) len 6
            Handle range: 0x0001-0xffff
            Attribute type: Database Hash (0x2b2a)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1057 [hci0] 180.120217
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 24                                                                                                                #1058 [hci0] 180.174341
          ATT: Read By Type Response (0x09) len 19
            Attribute data length: 18
            Attribute data list: 1 entry
            Handle: 0x0008
            Value: 850395f13e6ee0d61c35cd65f2649921
    < ACL Data TX: Handle 0 flags 0x00 dlen 11                                                                                                                #1059 [hci0] 180.174760
          ATT: Read By Type Request (0x08) len 6
            Handle range: 0x0009-0xffff
            Attribute type: Database Hash (0x2b2a)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1060 [hci0] 180.228549
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 9                                                                                                                 #1061 [hci0] 180.283014
          ATT: Error Response (0x01) len 4
            Read By Type Request (0x08)
            Handle: 0x0009
            Error: Attribute Not Found (0x0a)
    < ACL Data TX: Handle 0 flags 0x00 dlen 8                                                                                                                 #1062 [hci0] 180.288344
          ATT: Write Request (0x12) len 3
            Handle: 0x0006
              Data: 05
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1063 [hci0] 180.336891
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 5                                                                                                                 #1064 [hci0] 180.391196
          ATT: Write Response (0x13) len 0
    < ACL Data TX: Handle 0 flags 0x00 dlen 9                                                                                                                 #1065 [hci0] 180.391885
          ATT: Write Request (0x12) len 4
            Handle: 0x0004
              Data: 0200
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1066 [hci0] 180.445129
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 5                                                                                                                 #1067 [hci0] 180.499211
          ATT: Write Response (0x13) len 0
    < ACL Data TX: Handle 0 flags 0x00 dlen 7                                                                                                                 #1068 [hci0] 180.499364
          ATT: Read Request (0x0a) len 2
            Handle: 0x000b
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1069 [hci0] 180.553488
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 12                                                                                                                #1070 [hci0] 180.607552
          ATT: Read Response (0x0b) len 7
            Value: 4f524220444655
    < ACL Data TX: Handle 0 flags 0x00 dlen 7                                                                                                                 #1071 [hci0] 180.607706
          ATT: Read Request (0x0a) len 2
            Handle: 0x000d
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1072 [hci0] 180.661812
            Num handles: 1
            Handle: 0
            Count: 1
    > ACL Data RX: Handle 0 flags 0x02 dlen 7                                                                                                                 #1073 [hci0] 180.717933
          ATT: Read Response (0x0b) len 2
            Value: 0000
    > ACL Data RX: Handle 0 flags 0x02 dlen 16                                                                                                                #1074 [hci0] 184.128488
          LE L2CAP: Connection Parameter Update Request (0x12) ident 2 len 8
            Min interval: 24
            Max interval: 40
            Peripheral latency: 0
            Timeout multiplier: 42
    @ MGMT Event: New Connection Parameter (0x001c) plen 16                                                                                                {0x0001} [hci0] 184.128587
            Store hint: Reserved (0x4e)
            LE Address: 02:E4:05:AA:E4:7B (OUI 02-E4-05)
            Min connection interval: 24
            Max connection interval: 40
            Connection latency: 0 (0x0000)
            Supervision timeout: 42
    < ACL Data TX: Handle 0 flags 0x00 dlen 10                                                                                                                #1075 [hci0] 184.128691
          LE L2CAP: Connection Parameter Update Response (0x13) ident 2 len 2
            Result: Connection Parameters accepted (0x0000)
    < HCI Command: LE Connection Update (0x08|0x0013) plen 14                                                                                                 #1076 [hci0] 184.128721
            Handle: 0
            Min connection interval: 30.00 msec (0x0018)
            Max connection interval: 50.00 msec (0x0028)
            Connection latency: 0 (0x0000)
            Supervision timeout: 420 msec (0x002a)
            Min connection length: 0.000 msec (0x0000)
            Max connection length: 0.000 msec (0x0000)
    > HCI Event: Command Status (0x0f) plen 4                                                                                                                 #1077 [hci0] 184.130608
          LE Connection Update (0x08|0x0013) ncmd 1
            Status: Success (0x00)
    > HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                    #1078 [hci0] 184.237399
            Num handles: 1
            Handle: 0
            Count: 1
    > HCI Event: LE Meta Event (0x3e) plen 10                                                                                                                 #1079 [hci0] 184.507661
          LE Connection Update Complete (0x03)
            Status: Success (0x00)
            Handle: 0
            Connection interval: 50.00 msec (0x0028)
            Connection latency: 0 (0x0000)
            Supervision timeout: 420 msec (0x002a)

    Some more info:

    Bluez Version: 5.64-0ubuntu1.1

    nRF Connect SDK v2.5.1

    Like I said with the steps in my first post, you should be able to recreate it quite easily on any ubuntu machine, it's very recreate-able for me every time. 

    Ideally I'd like to be able to reliably get connections to work first time without having to have the device cache available as I need to perform some batch testing of new boards via BLE.

  • Hello,

    Thanks for all the details, I can't find anything wrong, but let me check with the developers what and if they have any comment.

    Kenneth

  • Hello,

    I have spoken to the developers, maybe I should have done so earlier, but I get the impression that hci over usb as a transport layer is slightly unstable by design; for simple use cases where transfer is not stressed then hci_usb is functional, but for stability you should use uart or spi as hci transport. It seems as most vendors use uart hci transport due to this, e.g. in phones, laptops etc. We plan to add a disclaimer to the hci_usb sample. A suggested workaround is to use compile hci_uart with the cdc uart driver instead (if you need to use usb, and cant use uart or spi directly).

    Kenneth

Related