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

Connect SDK: hci_usb sample not working with Nordic's LL

Hi!

I'm interested in trying out hci_usb sample of nRF Connect SDK with Nordic's Link Layer.

With following changes to application configuration I'm able to compile the hci_usb sample:

diff --git a/samples/bluetooth/hci_usb/prj.conf b/samples/bluetooth/hci_usb/prj.conf
index 1c19e32540..2ccd19c2a4 100644
--- a/samples/bluetooth/hci_usb/prj.conf
+++ b/samples/bluetooth/hci_usb/prj.conf
@@ -9,3 +9,6 @@ CONFIG_BT_HCI_RAW=y
 CONFIG_USB=y
 CONFIG_USB_DEVICE_STACK=y
 CONFIG_USB_DEVICE_BLUETOOTH=y
+
+CONFIG_BT_LL_NRFXLIB=y
+CONFIG_BT_MAX_CONN=10

When trying to use nRF52840 DK as a Bluetooth LE dongle in Linux there seems to be some problems in initialization. See the btmon trace below.

Bluetooth monitor ver 5.48
= Note: Linux version 4.15.0-88-generic (x86_64)                                                                                                     0.206549
= Note: Bluetooth subsystem version 2.22                                                                                                             0.206551
= New Index: A4:83:E7:99:93:DA (Primary,USB,hci0)                                                                                             [hci0] 0.206551
= Open Index: A4:83:E7:99:93:DA                                                                                                               [hci0] 0.206552
= Index Info: A4:83:E7:99:93:DA (not assigned)                                                                                                [hci0] 0.206552
@ MGMT Open: bluetoothd (privileged) version 1.14                                                                                           {0x0001} 0.206553
@ MGMT Open: btmon (privileged) version 1.14                                                                                                {0x0002} 0.206968
= New Index: 00:00:00:00:00:00 (Primary,USB,hci1)                                                                                             [hci1] 4.000698
= Open Index: 00:00:00:00:00:00                                                                                                               [hci1] 4.000725
< HCI Command: Reset (0x03|0x0003) plen 0                                                                                                  #1 [hci1] 4.000744
> HCI Event: Command Complete (0x0e) plen 4                                                                                                #2 [hci1] 4.003216
      Reset (0x03|0x0003) ncmd 1
        Status: Success (0x00)
< HCI Command: Read Local Supported Features (0x04|0x0003) plen 0                                                                          #3 [hci1] 4.003236
> HCI Event: Command Complete (0x0e) plen 12                                                                                               #4 [hci1] 4.005261
      Read Local Supported Features (0x04|0x0003) ncmd 1
        Status: Success (0x00)
        Features: 0x00 0x00 0x00 0x00 0x60 0x00 0x00 0x00
          BR/EDR Not Supported
          LE Supported (Controller)
< HCI Command: Read Local Version Information (0x04|0x0001) plen 0                                                                         #5 [hci1] 4.005279
> HCI Event: Command Complete (0x0e) plen 12                                                                                               #6 [hci1] 4.007871
      Read Local Version Information (0x04|0x0001) ncmd 1
        Status: Success (0x00)
        HCI version: Reserved (0x0a) - Revision 65534 (0xfffe)
        LMP version: Reserved (0x0a) - Subversion 65534 (0xfffe)
        Manufacturer: Nordic Semiconductor ASA (89)
< HCI Command: Read BD ADDR (0x04|0x0009) plen 0                                                                                           #7 [hci1] 4.007897
> HCI Event: Command Complete (0x0e) plen 10                                                                                               #8 [hci1] 4.010387
      Read BD ADDR (0x04|0x0009) ncmd 1
        Status: Success (0x00)
        Address: 00:00:00:00:00:00 (OUI 00-00-00)
< HCI Command: LE Read Buffer Size (0x08|0x0002) plen 0                                                                                    #9 [hci1] 4.010431
> HCI Event: Command Complete (0x0e) plen 7                                                                                               #10 [hci1] 4.012994
      LE Read Buffer Size (0x08|0x0002) ncmd 1
        Status: Success (0x00)
        Data packet length: 27
        Num data packets: 3
< HCI Command: LE Read Local Supported Features (0x08|0x0003) plen 0                                                                      #11 [hci1] 4.013014
> HCI Event: Command Complete (0x0e) plen 12                                                                                              #12 [hci1] 4.015221
      LE Read Local Supported Features (0x08|0x0003) ncmd 1
        Status: Success (0x00)
        Features: 0xf5 0x59 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Extended Reject Indication
          LE Ping
          LE Data Packet Length Extension
          LL Privacy
          Extended Scanner Filter Policies
          LE 2M PHY
          LE Coded PHY
          LE Extended Advertising
          Channel Selection Algorithm #2
< HCI Command: LE Read Supported States (0x08|0x001c) plen 0                                                                              #13 [hci1] 4.015256
> HCI Event: Command Complete (0x0e) plen 8                                                                                               #14 [hci1] 4.018175
      LE Read Supported States (0x08|0x001c) ncmd 1
        invalid packet size
        01 8b 92 00 00                                   .....           
= Close Index: 00:00:00:00:00:00          

I'm using commit 169ed14ee2371073e63d922733345dbcad2a5218 of fw-nrfconnect-nrf.

Steps to reproduce:

1. cd ncs/zephyr/samples/bluetooth/hci_usb

2. apply the diff above to prj.conf

3. west build -b nrf52840_pca10056 && west flash

4. start btmon

5. reset the board and check the btmon log.

Parents
  • Thank you for reporting this problem.

    A couple of things are wrong here.

    1. The host (I'm not sure which one you are using Linux/Windows?) is sending a command to the controller that the controller does not support.
       The host should have read the local supported commands from the controller first.
    2. The unknown command response from the controller has the wrong length value, causing btmon to report invalid length field.

    We will fix the length field, and also add support for the command, Read Supported States.
    Look for an update to nrfxlib.

    In the meantime could you see if you can stop the host from sending the command?

Reply
  • Thank you for reporting this problem.

    A couple of things are wrong here.

    1. The host (I'm not sure which one you are using Linux/Windows?) is sending a command to the controller that the controller does not support.
       The host should have read the local supported commands from the controller first.
    2. The unknown command response from the controller has the wrong length value, causing btmon to report invalid length field.

    We will fix the length field, and also add support for the command, Read Supported States.
    Look for an update to nrfxlib.

    In the meantime could you see if you can stop the host from sending the command?

Children
  • Thank you Joakim for analysing the issue!

    I'm using Linux. Main problem here is that because initialisation fails, Linux does not recognise nRF52840 DK as Bluetooth device. Apparently Linux does Read Local Commands after LE setup which includes LE Read Buffer Size, LE Read Local Supported Features and LE Read Supported States. All of those are mandatory on LE controller so I guess that is why Linux expects them to be available and is not checking if they are supported.

    I will keep eye on nrfxlib updates.

Related