espressif / esp-at

AT application for ESP32/ESP32-C2/ESP32-C3/ESP32-C6/ESP8266
Apache License 2.0
871 stars 765 forks source link

BLE Scan Window Ignored, BLESCANPARAM #857

Open Peter-B4321 opened 1 month ago

Peter-B4321 commented 1 month ago

Answers checklist

ESP-AT version

3.4.0.0

Operating System used

Linux

If you are using Windows, please specify command line type.

None

What is the expected behavior?

Scan for the window and wait the interval. For example, AT+BLESCANPARAM=1,0,0,16000,1600 The command should scan for 1s and then wait 9s.

What is the actual behavior?

Scanning is constant without breaks.

Steps to reproduce

AT+BLEINIT=1 AT+BLESCANPARAM=1,0,0,16000,1600 AT+BLESCAN=1,0 Then, look at the scan results.

Build or installation Logs

This issue is new to ESP-AT v3.4.0.0
In v3.2.0.0, the ESP would scan for 1 second and wait 9, then repeat.
The behavior seems like the window is equal to the interval (AT+BLESCANPARAM=1,0,0,1600,1600)

More Information

Happens on multiple devices.

Peter-B4321 commented 1 month ago

AT+GMR response:

AT version:3.4.0.0(s-c31b833 - ESP32 - Jun  7 2024 03:48:17)
SDK version:v5.0.6-dirty
compile time(70ff5889):Jun  7 2024 04:46:00
Bin version:v3.4.0.0(WROOM-32)
OK
JHedgesBartec commented 1 month ago

I have also seen this issue on v3.2.0.0 with the ESP-WROOM-32

It is clear that both the scan interval and scan window are only applied when the BLE module is de-initialised (AT+BLEINIT=0) then initialised as a client again (AT+BLEINIT=1) or the module is rebooted (AT+RST) and then BLE re-initialised.

Peter-B4321 commented 1 month ago

On v3.4.0.0, applying the scan parameters while BLE is de-initialized returns an ERROR

TX: AT+BLEINIT=0 RX: OK TX: AT+BLESCANPARAM=1,0,0,16000,1760 RX: ERROR TX: AT+BLEINIT=1 RX: OK TX: AT+BLESCANPARAM=1,0,0,16000,1760 RX: OK

JHedgesBartec commented 1 month ago

@Peter-B4321 to work around this issue you will need to apply the new parameters, then de-initialise BLE before initialising it again.

Luxin812 commented 1 week ago

We have successfully reproduced the issue locally. We will need some time to analyze it and will get back to you with the results shortly. Thank you very much for reporting this issue.