Re: BlueZ PHY CODED scan via HCI UART on nRF52840_pca10056 #ble #nrf52840 #uart #hci


arne@...
 

With a 5.10.11 linux kernel and bluez-5.55, setting PHY in btmgmt still doesn't work due to a bug in the kernel. You can easily work around that by using hcitool:


# set default phy to encoded
hcitool -i hci0 cmd 08 31 03 04 04 


after which btmgmt reports the correct phy:

[mgmt]# phy

Supported phys: LE1MTX LE1MRX LE2MTX LE2MRX LECODEDTX LECODEDRX

Configurable phys: LE2MTX LE2MRX LECODEDTX LECODEDRX

Selected phys: LECODEDTX LECODEDRX

Then I had to change some zephyr code to report support for extended scan parameters and LE extended creation connection:

diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c

index 82c7785068..a46a6680f9 100644

--- a/subsys/bluetooth/controller/hci/hci.c

+++ b/subsys/bluetooth/controller/hci/hci.c

@@ -671,6 +671,11 @@ static void read_supported_commands(struct net_buf *buf, struct net_buf **evt)

      BIT(6) | BIT(7);

  /* LE Remove Adv Set, LE Clear Adv Sets */

  rp->commands[37] |= BIT(0) | BIT(1);

+

+ /* LE Set Extended Scan Parameters, set extended scan enable */

+ rp->commands[37] |= BIT(5) | BIT(6);

+ /* LE Extended Create Connection */

+ rp->commands[37] |= BIT(7);

 #endif /* CONFIG_BT_CTLR_ADV_EXT */

 #endif /* CONFIG_BT_BROADCASTER */

 
With all this, I can only see some coded PHY extended advertisements.  The Nordic long range demo running on an nRF52840 dk in EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED mode for example shows up:

[bluetooth]# scan on

Discovery started

[CHG] Controller F7:7C:28:9D:3F:43 Discovering: yes

[CHG] Device DA:BC:1B:2C:89:2D RSSI: -46

[CHG] Device DA:BC:1B:2C:89:2D RSSI: -63

HCI Event: LE Meta Event (0x3e) plen 42                                                                                                                                                                          #1148 [hci0] 82955.304690

      LE Extended Advertising Report (0x0d)

        Num reports: 1

        Entry 0

          Event type: 0x0021

            Props: 0x0001

              Connectable

            Data status: Incomplete, more data to come

          Address type: Random (0x01)

          Address: DA:BC:1B:2C:89:2D (Static)

          Primary PHY: LE Coded

          Secondary PHY: LE Coded

          SID: 0x00

          TX power: 127 dBm

          RSSI: -45 dBm (0xd3)

          Periodic advertising invteral: 0.00 msec (0x0000)

          Direct address type: Public (0x00)

          Direct address: 00:00:00:00:00:00 (OUI 00-00-00)

          Data length: 0x10

        02 01 06 0f 09 4e 6f 72 64 69 63 5f 41 54 54 5f  .....Nordic_ATT_

@ MGMT Event: Device Found (0x0012) plen 14                                                                                                                                                                     {0x0002} [hci0] 82955.311211

        LE Address: 00:00:00:00:00:00 (OUI 00-00-00)

        RSSI: 0 dBm (0x00)

        Flags: 0x00000000

        Data length: 0


It kinda feels like the advertisements are being buffered or blocked somewhere; you can be scanning for several seconds and get nothing, only for 5 to arrive at the same time (in btmon). And not all coded PHY advertisers show up.

Arne




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