Zephyr OS - nRF52840 Dongle with Long Range

I am working with Zephyr version 2.4 on nRF52840-Dongle for adding ability to scan CODED PHY devices. My host is Raspberry Pi3 with kernel version 5.4.51 v7+,
HCI_USB sample is used with following configuration:

CONFIG_STDOUT_CONSOLE=y
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

CONFIG_BT=y
CONFIG_BT_H4=y
CONFIG_BT_CTLR=y
CONFIG_BT_HCI=y

CONFIG_USB=y
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_BLUETOOTH=y
CONFIG_USB_DEVICE_BLUETOOTH_VS_H4=y

CONFIG_MAIN_STACK_SIZE=1024
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1024

CONFIG_BT_CTLR_RX_BUFFERS=18
CONFIG_BT_CTLR_TX_BUFFERS=19
CONFIG_BT_CTLR_TX_BUFFER_SIZE=251
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_HCI_CMD_COUNT=20
CONFIG_BT_RX_BUF_COUNT=20
CONFIG_BT_RX_BUF_LEN=258
CONFIG_BT_DISCARDABLE_BUF_SIZE=257
CONFIG_BT_MAX_CONN=24

CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_PHY_UPDATE=y
CONFIG_BT_AUTO_PHY_UPDATE=y
CONFIG_BT_LLL_VENDOR_NORDIC=y
CONFIG_BT_LL_SW_SPLIT=y

I trying to scan and connect a Coded PHY device, which is nRF52-PCA10056 board running the Long Range Demo (Nordic's Solution). I can not reach the board when board is advertising via CODED PHY but I can reach it when it advertising via 1M PHY.

Since automatic PHY update is activated, I tried to change it via hcitool, following command: hcitool cmd 08 31 03 04 04 and I got the following answer at btmon:

< HCI Command: LE Set Default PHY (0x08|0x0031) plen 3 #28 [hci0] 540.203681
All PHYs preference: 0x03
No TX PHY preference
No RX PHY preference
TX PHYs preference: 0x04
LE Coded
RX PHYs preference: 0x04
LE Coded

HCI Event: Command Complete (0x0e) plen 4 #29 [hci0] 540.205957
LE Set Default PHY (0x08|0x0031) ncmd 1
Status: Success (0x00)

But still, no Coded PHY device cannot scannable via my Zephyr USB HCI Bluetooth controller.
Any help will appreciated. Thanks in advance.

Top Replies

  • AFAIK, hcitool is deprecated in upstream bluez. I recommend using bluetoothctl instead. Here's a blog post with a few commands: https://hasanyavuz.ozderya.net/?p=423

  •  

    I'm not sure how your progress is going but I was looking at the Apache Mynewt BLE stack. The devs there responded and said that setting LE coded phy is supported in their HCI example https://mail-archives.apache.org/mod_mbox/mynewt-dev/202009.mbox/%3CCAAEJBh%2BwCue4NoXnc032y1QTWvtOaqHeCbGV8L2WkCfD8Yj4ZA%40mail.gmail.com%3E

  • Thanks for let us know about that.

    Now that I got following configuration in prj.conf

    CONFIG_STDOUT_CONSOLE=y
    CONFIG_GPIO=y
    CONFIG_SERIAL=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    
    CONFIG_BT=y
    CONFIG_BT_HCI_RAW=y
    CONFIG_BOARD_NRF52840DK_NRF52840=y
    
    CONFIG_USB=y
    CONFIG_USB_DEVICE_STACK=y
    CONFIG_USB_DEVICE_BLUETOOTH=y
    CONFIG_USB_DEVICE_BLUETOOTH_VS_H4=y
    
    CONFIG_BT_LL_NRFXLIB=y
    
    CONFIG_MAIN_STACK_SIZE=1024
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1024
    
    CONFIG_BT_CTLR_RX_BUFFERS=18
    CONFIG_BT_CTLR_TX_BUFFERS=19
    CONFIG_BT_CTLR_TX_BUFFER_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    CONFIG_BT_HCI_CMD_COUNT=20
    CONFIG_BT_RX_BUF_COUNT=20
    CONFIG_BT_RX_BUF_LEN=258
    CONFIG_BT_DISCARDABLE_BUF_SIZE=257
    CONFIG_BT_MAX_CONN=10
    
    CONFIG_BT_CTLR_PHY_CODED=y
    CONFIG_BT_PHY_UPDATE=y
    CONFIG_BT_AUTO_PHY_UPDATE=y
    CONFIG_BT_LLL_VENDOR_NORDIC=y
    CONFIG_BT_LL_SW_SPLIT=y
    CONFIG_BT_USER_PHY_UPDATE=y
    CONFIG_BT_EXT_ADV=y
    CONFIG_BT_CTLR_ADVANCED_FEATURES=y
    CONFIG_BT_CTLR_ADV_EXT=y

    When I done the configuration which is in the very first post, linux host recognize the controller as a extended scan and advertising device, and I cannot done any legacy operation.

    I configured all the same settings but NRFXLIB, but now the linux host do not recognize the HCI device as extended operational. When I send distinct HCI commands, i.e hcitool cmd 0x08 0x0042 0x01 0x00 0x10 0x00 0x10 0x00 (extended scan enable), host returns that unknown HCI command. Am i missing any point through? Thanks in advance.

  • Martin Rev said:
    Zephyr open source controller does not support long range.

     The SoftDevice Controller in nRF Connect SDK supports Coded PHY (Long Range). If you are on the master branch, you can switch to using the SoftDevice controller by setting CONFIG_BT_LL_SOFTDEVICE=y.

  • Hi ,

    I posted on Zephyr's mailing list because I couldn't get some of the LE command functions to be exposed. The Zephyr developer on the thread responded with this message which makes me think what we are trying to do is not going to work.

    https://lists.zephyrproject.org/g/users/message/2239

    I'll quote from the thread here:

    1. Zephyr open source controller does not support long range. The feature is under development by our contributors.

    I've asked the developer specifically if the HCI layer does not support the LE coded phy feature as I get confused by the different BLE and Zephyr terminology.

Related