nRF5 SDK is not maintained anymore
More Info: Consider nRF Connect SDK for new designs

nrf52833 + Long Range + Scanner

Hello Team,

We are in process of verifying Long Range on nrf52833.

Setup: nrf52833 + ncs v1.8.0

We have developed an Long Range (CODED PHY) advertisement sample and it works fine, We could see advertisement packets on the nRF mobile application with Coded PHY.

However, while development of scanner we are facing issues. We modified scan sample to pick up only CODED PHY packets, however, it still picks up only 1M packets. Could you please check below code that we are using and suggest what's missing? Please note, we are doing this with ncs v1.8.0

Scan functions:

static const char *peer_name[] = {
	[0] = "LR1",
	[1] = "LR2",
};


static void scan_filter_match(struct bt_scan_device_info *device_info,
			      struct bt_scan_filter_match *filter_match,
			      bool connectable)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(device_info->recv_info->addr, addr, sizeof(addr));

    printk("Filters matched. Peer Name: %s connectable: %d\n",
		filter_match->name.name, connectable);

	if(0 == strncmp(filter_match->name.name, peer_name[0], strlen(peer_name[0])))
	{
	    printk("Filters matched. Peer-0\n");
	}
	else if(0 == strncmp(filter_match->name.name, peer_name[1], strlen(peer_name[1])))
	{
	    printk("Filters matched. Peer-1\n");
	}
}

BT_SCAN_CB_INIT(scan_cb, scan_filter_match, NULL, NULL, NULL);

static int scan_init(void)
{
	int err;
	struct bt_le_scan_param scan_param = {
		.type     = BT_LE_SCAN_TYPE_ACTIVE,
		.interval = BT_GAP_SCAN_FAST_INTERVAL,
		.window   = BT_GAP_SCAN_FAST_WINDOW,
		.options  = BT_LE_SCAN_OPT_CODED | BT_LE_SCAN_OPT_NO_1M
//		.options  = BT_LE_SCAN_OPT_CODED
	};

	struct bt_scan_init_param scan_init = {
		.connect_if_match = 0,
		.scan_param = &scan_param,
		.conn_param = NULL
	};

	bt_scan_init(&scan_init);
	bt_scan_cb_register(&scan_cb);

	//err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_UUID, BT_UUID_NUS_SERVICE);
	err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, peer_name[0]);
	if (err) {
		printk("Scanning filters cannot be set (err %d)", err);
		return err;
	}

	err = bt_scan_filter_add(BT_SCAN_FILTER_TYPE_NAME, peer_name[1]);
	if (err) {
		printk("Scanning filters cannot be set (err %d)", err);
		return err;
	}

	err = bt_scan_filter_enable(BT_SCAN_NAME_FILTER, false);
	if (err) {
		printk("Filters cannot be turned on (err %d)", err);
		return err;
	}

	printk("Scan module initialized\n");
	return err;
}

Main function:

main() {
	...
	scan_init();
	err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE);
	if (err) {
		printk("Scanning failed to start (err %d)\n", err);
		return;
	}
	...
}

prj.conf

...
CONFIG_BT_CENTRAL=y
CONFIG_BT_SCAN=y
CONFIG_BT_SCAN_FILTER_ENABLE=y
CONFIG_BT_SCAN_UUID_CNT=1
CONFIG_BT_GATT_DM=y
CONFIG_BT_SCAN_NAME_CNT=3
...

With above code, we can still pick up 1M adv packets but not the CODED PHY.

TIA!

  • Just to add some more information, our adv parameters are:

        struct bt_le_adv_param param =
            BT_LE_ADV_PARAM_INIT(
                         BT_LE_ADV_OPT_USE_NAME | BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_CODED | BT_LE_ADV_OPT_EXT_ADV,
                         BT_GAP_ADV_FAST_INT_MIN_2,
                         BT_GAP_ADV_FAST_INT_MAX_2,
                         NULL);

    So, it's extended Advertisements. And we can see them on nrfConnect App on S22 with primary and secondary PHY set as "LE Coded".
    Are there any changes that we need to sniff/scan extended adv packets with nrf52833?
  • Hi, 

    Did you enable CONFIG_BT_CTLR_PHY_CODED=y in the scan sample? I would suggest taking a look at the prj.conf and main.c of the Bluetooth: Central Heart Rate Monitor with Coded PHY sample. 

    Regards,
    Amanda

  • Hi Amanda,

    Thanks! I got it working after checking the configuration in the sample. With changes, I do see primary and secondary PHY of my adv as "LE Coded" now. However, I don't observe much change in the range compared to default phy.

    I've kept the advertiser and scanner at a distance where I see drop in few packets with default phy. Then I replaced the default phy with Coded PHY and was expecting better performance (in terms of packets dropped) at the same distance. But I don't see much difference, even at the same distance, I see packets dropped with both default/coded phy. I am using same txpower for both the case. And experiments are done using nrf52833 on both the sides.

    Is there anything else I need to configure to increase the range of advertisement packets with the Coded PHY?

    This is what I changed to make my advertisements coded PHY.

    	struct bt_le_adv_param param =
    		BT_LE_ADV_PARAM_INIT(
    				     BT_LE_ADV_OPT_USE_NAME | BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_CODED | BT_LE_ADV_OPT_EXT_ADV,
    				     BT_GAP_ADV_FAST_INT_MIN_2,
    				     BT_GAP_ADV_FAST_INT_MAX_2,
    				     NULL);
    

    TIA!

  • Hi Amanda,

    I am currently measuring the range in the lab (not with clear line of sight). And it's around 30 meters where I see packets getting dropped with a default phy. At the same location, I am expecting Coded PHY to perform better. Also, I've confirmed adv packets are coded PHY in the scanner side by printing the data from adv packets on terminal and also using the nRF mobile App.

    I've exact same configuration as mentioned in the sample application. My question here is, how do we configure S=2 or S=8 in adv packets? Is there anything else that needs to be configured for the maximum range?

    TIA!

Related