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!

Parents
  • 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?
Reply
  • 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?
Children
No Data
Related