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
  • 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!

Reply
  • 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!

Children
  • Hi, 

    Bluetooth range is affected by many factors, and an issue when trying to predict what kind of range you get when phones is involved is that the radio performance of the phone itself is an unknown factor. 

    embeddedER said:
    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 would suggest using two nRF53833 to test instead of the mobile device. What is the device, custom board or nRF53833DK? Can you test with nRF52833DK?

    If you want to test with the phone, Please check the phone support Coded PHY or not as this post indicated. from nRFConnect mobile app manual (left top) -> Device information.  

    embeddedER said:
    My question here is, how do we configure S=2 or S=8 in adv packets?

    If you use I.E. the HR_Coded examples in NCS, the simplest way to implement S=2 would be to do it as part of a connection PHY parameter by calling bt_conn_le_phy_update(). See https://github.com/nrfconnect/sdk-zephyr/blob/main/include/zephyr/bluetooth/conn.h#L491. The preferred coding scheme is part of the PHY options: https://github.com/nrfconnect/sdk-zephyr/blob/main/include/zephyr/bluetooth/conn.h#L90 

    embeddedER said:
    Is there anything else that needs to be configured for the maximum range?

    Please make sure in the logs or sniffer that you in fact have a coded phy connection. 

    what is the TX power for each set to?  The TX power is 0 dBm by default in the existing Bluetooth: Peripheral Heart Rate Monitor with Coded PHY and Bluetooth: Central Heart Rate Monitor with Coded PHY sample. To change this you have to send a HCI command to the Bluetooth controller as demonstrated by the Bluetooth: HCI Power Control sample. This post might help. 

    If you do in fact use Coded PHY but still only see this tiny increase in range, here are a few reasons for this:

    • Your test environment is noisier at >700m.
    • The custom board is not able to transmit longer than this for some reason. Not optimal antenna tuning or the application is not transmitting messages on the Coded PHY optimally.
    • Weather conditions during testing (rain/snow will decrease range considerably)

    -Amanda

  • Hi Amanda,

    Appreciate your detailed response.

    Few clarifications from my end:

    - I am aware of the factors affecting range (txpower, antenna, environment etc). That's the reason I mentioned I am using same environment to test default vs coded phy.

    - I used mobile, just to verify that I am sending data using Coded PHY. In the nRF app, I do see primary and secondary phy as "LE Coded" which means we have setup transmitter correctly with Coded PHY. For our testing we are using 2 nrf52833 dev boards (fanstel). On the scanner as well I am printing primary/secondary phy for advertisements which shows "LE Coded".

    - We have already tested txpower=4/8 with nrf52833 and planning to tune that as per our final need. Since txpower comes with a trade-off of high power consumption and our solution is battery operated device.

    Ultimately the answer that we are trying to get here is: with the same setup/antenna/env/txpower how much coded phy out perform default phy?

    Since our application uses advertisement packets with our data stuffed in it, we are trying to get max range with these adv packets.

    Changes you mentioned in bt_conn_le_phy_update(), does it affect the advertisement packets as well? My assumption is, S=2/S=8 will come into affect only after connection, is that right?

    Is there any other configuration (apart from txpower/antenna) that can help to improve the range of Coded PHY advertisement packets?

    TIA!

Related