This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Active scan throughput is poor on nRF5340 using nRF BLE Controller.

I try to run samples/bluetooth/scan_adv on nRF52840/nRF5340 using nRF BLE Controller..

Result is
nRF52840/active scan:  498 packet/s
nRF52840/passive scan:  507 packet/s

nRF5340(NetCore)/active scan: 69 packet/s
nRF5340(NetCore)/passive scan: 421 packet/s

Why nRF5340(NetCore)/active scan is poor?

sample source

/* main.c - Application main entry point */

/*
 * Copyright (c) 2015-2016 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr/types.h>
#include <stddef.h>
#include <sys/printk.h>
#include <sys/util.h>

#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>

static u8_t mfg_data[] = { 0xff, 0xff, 0x00 };

static const struct bt_data ad[] = {
	BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, 3),
};

volatile uint32_t s_recv_count;

static void scan_cb(const bt_addr_le_t *addr, s8_t rssi, u8_t adv_type,
		    struct net_buf_simple *buf)
{
	mfg_data[2]++;
	s_recv_count++;
}

void main(void)
{
	struct bt_le_scan_param scan_param = {
		.type		= BT_HCI_LE_SCAN_ACTIVE,
//		.type       = BT_HCI_LE_SCAN_PASSIVE,
		.filter_dup = BT_HCI_LE_SCAN_FILTER_DUP_DISABLE,
		.interval   = 0x0010,
		.window     = 0x0010,
	};
	int err;

	printk("Starting Scanner/Advertiser Demo\n");

	/* Initialize the Bluetooth Subsystem */
	err = bt_enable(NULL);
	if (err) {
		printk("Bluetooth init failed (err %d)\n", err);
		return;
	}

	printk("Bluetooth initialized\n");

	err = bt_le_scan_start(&scan_param, scan_cb);
	if (err) {
		printk("Starting scanning failed (err %d)\n", err);
		return;
	}

	do {
		k_sleep(K_MSEC(400));

#if 0
		/* Start advertising */
		err = bt_le_adv_start(BT_LE_ADV_NCONN, ad, ARRAY_SIZE(ad),
				      NULL, 0);
		if (err) {
			printk("Advertising failed to start (err %d)\n", err);
			return;
		}

		k_sleep(K_MSEC(400));

		err = bt_le_adv_stop();
		if (err) {
			printk("Advertising failed to stop (err %d)\n", err);
			return;
		}
#endif
	} while (1);
}

Parents Reply
  • I checkout fw-nrfconnect-nrf(master SHA-1: 2a63123c5c68d1b3f6668d47c0a5d8ad2fcc665d)
    And rebuild scan_adv.
    Result is same. (nRF5340 active scan is poor.)

    There are strange things.

    If there are only about 100 advertises per seconds in the space, about 90 advertises be received for both active and passive.
    However, if there is about 1000 advertises per seconds in the space, be received about 500 advertises on passives and about 60 advertises on actives will be received.

Children
Related