Hello,
we are using esp-idf 4.3 and using the device as both BLE peripheral and BLE central. When the central is trying to connect to a device using function ble_gap_connect it is impossible for a central device (mobile phone in this case) to connect to the peripheral.
Is this a known issue? Is there a workaround for this problem?
BLE peripheral and central simultaneously
Re: BLE peripheral and central simultaneously
This is not an issue. Connect, scan and advertise are pretty intensive for radio and cant occupy radio at the same time.
For example it is highly advised to stop scan when you are trying to connect to peripheral and advertising should be stopped by low level API whn central is trying to connect to esp32 in peripheral mode.
For example it is highly advised to stop scan when you are trying to connect to peripheral and advertising should be stopped by low level API whn central is trying to connect to esp32 in peripheral mode.
Re: BLE peripheral and central simultaneously
This is what the code is doing:
1) Advertising is started from on_sync() function and restarted at CONNECT and DISCONNECT event using
ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER,&adv_params, test_gap_event, NULL);
2) Every 10th second a scanning to to fins peripherals is performed using this function
rc = ble_gap_disc(own_addr_type, 5000/*600*/, &disc_params, passive_scan_event, NULL);
With another ESP32 I send CONNECT and DISCONNECT every 3rd second and sometimes this ESP32 is not able to connect to the ESP32 which is both peripheral and central. The wireshark log attached catches the unsuccessful connect that occurs sometimes. The connect request is sent in packet 8931 and as can be observed the ESP32 doesn't response to this request. How can this faulty behavior be explained? In the log you can also see that the ESP32 starts advertising 3 seconds after the connect request (packet 8938).
1) Advertising is started from on_sync() function and restarted at CONNECT and DISCONNECT event using
ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER,&adv_params, test_gap_event, NULL);
2) Every 10th second a scanning to to fins peripherals is performed using this function
rc = ble_gap_disc(own_addr_type, 5000/*600*/, &disc_params, passive_scan_event, NULL);
With another ESP32 I send CONNECT and DISCONNECT every 3rd second and sometimes this ESP32 is not able to connect to the ESP32 which is both peripheral and central. The wireshark log attached catches the unsuccessful connect that occurs sometimes. The connect request is sent in packet 8931 and as can be observed the ESP32 doesn't response to this request. How can this faulty behavior be explained? In the log you can also see that the ESP32 starts advertising 3 seconds after the connect request (packet 8938).
- Attachments
-
- disconnect_574.png (69.15 KiB) Viewed 3927 times
Re: BLE peripheral and central simultaneously
Sorry, i cant help you with that.
With nimble i am having similar situation trying to connect from smartphone (nrf connect) and every single time 1st connect try fails, or i am just disconnected, and 2nd connect is always success. This is something i will investigate later, and this may be not related with your issue, since i am using arduino.
With nimble i am having similar situation trying to connect from smartphone (nrf connect) and every single time 1st connect try fails, or i am just disconnected, and 2nd connect is always success. This is something i will investigate later, and this may be not related with your issue, since i am using arduino.
Who is online
Users browsing this forum: Bing [Bot] and 86 guests