Hello everyone.
I've been struggling with directed advertising for a few days now...
I found an example for the peripheral (github.com/.../direct_adv).
Everything works on my smartphone in the NRF Connect app, create a bond, then the peripheral switches to directed advertising mode, and I start seeing in the scanner and connected to them (I don't see these ads on other smartphones, of course).
The problem occurs on the central unit on the nRF52840-DK hardware platform.
On the peripherals, I manually specified the central unit's address (the actual address after bonding).
But when scanning with bt_le_scan_start(), I don't see the peripheral device address, and it doesn't connect via bt_conn_le_create_auto().
bt_addr_le_t addr = {
.type = BT_ADDR_LE_RANDOM,
.a.val = { 0xA2, 0xC7, 0xA0, 0x96, 0x1A, 0xC4 } // address of central C4:A1:96:A0:C7:A2 (random)
};
struct bt_le_adv_param adv_params;
adv_params = *BT_LE_ADV_CONN_DIR_LOW_DUTY(&addr);
adv_params.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA;
bt_le_adv_start(&adv_params, NULL, 0, NULL, 0);
The central is not connected, although the bonded devices and the peripheral address are added to accept list for bt_conn_le_create_auto()
If you turn on regular advertising, everything connects.