Dear all,
I am trying to build bluetooth hci controller for Home Assistant.
I used official example for create usb bluetooth hci controller here:
~/ncs/v3.2.0/zephyr/samples/bluetooth/hci_usb
Due to the fact I want to listen to sensor which uses extended advertising and PHY CODED, I modified prj.conf to activate extended advertising and PHY CODED this way:
CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_SERIAL=n
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_USB_DEVICE_STACK_NEXT=y
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=n
CONFIG_SAMPLE_USBD_PID=0x000B
CONFIG_SAMPLE_USBD_PRODUCT="Zephyr USBD BT HCI"
CONFIG_USBD_BT_HCI=y
CONFIG_BT_CTLR_ADV_EXT=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191
CONFIG_BT_CTLR_ADV_SET=1
#added
CONFIG_BT_CTLR_PHY_CODED=y
With this setup I can listen to PHY CODED devices even in Home Assistant. But there is a problem. Home Assistant OS does not support hcitool commands. So I need to run Home Asisstant on top of Raspberry Pi OS in docker and on this setup I can control bluez stack as I wish, but definitely, I have to issue a command:
hcitool cmd 0x08 31 00 04 04 to activate PHY CODED (in btmgmt tool i see LECODEDRX,LECODEDTX).
Only then I see sensor advertising via PHY CODED.
What I wanted to achieve is the same purpose in Home Assistant OS. The problem is that in Home Assistant OS (without Raspberry Pi OS), I cannot issue command:
hcitool cmd 0x08 31 00 04 04
It simply is not possible, Home Assistant OS does not expose hcitool nor btmgmt commands which casual Linux can
BUT since I think hcitool just sends command to the bluetooth nrf52840 chip to activate PHY CODED, isn't it possible to activate PHY CODED on firmware level of NordicSDK/Zephyr build? I mean, I want to mimic the behaviour of hcitool command right on the firmware level of Zephyr and activate,what hcitool activates,directly in firmware, not on OS Linux level.
Does anyone know if this is even possible?
I tried a simple tuning on prj.conf like this:
#CONFIG_BT_CTLR_PHY=y
#CONFIG_BT_CTLR_PHY_CODED_SUPPORT=y
#CONFIG_HAS_BT_CTLR=y
#CONFIG_BT_HCI=y
#CONFIG_BT_PHY_UPDATE=y
#CONFIG_BT_AUTO_PHY_UPDATE=y
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_OBSERVER=y
But none of these settings make any sense for me and I cannot find any reasonable example how to modify the sample to activate PHY CODED from start actually I hope the command
hcitool cmd 0x08 31 00 04 04 does exactly what I am describing, I am not an expert in this.
Thank you