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.

  • I am currently setting up Ubuntu on a VM (I've just reformatted the PC and need to redo this) to reproduce your behavior and will report to you when/if I've been able to reproduce it and hopefully figured out how to bypass the problem.

    Best regards,

    Simon

  • I am sorry for the long delay. I was struggling with getting it to work with Ubuntu Virtualbox (recognizing the USB), but with Ubuntu Dual Boot it worked fine. However, the sample itself (hci_usb + Nordic LInk layer) was not working properly. I talked to some of the developers and was told that the hci_usb was not tested at all at the moment. However, the hci_uart sample has been tested more. 

    The nRF Connect SDK does not support nRF52 and we don't actually give support for it at the moment (in the future we will), only the nRF5340 and the nRF9160. This means that the various nRF52 SoC's are not sufficiently tested with NCS/Zephyr and we can not guarantee that everything works. 

    I should have informed you about this at an earlier point, my apologies for that.

    For questions regarding the nRF52 and Zephyr, please check out the Zephyr mailing list or join the #zephyrproject IRC channel.

    Best regards,

    Simon

  • Thank you for looking into it.

    Now that you pointed out, I tried also hci_uart. It seems to have similar problem than hci_usb when CONFIG_BT_LL_NRFXLIB=y. Am I missing something in project configuration?

    When using Zephyr open source controller, everything works fine.

  • I am sorry for the delayThe staffing is reduced during easter due to holidays and I will be gone this week, but I will be back Tuesday next week and will look at your ticket then.

    Best regards,

    Simon

  • 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?

Related