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");