nkolban / esp32-snippets

Sample ESP32 snippets and code fragments
https://leanpub.com/kolban-ESP32
Apache License 2.0
2.33k stars 709 forks source link

BLEscan error with current version of ESP32 arduino env #592

Open 1technophile opened 6 years ago

1technophile commented 6 years ago

ESP32 BLE version v0.4.16 last ESP32 arduino env Program BLEScan Board: DOIT ESP32 DEVKIT V1

  1. Open BLEScan.ino with Arduino IDE 1.8.5
  2. Compile OK
  3. Upload to the board

The serial monitor returns:

Scanning...
E (17) BLEDevice: esp_bt_controller_init: rc=259 Invalid state
E (18) BLEScan: esp_ble_gap_set_scan_params: err: 259, text: Invalid state
Devices found: 0
Scan done!

If I do the same thing with: ESP32 BLE version v0.4.9 ESP32 arduino env Program BLEScan Board: DOIT ESP32 DEVKIT V1

  1. Open BLEScan.ino with Arduino IDE 1.8.5
  2. Compile OK
  3. Upload to the board

The serial monitor returns:

Scanning...
Advertised Device: Name: , Address: d4:1XXXXXXXXX:40, manufacturer data: df004c305331303330314a41, serviceUUID: 3dda0001-957f-7d4a-34a6-74696673696d 
Advertised Device: Name: MJ_HT_V1, Address: 4c:XXXXXXXXX:79 
E (42992) BT: btc_search_callback  BLE observe complete. Num Resp 2

Devices found: 2
Scan done!

It seems that the last version of BLE library combined with the last revision of ESP32 env doesn't enable to do scan properly.

paweb88 commented 6 years ago

I've got the same error when i tried any of examples :(

chegewara commented 6 years ago

@1technophile @paweb88 Sorry guys but i cant reproduce this issue. I have fresh updated arduino-esp32 and BLE 0.4.16: HEAD detached at 7951347 Here is scan result from ble_scan example:

[D][BLEUtils.cpp:1270] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_CMPL_EVT
Devices found: 1
Scan done!
paweb88 commented 5 years ago

It works fine on: 0.4.16 :)

ps. merge correctly or be sure that you have exact version

mout551 commented 5 years ago

Hi guys, i have the same problem with my LoPy from Pycom even if I have fresh updated arduino-esp32 and BLE 0.4.16 :

Scanning... E (17) BLEDevice: esp_bt_controller_init: rc=259 Invalid state E (18) BLEScan: esp_ble_gap_set_scan_params: err: 259, text: Invalid state Devices found: 0 Scan done!

Jeard commented 5 years ago

Hi, I've got the same error with BLE uart example. E (18) BLEDevice: esp_bt_controller_init: rc=259 Invalid state

chegewara commented 5 years ago

@mout551 @Jeard Could you try with this arduino-esp32 commit: https://github.com/espressif/arduino-esp32/commit/89859f7f4c07ce3e5d487a4b689dbda78f5d5c3a

Jeard commented 5 years ago

@mout551 : Gives the same error even with above commit

chegewara commented 5 years ago

@Jeard What i mean, you have to hard reset to this commit, because there is some issue with more recent commits (at least i had issue)

Jeard commented 5 years ago

@mout551 : Thanks for the suggestion. It worked with 89859f7f4c07ce3e5d487a4b689dbda78f5d5c3a

1technophile commented 5 years ago

@chegewara thanks for this info, I confirm it works with this commit but not with the commits after.

chegewara commented 5 years ago

I found what caused issues for me with arduino-ide latest commit. It was releasing memory from bluetooth classic.