[TW#11125] BLE connect to non-advertising peripheral

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: BLE connect to non-advertising peripheral

Postby dave111 » Tue Mar 28, 2017 11:02 pm

I am really only using this: https://github.com/espressif/esp-idf/bl ... emo.c#L114 with 1 line modified. In line 114 I replaced esp_ble_gap_set_scan_params() with esp_ble_gattc_open(gattc_if, bda, true). This will skip scanning and should work with all advertising peripherals, if you provide the correct bt-mac as 2nd argument.

I come to the conclusion that I would like to be able to do "GATT over conventional Bluetooth" also on my esp32 as a solution to my original problem. To try this out (dirty hack coming) I added the following line to my copy of gatt_main.c on top of method gatt_connect():

Code: Select all

transport = BT_TRANSPORT_BR_EDR; // my hack to force L2CA_ConnectReq()
This is supposed to mimic the Android behaviour described above. When I run gattc_demo.c on top of this now, my esp32 DOES! reach my non-advertising peripheral for the first time. But for an unknown reason, it is not able to establish a full connection yet. Every time I try, my peripheral complains: "E bt_btm : btm_read_remote_features_complete failed (status 0x08)". Odd. Is anyone aware what this could mean?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: BLE connect to non-advertising peripheral

Postby kolban » Wed Mar 29, 2017 1:04 am

The last time I looked, BT classic (BR/EDR) is not yet supported ... that obviously may have changed ... hopefully someone can comment if they know different ... but for me, I'd assume it is NOT yet working.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: BLE connect to non-advertising peripheral

Postby dave111 » Wed Mar 29, 2017 10:09 pm

What is the exact situation with BT classic on ESP32 currently?

It appears to be working partly. Status 0x08 in the error message referenced above ("btm_read_remote_features_complete failed (status 0x08)") stands for HCI_ERR_CONNECTION_TOUT.

Is a HCI connection timeout an expected callee side behaviour, if contacted by ESP32 with the current implementation (BR/EDR)?

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: BLE connect to non-advertising peripheral

Postby dave111 » Fri Mar 31, 2017 7:57 am

By looking at my logs, I more and more get the impression that "Gatt over BR" (Core spec 4.2, Vol 3, Part G, sect 9) may be fully implemented already. And that all I need to do, to fix my HCI connection problem, is to PAIR! the devices.

Can someone pls help me write a simple auto-pairing app? (I do not need full BT Classic.)

Guayer
Posts: 1
Joined: Thu Mar 14, 2019 1:55 pm

Re: [TW#11125] BLE connect to non-advertising peripheral

Postby Guayer » Tue Mar 26, 2019 11:31 am

dave111 wrote:
Mon Mar 20, 2017 5:16 am
Hello,
I have some BLE peripherals that intentionally do not advertise themselves. Using an Android app I wrote, I am able to connect to these devices - no problem at all. But I am unable to get this to work on the ESP32. Here I wait for ESP_GATTC_REG_EVT and then, instead of calling esp_ble_gap_set_scan_params(), I directly call esp_ble_gattc_open(gattc_if, [hardcoded target address], true). But this does not establish a connection. Is there maybe a hard requirement for BLE scanning to always go first, before a connection can be established? This should not be the case.
Thank you.
Hi,
dave111, could you please give more characteristics of this silent peripheral? Which BLE chip does it uses? Do you know any other example of peripheral that is able to connect without advertising?
Thanks in advance.

Who is online

Users browsing this forum: Google [Bot], KaosESP32 and 163 guests