Active Scanning and Advertising Conflict

Hello All,

I have a problem about conflict between Active Scanning and Advertising when I build my project from sample central_uart &  peripheral_uart.

I want my nrf5340 scan and advertise at same time. When I use bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE)  before  bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)), nrf5340 can't start advertising with log warning <wrn> bt_hci_core: opcode 0x2005 status 0x0c.

But when I start advertising before active scanning, everything works well. 

Besides, when I use passive scanning, scanning and advertising both work well regardless of calling order.

I wonder what caused this problem.

Thank you.

	err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad),
			      sd, ARRAY_SIZE(sd));
	if (err) {
		printk("Advertising failed to start (err %d)\n", err);
		return;
	}
	LOG_INF("Advertising successfully started");

	err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE);
	if (err) {
		LOG_ERR("Scanning failed to start (err %d)", err);
		return;
	}

	LOG_INF("Scanning successfully started");

Parents
  • Hello,

    Please build your project with CONFIG_BT_SCAN_WITH_IDENTITY=y and try again.

    From one of the developers:

    "The problem is that there is a single random address, and the scanner and advertiser has to share it.
    The scanner is using "privacy" (even though privacy is not enabled).
    You can either disable this: CONFIG_BT_SCAN_WITH_IDENTITY=y
    Or enable use of extended advertising HCI commands: CONFIG_BT_EXT_ADV=y No longer a a single random address that has to be shared."

    Best regards,

    Vidar

Reply
  • Hello,

    Please build your project with CONFIG_BT_SCAN_WITH_IDENTITY=y and try again.

    From one of the developers:

    "The problem is that there is a single random address, and the scanner and advertiser has to share it.
    The scanner is using "privacy" (even though privacy is not enabled).
    You can either disable this: CONFIG_BT_SCAN_WITH_IDENTITY=y
    Or enable use of extended advertising HCI commands: CONFIG_BT_EXT_ADV=y No longer a a single random address that has to be shared."

    Best regards,

    Vidar

Children
Related