2022-04-25 01:52 AM
Hi,
I'm trying to program a Connectionless Observer that scans all ADV_NONCONN_IND adv events, but the hci_le_advertising_report_event() callback isn't called. I'm using BLE_STACK_FULL_CONF and I have this configuration:
// Init GAP
aci_gap_init(GAP_OBSERVER_ROLE, 0x00, 0x08, PUBLIC_ADDR, &service_handle, &dev_name_char_handle, &appearance_char_handle);
// SCAN CONFIG
status = aci_gap_set_scan_configuration ( DUPLICATE_FILTER_DISABLED,
ADV_NO_WHITE_LIST_USE,
LE_1M_PHY_BIT,
PASSIVE_SCAN,
0x4000,
0x4000
);
// EVENT MASK
uint8_t eventMask[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02};
status = hci_le_set_event_mask(eventMask);
// SCAN ENABLE
status = hci_le_set_scan_enable(1,0);
I don't get any state error. What am I doing wrong?
Solved! Go to Solution.
2022-05-06 01:10 AM
Hi!,
The solution is: use aci_gap_start_procedure() instead of hci_le_set_scan_enable(). Event mask isn't necessary because the event is enabled by default.
Regards!
2022-04-29 12:24 AM
I face exactly the same problem!
A scanning of BLE beacons is generally possible. All PDU-types generate an event, but beacons of type ADV_NONCONN_IND (Non connectable undirected advertising) dont!
BLE beacons of PDU-types ADV_IND, ADV_SCAN_IND, SCAN_RSP do generate an event and can be received!
I have tried all possible settings in aci_gap_set_scan_configuration(), but NEVER received beacons of type ADV_NONCONN_IND .
I wonder, if the problem is in the BLE stack (or correct initialization of this stack). I have even tried the new BlueNRG-BLE Stack Library v3.1a (included in STSW-BNRGLP-DK v1.2.0 released in April 2022. Unfortunately still the same behavior!
Passive scanning of ADV_NONCONN_IND beacons is even used in the application note AN5508 from ST (SocialDistancing Detection using Bluetooth® Low Energy). So there must be a way to successfully scan those BLE-beacons!
Please support us in this issue or maybe there is a source code to this application note AN5508 available.
best regards and thanks for any support!
2022-05-02 12:40 AM
Hi @WLech.1, thanks you for the reply.
I haven't got it yet. I hadn't read the application note AN5508, I will research about it. If I
get something I will tell you.
Thanks you and regards!
2022-05-06 01:10 AM
Hi!,
The solution is: use aci_gap_start_procedure() instead of hci_le_set_scan_enable(). Event mask isn't necessary because the event is enabled by default.
Regards!
2022-05-06 01:57 AM
wow
You solved my Problem!
Actually, I was calling aci_gap_start_procedure(), but with the wrong parameter...
aci_gap_start_procedure(GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC, LE_1M_PHY_BIT, 0, 0);
now:
aci_gap_start_procedure(GAP_GENERAL_DISCOVERY_PROC, LE_1M_PHY_BIT, 0 ,0);
now I receive all ADV_NONCONN_IND beacons reliably 😀
Thanks a lot!!
You deserve 5 beer for free😎
2022-05-06 02:05 AM
Thanks hahaha!
I'm using GAP_OBSERVATION_PROC instead of GAP_GENERAL_DISCOVERY_PROC. If you aren't waiting an inqury, I think you should do the same.
Luck!