esp-at icon indicating copy to clipboard operation
esp-at copied to clipboard

Allow scanning in BLEINIT 2 (dual role)

Open mrx23dot opened this issue 1 year ago • 12 comments

Is your feature request related to a problem?

When I don't advertise I should be able to scan for BLE devices.

Currently I have reboot to change between AT+BLEINIT=2 and AT+BLEINIT=1 just to start scanning.

Describe the solution you'd like.

No response

Describe alternatives you've considered.

No response

Additional context.

No response

mrx23dot avatar Jul 24 '23 15:07 mrx23dot

tested with ESP32-WROOM-32-AT-V2.4.0.0

mrx23dot avatar Jul 24 '23 15:07 mrx23dot

@mrx23dot could you please describe what you need in details, thanks.

ustccw avatar Jul 28 '23 09:07 ustccw

AT+RST
OK
ready

AT+BLEINIT=2
OK

// no connection/advertising at this time 

AT+BLESCAN=1,3
ERROR

I don't want to reboot just to do a scan in AT+BLEINIT=1

mrx23dot avatar Jul 28 '23 09:07 mrx23dot

@Luxin812 PTAL

ustccw avatar Jul 31 '23 02:07 ustccw

@mrx23dot This function will be supported recently, if there is an update, we will let you know the result as soon as possible.

Luxin812 avatar Jul 31 '23 08:07 Luxin812

@mrx23dot This function will be supported recently, if there is an update, we will let you know the result as soon as possible.

Is this fixed in v4? At least add a command to exit BLEINIT mode, so we could switch to other mode without rebooting.

After the initialization, the Bluetooth LE role cannot be changed unless you run [AT+RST](https://docs.espressif.com/projects/esp-at/en/latest/esp32/AT_Command_Set/Basic_AT_Commands.html#cmd-rst) to restart the system first and then re-initialize the Bluetooth LE role.

What's the point of AT+BLEINIT=0 deinit then?

mrx23dot avatar Mar 05 '24 10:03 mrx23dot

@mrx23dot After the device initializes BLE, it can execute AT+BLEINIT=0 to deinit. AT+RST is not required. Please see the log below for specific operations. Can you provide your firmware and AT execution log?

[16:13:16:598] AT+RESTORE␍␊
[16:13:17:184] ␍␊
[16:13:17:184] OK␍␊
[16:13:18:395] ␍␊
[16:13:18:395] ready␍␊
[16:13:23:166] AT+BLEINIT=2␍␊
[16:13:23:253] ␍␊
[16:13:23:253] OK␍␊
[16:13:33:097] AT+BLEINIT=0␍␊
[16:13:33:336] ␍␊
[16:13:33:336] OK␍␊
[16:13:40:169] AT+GMR␍␊
[16:13:40:192] AT version:4.1.0.0-dev(f3c1850 - ESP32C3 - Feb  5 2024 10:09:06)␍␊
[16:13:40:192] SDK version:v5.0.4-dirty␍␊
[16:13:40:192] compile time(9061bdb3):Feb  5 2024 13:51:36␍␊
[16:13:40:192] Bin version:v3.2.0.0(MINI-1)␍␊
[16:13:40:192] ␍␊
[16:13:40:192] OK␍␊

Luxin812 avatar Mar 20 '24 08:03 Luxin812

As title says

Allow scanning in BLEINIT=2

BLEINIT=2
BLEINIT=0
BLEINIT=1

changing modes takes long time, it hurts responsiveness of final product, (when broadcasting and searching iterated) and sometimes BLEINIT=0 even reboots the ESP32! (getting ready msg)

tested with

AT+GMR
AT version:3.1.0.0-dev(s-bd890df - ESP32 - May 12 2023 08:47:33)
SDK version:v5.0-541-g885e501d99
compile time(c5af3bc):May 15 2023 12:00:57
Bin version:2.5.0(WROOM-32)

v4 is not released yet to many boards.

mrx23dot avatar Mar 20 '24 09:03 mrx23dot

After stopping ble broadcast and scanning (if there is a BLE connection, you need to execute the AT+BLEDISCONN command to disconnect the BLE connection) and then execute the AT+BLEINIT=0 command, the crash will not occur.

In the future, the device will be able to scan as a BLE server.

Luxin812 avatar Mar 21 '24 07:03 Luxin812