-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Description
I am using BLE_scan.ino example. Unfortunately only the first scan gives valid device serviceUUID and Name. From the second scan onward SENSOR_PRO device gives no serviceUUID the HMSoft device gives empty string as Name. It seems it is an old bug, but still no solution? Serial data from boot:
Scanning...
Advertised Device: Name: SENSOR_PRO, Address: ed:3d:9a:96:86:a3, serviceUUID: 6a800001-b5a3-f393-e0a9-e50e24dcca9e
Advertised Device: Name: HMSoft, Address: 90:9a:77:27:65:15, manufacturer data: 484d909a77276515, serviceUUID: 0000ffe0-0000-1000-8000-00805f9b34fb, txPower: 0
Devices found: 2
Scan done!
Advertised Device: Name: SENSOR_PRO, Address: ed:3d:9a:96:86:a3
Advertised Device: Name: , Address: 90:9a:77:27:65:15, manufacturer data: 484d909a77276515, serviceUUID: 0000ffe0-0000-1000-8000-00805f9b34fb, txPower: 0
Devices found: 2
Scan done!
Advertised Device: Name: SENSOR_PRO, Address: ed:3d:9a:96:86:a3
Advertised Device: Name: , Address: 90:9a:77:27:65:15, manufacturer data: 484d909a77276515, serviceUUID: 0000ffe0-0000-1000-8000-00805f9b34fb, txPower: 0
Devices found: 2
Scan done!
etc...
Activity
chegewara commentedon Jan 29, 2020
Its hard to do anything if i cant reproduce issue:
My peer device is android smartphone running nRF connect with advertising.
Here is scan callback:
I can only say that i am running this code on platformio with arduino + esp-idf, wifi and mqtt (code omitted).
Nagymadar commentedon Jan 29, 2020
With the original arduino BLE_scan.ino, just modified the callback as below. Still no luck. I have tried haveName() too in the callback, but then I got back nothing after the first scan.
Hardware: ESP32 Wrover Module, default settings.
Results:
Nagymadar commentedon Jan 29, 2020
Comet Blue looses its name, while SENSOR_PRO looses its UUID after the first scan. See results and full code below:
Results:
I edited the serial print format in the code to make it readable:
Nagymadar commentedon Jan 30, 2020
Can I produce some debug info for you? (raw data print or something)
chegewara commentedon Jan 31, 2020
You can print raw advertising data for each device in onResult() callback with:
getPayload() and getPayloadLength() and Serial functions.
This way we can investigate it. Remember to print hex values.
Nagymadar commentedon Jan 31, 2020
I switched also on Warnings and printed heap size. Here it is:
Nagymadar commentedon Jan 31, 2020
Don't ask me how, but one version of the code worked, but only once. Then I changed one character in the code (printf format), uploaded it and failed again. Change back to the working one, fail again.
Now I changed the hardware to a completely different board: NodeMcu ESP32. Same error. I switced on verbose level debug. Does this help you? See below first and second scans. I put *** what is printed from code. The first scan ends at *** Scan done!.
What is your ESP board settings? I updated every board and library. You?
chegewara commentedon Feb 1, 2020
Can you try this before scan start, with value true:
https://github.com/espressif/arduino-esp32/blob/master/libraries/BLE/src/BLEScan.h#L51
Payload [33]
means it does not fit advertising packet, so the other part has to be in scan response, which is scan only with active scanning (that should be enabled, and does not require any action, but worth to try, maybe esp-idf bug or settings in menuconfig).Nagymadar commentedon Feb 2, 2020
I have tried. No change. :-( Any other what I can try?
chegewara commentedon Feb 2, 2020
Only thing i can say is that i never found similar issue and it is very strange.
It is obviously ignoring scan response packet which is received only during active scan.
Could you try with other esp32?
Nagymadar commentedon Feb 2, 2020
I am using 2 boards:
I am getting close... I used to use Arduino's ESP32 Wrover Module board settings in tools menu. Changing to ESP32 Dev Module solved the problem on board 1, but not on board 2. Confusing... Any idea?
I've got this warning for both of them:
But I do not find any other BLEDevice.h anywhere. Can be a problem?
Nagymadar commentedon Feb 2, 2020
I scanned my whole c drive. No other BLEDevice.h.
chegewara commentedon Feb 3, 2020
If i remember this board is using XTAL 26MHz:
NodeMCU ESP32S
Try to pick NodeMCU from boards.
Nagymadar commentedon Feb 3, 2020
I've tried
NodeMCU-32S
board. No change. But I've looked it up: Clock Speed: 240 Mhz.Interestingly when I changed back to ESP Dev board, it worked. Then put in 2 Serial.println("Done") lines just to change the code, and fails again! I removed them, works. Changed back and forth, now it does not work anyome. I am really confused. Once one compilation works, even after reset and 20+ scans. But some compilation just does not work. I 've checked the Arduino comp messages. The BLE library compilation sequence is a bit different. That is all. Any idea?
chegewara commentedon Feb 3, 2020
I dont have explanation for that. What you can do is to see if you are not short on heap, or experiment with different boards selected in arduino.
Thats good you found it somehow related to hardware and board selected, but heap/stack shortage is last thing i can think of.
17 remaining items