Hi,
is it possible to scan and advertise at the same time use the integrated BLE in ESP32? I use NIMBLE stack and version 4.3 of the ESP-IDF.
Can I start advertising and periodically scan for other devices without stopping advertising?
I added a Wireshark BLE sniffer log. The central can't connect to the ESP32 sometimes. ESP32 doesn't respond to the CONNECT_IND which is sent in packet 8931.
Simultaneous BLE Scanning/Advertising
Simultaneous BLE Scanning/Advertising
- Attachments
-
- disconnect_574.png (69.15 KiB) Viewed 5918 times
-
- Posts: 42
- Joined: Wed Dec 09, 2015 6:39 pm
Re: Simultaneous BLE Scanning/Advertising
Yes, this does work. The application I'm currently working on does like this....
* ble init...
* from on_sync...
* start advertising
* start discovery
* in ble_gap_event....
* use BLE_GAP_EVENT_DISC to handle client connectiong
* on BLE_GAP_EVENT_CONNECT, DISCONNECT, ADV_COMPLETE restart advertising
The code for this can be found here. https://gitlab.com/morganrallen/barback ... main/ble.c
* ble init...
* from on_sync...
* start advertising
* start discovery
* in ble_gap_event....
* use BLE_GAP_EVENT_DISC to handle client connectiong
* on BLE_GAP_EVENT_CONNECT, DISCONNECT, ADV_COMPLETE restart advertising
The code for this can be found here. https://gitlab.com/morganrallen/barback ... main/ble.c
Re: Simultaneous BLE Scanning/Advertising
Short answer, YES, it is possible, just make sure you dont setup very short interval and window for scan and very short advertising interval.
Re: Simultaneous BLE Scanning/Advertising
I scan during 5 sec with an interval of 10 sec. Is that ok? I constantly advertise.
rc = ble_gap_disc(own_addr_type, 5000/*600*/, &disc_params, passive_scan_event, NULL);
When I restart advertising do I need to call these functions:
ble_gap_adv_stop
ble_gap_adv_start
Or do I only need to call this function:
ble_gap_adv_start
rc = ble_gap_disc(own_addr_type, 5000/*600*/, &disc_params, passive_scan_event, NULL);
When I restart advertising do I need to call these functions:
ble_gap_adv_stop
ble_gap_adv_start
Or do I only need to call this function:
ble_gap_adv_start
Re: Simultaneous BLE Scanning/Advertising
Hi,
I would like to know whether the advertising is not stopped while scanning for other devices since esp32 has a shared antenna for both purposes.
I would like to know whether the advertising is not stopped while scanning for other devices since esp32 has a shared antenna for both purposes.
Who is online
Users browsing this forum: No registered users and 87 guests