Re: Zephyr HCI USB vs Bluez version


Piotr Barszczewski <piotr@...>
 

Furthermore the same thing happens using bluetoothctl which seems to be the prefered way of doing HCI on Linux over the gatttool and hcitool. 
I really can’t find a way to read/write with any bluez utils and nRF52840 DK with HCI_USB firmware. On the other hand a simple CSR dongle works ok. With nRF52840DK and HCI_USB it’s always the same story, it connects but doesn’t do anything and disconnects after ~10 seconds. Is there any way to make it work with a pretty normal BLE device? Never any had issues with connecting from phones or other HCI dongles, just one with Zephyr based HCI.

< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7                                                             #58 [hci2] 74.790926
        Type: Passive (0x00)
        Interval: 60.000 msec (0x0060)
        Window: 30.000 msec (0x0030)
        Own address type: Random (0x01)
        Filter policy: Ignore not in white list (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                                                            #59 [hci2] 74.792191
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                 #60 [hci2] 74.792206
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                                                            #61 [hci2] 74.793190
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 42                                                                              #62 [hci2] 74.800193
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: EC:50:02:EA:E6:3E (Static)
        Data length: 30
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Company: Apple, Inc. (76)
          Type: iBeacon (2)
          UUID: ...
          Version: 512.16102
          TX power: -59 dB
        RSSI: -39 dBm (0xd9)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                 #63 [hci2] 74.800213
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                                                                            #64 [hci2] 74.801190
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Create Connection (0x08|0x000d) plen 25                                                              #65 [hci2] 74.801203
        Scan interval: 60.000 msec (0x0060)
        Scan window: 60.000 msec (0x0060)
        Filter policy: White list is not used (0x00)
        Peer address type: Random (0x01)
        Peer address: EC:50:02:EA:E6:3E (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                                                                              #66 [hci2] 74.803190
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 31                                                                              #67 [hci2] 74.904193
      LE Enhanced Connection Complete (0x0a)
        Status: Success (0x00)
        Handle: 0
        Role: Master (0x00)
        Peer address type: Random (0x01)
        Peer address: EC:50:02:EA:E6:3E (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)
        Master clock accuracy: 0x07
@ MGMT Event: Device Connected (0x000b) plen 43                                                                   {0x0001} [hci2] 74.904214
        LE Address: EC:50:02:EA:E6:3E (Static)
        Flags: 0x00000000
        Data length: 30
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Company: Apple, Inc. (76)
          Type: iBeacon (2)
          UUID: ...
          Version: 512.16102
          TX power: -59 dB
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2                                                       #68 [hci2] 74.904282
        Handle: 0
> HCI Event: LE Meta Event (0x3e) plen 4                                                                               #69 [hci2] 74.905193
      LE Channel Selection Algorithm (0x14)
        Handle: 0
        Algorithm: #2 (0x01)
> HCI Event: Command Status (0x0f) plen 4                                                                              #70 [hci2] 74.906191
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
> ACL Data RX: Handle 0 flags 0x02 dlen 7                                                                              #71 [hci2] 74.906279
      ATT: Exchange MTU Request (0x02) len 2
        Client RX MTU: 247
> HCI Event: LE Meta Event (0x3e) plen 12                                                                              #72 [hci2] 75.056195
      LE Read Remote Used Features (0x04)
        Status: Success (0x00)
        Handle: 0
        Features: 0x25 0x41 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Extended Reject Indication
          LE Data Packet Length Extension
          LE 2M PHY
          Channel Selection Algorithm #2
= bluetoothd: src/device.c:load_gatt_db() No cache for EC:50:02:EA:E6:3E                                                          75.056414
< ACL Data TX: Handle 0 flags 0x00 dlen 7                                                                              #73 [hci2] 75.056493
      ATT: Exchange MTU Response (0x03) len 2
        Server RX MTU: 517
< ACL Data TX: Handle 0 flags 0x00 dlen 7                                                                              #74 [hci2] 75.056505
      ATT: Exchange MTU Request (0x02) len 2
        Client RX MTU: 517
> ACL Data RX: Handle 0 flags 0x02 dlen 16                                                                             #75 [hci2] 94.955356
      LE L2CAP: Connection Parameter Update Request (0x12) ident 3 len 8
        Min interval: 9
        Max interval: 24
        Slave latency: 0
        Timeout multiplier: 100
@ MGMT Event: New Connection Parameter (0x001c) plen 16                                                           {0x0001} [hci2] 94.955378
        Store hint: Reserved (0x3e)
        BR/EDR Address: 02:EC:50:02:EA:E6 (OUI 02-EC-50)
        Min connection interval: 9
        Max connection interval: 24
        Connection latency: 0 (0x0000)
        Supervision timeout: 100
< ACL Data TX: Handle 0 flags 0x00 dlen 10                                                                             #76 [hci2] 94.955387
      LE L2CAP: Connection Parameter Update Response (0x13) ident 3 len 2
        Result: Connection Parameters accepted (0x0000)
< HCI Command: LE Connection Update (0x08|0x0013) plen 14                                                              #77 [hci2] 94.955393
        Handle: 0
        Min connection interval: 11.25 msec (0x0009)
        Max connection interval: 30.00 msec (0x0018)
        Connection latency: 0 (0x0000)
        Supervision timeout: 1000 msec (0x0064)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                                                                              #78 [hci2] 94.956383
      LE Connection Update (0x08|0x0013) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 10                                                                              #79 [hci2] 95.353393
      LE Connection Update Complete (0x03)
        Status: Success (0x00)
        Handle: 0
        Connection interval: 30.00 msec (0x0018)
        Connection latency: 0 (0x0000)
        Supervision timeout: 1000 msec (0x0064)
> HCI Event: Disconnect Complete (0x05) plen 4                                                                        #80 [hci2] 104.956473
        Status: Success (0x00)
        Handle: 0
        Reason: Remote User Terminated Connection (0x13)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                {0x0001} [hci2] 104.956490
        LE Address: EC:50:02:EA:E6:3E (Static)
        Reason: Connection terminated by remote host (0x03)


On 23 April 2021 at 20:12:16, Piotr Barszczewski (piotr@...) wrote:

Hello,

Is there some guide on which of the recent kernel/bluez/linux versions does the HCI_USB ( https://github.com/zephyrproject-rtos/zephyr/tree/master/samples/bluetooth/hci_usb ) work on nRF52840_pca100056 board? I’m having quite hard time figuring how to make it work beyond being able to scan, connect or disconnect.

As an example I usually try the following with any HCI device:
1. Connect to my test device with gatttool
2. Try to discover characteristics
3. Send a few bytes with char-write-cmd …
4. Observe on test device if it was received
5. Disconnect

The problem I’m observing on Ubuntu 20 with kernel 5.8.0-50 is that the nRF DK enumerating as port hci1 always has it’s address set to 00:00:00:00:00:00 and does not do anything beyond connecting. Tried with Bluez 5.55 and 5.58, my bluetoothd.service already has -E flag set. Usually I’m working with CSR dongles and never had issues with multiple HCI devices connected and thought that it would be a quick test do compare how nRF52840 performs with Zephyr. Yet here I am out of ideas on what to do next, asking the very basic question, bit puzzled on how yo make such a simple thing work. Would really appreciate if someone could point me to how to make Zephyr HCI work with any Bluez

Best regards

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