-
Notifications
You must be signed in to change notification settings - Fork 716
BLE + WiFi, WiFi gets disconnected #169
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
I am running scan all the time since then. I dont know if there was any disconnections but im still getting the same output.
|
What we can do? Few questions:
To make your test and output cleaner im suggesting to change this |
Updated both last friday (3rd of November). Arduino version is 1.8.5 as well. I've tried 2 different dev boards. Both show the same result. Which board are you using? |
Im using devKitC, but in my opinion board is not important. https://gist.github.com/chegewara/6864f271004e30a919260d25cbc1a825 |
One important thing. You should have use this instruction to update library, not git pull from Arduino_BLE repo: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/ArduinoBLE.md |
I've been using the Arduino_BLE version indeed. I've now updated it to the cpp_utils version. But getting the same results.
|
I see we have different logging outputs. Maybe its nothing important and you just have turned on higher level of logging. But... |
Yes, I've upped the log level to 5 (CONFIG_LOG_DEFAULT_LEVEL) Now I replaced the sdkconfig file with your sdkconfig file. This is the output (looks the same):
Looking at the log, it looks like wifi is disconnecting right after I start the BLE scan?
|
If we have the same sdkconfig, and we have so different outputs then i have to study your logging very thorough to understand it. Now i will be heading to work, so next hour i am out. |
No problem. Thank you for your help thus far. |
@Cypher87 Please dont take me wrong, whatever you did it did not change esp32-snippets with latest version. If you look closer on those lines:
program makes scan the same device over and over. But in latest library, dont remember since when, there is loop which is cheching if that device has been scaned and mapped. You can see it here:
And there has been made very important changes in WIFI library. My advise: compare wifi.cpp from repo and from arduino library. |
I'm not sure what to say. I see the code that should log what you're seeing in my BTEUtils.cpp, but it's just not logging it that way. I've replaced sdkconfig, but Also, I'm using the latest IDF from https://github.com/espressif/arduino-esp32. So the WiFi.cpp is the same as in that repo. Am I missing something here? |
https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/ArduinoBLE.md,
|
I understand. I don't have the BLE library installed from https://github.com/espressif/arduino-esp32 The library I'm using is from https://github.com/nkolban/esp32-snippets.git Though it's still not working as it should. I'm getting a bit frustrated and wondering if I should just go another way. The ESP32 is just not stable enough. And all these differences in versions is not helping either. Don't get me wrong, I do appreciate your help. p.s. The case is that WiFi get's disconnected when BLE scan is running.
This does not happen when I don't run the BLE scan. |
Is it possible you have installed 2 BLE libraries in your system and arduino is confused and is using wrong one? If its possible, you can ask mr @nkolban to make skype session to solve this issue. Only i can say is that the library used to compile this program is not the same which is on this repo. I totally understand your frustration. Been there many times. Got situation when everything been working, then i did clean git clone and nothing worked, just because i forgot to change options in menuconfig. Other time i compiled app and flashed it and app worked just fine, next i did the same with exact the same code and got crash all the time. I found that option which should help me with debugging caused that. |
At the end its with profit to all of us. When you and other users will have good prepared environment we can find and solve any issue a lot faster. And this im our/ my objective. |
You're totally right. I've started with a clean install. And followed: Then I changed sdkconfig.h to enable debugging. Still the same problem. Because of this message in my logging:
I wondered if the scanning takes to long and breaks WiFi. So I changed the timeout to 5 seconds. |
It is possible. But this is good information that you eventually found source of this issue. I hope you will figure it how to make this program to work as you wish. |
What you can do now is to try to split BLE scan and wifi to 2 different tasks. This may resolve issue with disconnecting wifi whan ble scan takes too long |
Created a task with:
Set the scan time to 30 again, still WiFi drops out. |
Then for the moment you have to set time to scan short. Sorry, if this collide with your app functionality i can try to find reason, but this may be not so easy |
I also found this thread espressif/esp-idf#675 which sounds like the same issue. Thanks for all your help. I will try to work my way around this issue. |
How about creating a pinned task - you created a task with priority 1 (same as loop) "somewhere" - so I guess (when the taks is created at core 1 where the system runs) and you are blocking the cpu this will block the main task(s). |
Tried that as well. Did not resolve the issue either. |
I'm wondering if anyone else is able to reproduce this issue. Just to make sure it's not my dev setup/ my dev-boards/power issue/wifi router or anything. |
Just checked and i cant recreate it. Ive set scan time to 30 sec and is scanning prettynice, and no problem with wifi disconnect.
If you wish i can send you my BLE zip library for arduio and sdkconfig. Then you can chack and corfim its stack fault or something else. (My BLE library has been created nov 3rd) |
Sure that would be nice. My anonymized address is: cru7f [at] notsharingmy.info |
I got the disconnection when using https://github.com/espressif/arduino-esp32 and installing BLE using Sketch -> Include Library -> Manage Libraries. In the library filter, enter "esp32 ble arduino". The wifi disconnect happen after running for 10-15 minutes. |
@chegewara, what is the source of that interesting table with system tasks? |
The issue is also described here: https://github.com/nkolban/esp32-snippets/issues/110#issuecomment-341973084
I'm using the Arduino BLE package, with latest IDF.
My code: https://pastebin.com/zsfBBrde
My output:
Where it's first connecting to my WiFi network. Then starts a scan and sends it using udp. "5" is the WiFi state, which is WL_CONNECTION_LOST.
Sometimes this happens after a while (maybe 2 or 3 scans). WiFi does not recover after the connection has been lost.
@chegewara
Your output https://github.com/nkolban/esp32-snippets/issues/110#issuecomment-341975003 is indeed what I am expecting. Can you keep the scan running for maybe 2 or 3 minutes to see if you're losing your WiFi connection as well? It's not too important, so get some sleep before breaking your head over this issue ;)
The text was updated successfully, but these errors were encountered: