-
Notifications
You must be signed in to change notification settings - Fork 715
Working combination of arduino-esp32 and ESP32_BLE_Arduino versions? #735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Current library version is after many drastic but important changes and as you can imagine it was not tested with arduino 1.0.1-rc1 because arduino has been released less than 24 hours ago. I will do my best to fix all issues, but I need users help. I can't test most of possible usage cases so if it's possible it would very helpful to have example code posted with issue. This way I can find problem quick and try to fix it asap. |
Versions used: arduino 1.0.1-rc1 with nkolban/esp32-snippets Logfile with verbose messages is
after that nothing happens. I connect to a device using it's address, the device which is awake and can can be seen with a BLE browser on my iPhone. Code is in setup();
and in loop()
and the function called:
If WiFI is disabled in the code, I got the same messages. Please advice if you want me to test different versions. |
Im going to ask you to add few lines of code to provide some debug info:
This should tell us why you have disconnections. Thanks. |
@an-erd I think i know where is the problem. To make library easier to use and compatible with more peripherals i added some option in BLEClient->connect(). I didnt test it with old examples tho. PS there is also |
|
@chegewara I added in setup() To get the type variable filled correctly, I changed the code not to connect to a known predefined device but to scan first. Results are:
I didn't had the chance to decode the Backtrace and PC, will do this afternoon (German time) and post results. Also, I don't understand why this line So at this point of debugging we're not at the disconnects but at an earlier step. Or did I miss something? |
Also, what does this event mean and how to deal with them?
|
Ok, here's another log, same code but with an disconnect.
It looks like that the connect did not complete? |
Yes, you are right. Disconnect reason is 62 (0x3E): Let me think what else i can do, because i have no issues with connection and i did test in which client (esp32) is connecting, write and receive notifications from server (esp32) over 1400 in about 35-40 minutes (1 connection per second). |
Maybe we can postpone the "disconnect" issue and first understand the issue in the post above (Stack smashing protect failure! and the scan() function called twice)? |
Ok, i have to read all logs one more time and i have to find stack smashing option in menuconfig to see what is this and why it is happening. I need some time, sorry. |
I will decode
tonight German time. |
From logs i think you have some issue in your app. Why do you have twice this:
|
Actually, I don't call it twice. In the code there's only one block to write the log and to start the scan, and its only called once.
I recompiled from scratch and currently I don't have an idea why this happens. Need maybe some debugging... |
I thought i will add some preprocessor that will make binary file smaller in case of using log level DEBUG or less, but something goes wrong and VERBOSE is also stripped. |
Stack smashing: Do you have scan complete callback that is registered with |
I got the chance to decode the stack trace. It seems that some delay() functions caused some problems. I now removed all delay() for the moment.
I decoded with the Exception decoder and got these results
The Code in disPod.ino, line 616 is
Line 616 is the I don't know on how to follow up now. Setup has been completed, all the connection to the BLE server, etc. is done in the loop() function. The PC has passed setup(), but the stack trace shows PC in setup(). |
Comment out this line: |
Good idea, the PC then is located somewhere in preparing some values - need to check for wrong memory access. Will take me some time to find. |
Didn't make any progress in finding the issue, since the code used is pretty easy, it maybe is consequence from another problem. Do we have an example code available on how to scan, connect and enable notify for this updated tree? |
Examples are WIP now, but actually i do have BLE_client ready:
|
Ok, thanks, I'll try tonight. |
RUN 30.11.2018-1 I compiled the BLE_client example you posted (with to minor corrections - it must read
Decoded stack trace:
Line 145 in BLEtest1.ino points to
Please advice on what you want to see? I can compile with a different arduino-esp32 commit, too! |
RUN 30.11.2018-2 Next time I started ends here:
|
RUN 30.11.2018-3 Run 3 ends here. Probably the BLE device is sleeping:
|
Hi @an-erd it possible that in rush i might have introduce some bugs. I have code that has been working yesterday pretty good in my connecting test (1400 perfect connections then massive memory leak). Today its a mess. |
Hi @chegewara Ok, just drop me a note if you want me to test! |
Just to be sure, I'm still on arduino-esp32 1.0.1-rc1 and the https://github.com/nkolban/esp32-snippets/commits/master on 45fcc07. I saw that there's 7 commits on arduino-esp32 1.0.1-rc1, todays pull with BLE code, i.e. espressif/arduino-esp32@a15b7e9 Please advice on which version you want me to test! |
Yes, today's pull. I created it today and has been merged by me-no-dev to arduino-esp32 library. |
@chegewara Anything I can support you with, some testing, etc.? I updated to the last version of arduino-esp32 and can provide some logs (should I open a new issue, paste here?). I found that the scan() example doen't find my devices until I do a search with an iPhone app. Different values for pBLEScan->setInterval(); BLEScan->setWindow(); don't improve. |
You can paste logs here or create gists and here paste only links.
and add those lines before
Thanks. |
BLE_Scan.ino don't find BLE devices unless iPhone BLE search triggered Used version: arduino-esp32 1.0.1-rc incl. the 13 commits since that realease (until #af7e489) Sketch: example incl. the cb handler and different values for pBLEScan->setInterval(); and pBLEScan->setWindow();
Logs:
During this scan only 2 devices were found, but expected were 4 devices. During the next scan() I used a BLE Scanner und scanned in parallel with the app, and afterwards the devices were found with the scetch above, too.
Another log with different values: using
|
Thanks @an-erd
Now is the question why? I see you have turned on PSRAM, do you use wrover board? Do you hav setup in arduino-ide wrover board or just turned on PSRAM for devKitC? Could you switch board to devKitC and turn on/off psram, even if you are using wrover? It is possible that its something wrong with your ble library and setInterval() setWindow() just do nothing. |
Board used: M5Stack-fire
Again, the ESP32 only sees the device when scanning with a app. I'll try to better understand, because using the BLE_client.ino example with increased scan intervalls (2000/1500 finds the device. |
If you don't use WiFi try with interval equal window. |
Can you please give me a hint on how to do "interval equal window"? |
Sketch BLE_client.ino Example sketch with changed
Log:
Decoded stack trace
|
If I decode the exception with the (newly) build in function of VisualMicro I got this exception decoded:
|
|
It seems to be error from your code, not from ble library. |
I just used the BLE example BLE_client.ino and only did the adjustments as mentioned above, so there no more code or my code used. I experience the same problems with my code hen using the current version, too. But, I used an old version 0.4.9 and same arduino-esp32 release I don't know anymore before - with this versions it works without any problem for 5 hours.... main.cpp is the core esp32 code, file
and line 17 is |
There is also this: But original BLEclient has only 160 lines. Ok, i read logs one more time. Last message is that you are trying to register for notify. Is it possible that characteristic does not provide notifications? EDIT register for notify is last operation that is before crash and is correct, what is next after that one? |
The characteristic is providing notifications
After register for notify connectToServer() ends, back to loop(), the next block is
The log entry "We are now connected to the BLE Server." is misssing in the logs, maybe not flushed yet. Line 175 is then Is this example working for your BLE device? |
I commented out the register for notify lines. Resulting log attached. There's no stack trace/excception.
|
Ok, im running now test and i have crash too. Investigating it ... |
@an-erd Try to comment out this instead of register for notify:
|
@an-erd I know what is wrong, it was reported in other issue. |
I reported the missing |
rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) I'm Receving this type error can someone help me out |
I'm going to read values from a BLE fitness device. I used pretty old versions some time ago (BLE 0.4.9 and some version of the arduino-esp32 tree I don't have available anymore).
Now I upgraded to
With all these combinations a got
I found all these issues in this and in the arduino-esp32 issue list.
My question is, what is a good, stable working combination of arduino-esp32 and BLE which I can use to complete my sketch? It would be great to have a proven version available?
The text was updated successfully, but these errors were encountered: