Open sidwarkd opened 1 year ago
Same issue on ESP32-C3 and 2.0.9.
@sidwarkd do you have a temporary fix for this? I tried disable the memory release, however when I try to connect to it through rainmaker app, it always fails and no error in console.
can you please help with triage @PilnyTomas? Thanks
@MingyaoLiu Yes, the fix which worked for me was to simply comment out the call to esp_bt_controller_mem_release
since, once you release that memory, it cannot be reclaimed per the docs. Here is a link to my fork with the change on line 261 of esp32-hal-misc.c. https://github.com/deploythefleet/arduino-esp32/blob/master/cores/esp32/esp32-hal-misc.c#L261. No other changes were required to get the sample working.
Using the provided sketch, I was not able to reproduce the mentioned Error. Using ESP32, latest arduino-esp32 master branch 2.0.11 Could you please retest on current version?
Closing this issue as expired, if needed you can reopen.
@PilnyTomas I am not able to use the master branch as it requires v5.1 of the IDF. When I check out the 2.0.11 tag I know longer get the error but I also do not get any WiFi networks returned in the provisioning app. If I roll back to my fixed branch I see them appear again. Then I tried different tags:
2.0.11 - No error but no WiFi networks returned in the app 2.0.12 - Back to getting the error again 2.0.13 - Same error 2.0.14 - Same error
So at least on the 2.x release it seems like this was kind of fixed and then regressed again. Is there some other commit I should try?
Researching this more and definitely a regression. The following shows 2.0.9 on the left, 2.0.10 in the middle and then 2.0.12 on the right which essentially puts it back to the way it was. So definitely broken again in 2.x. Will this be fixed in 2.x?
@SuGlider PTAL.
@sidwarkd / @me-no-dev - I have made it work using the sketch presented in this issue. Important details:
Erase All Flash Before Sketch Upload: "Enabled"
in order to erase previous WiFi/BLE sertup.ESP BLE Prov APP
don't forget to change the Prefix to the one the sketch is using with Lower Case Prov_
These are the step that I used to make it work:
1- Downloaded the ESP BLE Prov APP in my Android phone.
2- Uploaded the sketch to the ESP32 - USING the option Erase All Flash Before Sketch Upload: "Enabled"
3- Turn the Android phone Bluetooth ON and open the ESP BLE Prov APP.
4- Click on the "Provision New Device" button
5- Ignore the QR Scan and click on "I don't have a QR code" button. Change the Prefix to lower case "Prov_"
6- Android will scan BLE device. It shall list "Prov_123" in the Devices List. If necesary click on "Scan Again"
7- Click the device "Prov_123"
8- Confirm the proof of possession PIN for Prov_123 as "abcd1234" and click the "Next ->" button
9- Click on "Join Other Network" and enter your SSID/Password for your local WiFi network. Attention to Lower/Upper case.
10- Press the "PROVISION" button and wait for the process to complete.
ts Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1416
load:0x40078000,len:14804
load:0x40080400,len:4
load:0x40080404,len:3356
entry 0x4008059c
Waiting for Wi-Fi credentials. Open app to get started.
Provisioning started
Give Credentials of your access point using " Android app "
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Received Wi-Fi credentials
SSID : MyWiFiSSID
Password : MyWiFiSSID_PWD
Waiting for Wi-Fi credentials. Open app to get started.
Connected IP address : 192.168.3.128
Provisioning Successful
Provisioning Ends
Connected to Wi-Fi and ready to run main application
Connected to Wi-Fi and ready to run main application
Connected to Wi-Fi and ready to run main application
I have used Arduino Core 3.0.0-alpha2 ...
@sidwarkd
2.0.11 - No error but no WiFi networks returned in the app
I also get no list of WiFi networks in the APP, but I can set it manually with "Join Other Network" button.
@SuGlider On older versions the scan actually returns a list of WiFi networks but the later versions do not. I was able to "Join Other Network" but the flow is supposed to return a list of available WiFi networks. That is a bug, right?
The quesiton would be if this is an APP issue or ESP32 Software issue. Both could supply the list of WiFi SSIDs, given that both shall be close to each other for a BLE connection.
@sidwarkd - I have just run all over again here with Arduino Core 3.0.0-Alpha2 and it is running perfectly fine, including listing the WiFi SSIDs in my Android APP.
Sometime it doesn't list it immediately, but it seems to be running fine with no bugs.
@sidwarkd - Please try it again from scratch. It shall run fine.
@SuGlider I cannot use the 3.0.0-alpha2 tag as it requires IDF 5.1 or newer. This bug specifically relates to the state of things in 4.x. Is there a way to get the library to work probably in 4.x? I'm am on, what I believe to be, the most current at 4.4.6. I get the following error when I try to build on the 3.0.0-alpha2 tag.
.....CMake Error at /home/dev/esp/idf/tools/cmake/build.cmake:463 (message):
HINT: Please check manifest file of the following component(s): arduino
ERROR: Because project depends on idf (>=5.1) which doesn't match any
versions, version solving failed.
Is there a commit of this library I can be on where the above sample compiles and works properly on 4.x?
What exactly is the Arduino Core version that your project needs?
Is it using the Arduino IDE or some other building environment?
@SuGlider I am happy to use any version of Arduino Core that works properly and fully with the 4.x version of IDF. I am using arduino-esp32 as a component directly in IDF (not Arduino IDE). Currently I am using a fork of the repo with fixes for a community project. However, instead of pointing to a fork I would like to point to this official repo and I'm happy to do so at any commit as long as it works with IDF 4.x.
@sidwarkd then use the release/v2.x
branch of this repo :) it's for the 4.4 branch of ESP-IDF
@me-no-dev That has been the history of this issue. Please see my previous comment.
2.0.11 - No error but no WiFi networks returned in the app
2.0.12 - Back to getting the error again
2.0.13 - Same error
2.0.14 - Same error
So at least on the 2.x release it seems like this was kind of fixed and then regressed again. Is there some other commit I should try?
@VojtechBartoska I couldn't see how to re-open the issue. Can you do that as it's not resolved? I also re-named the issue to reflect that it applies to the 2.x branch.
@sidwarkd - I've found out something interesting...
It works fine and lists all WiFi SSIDs only, and just only, if the sketch is built using Core Debug Level: "Debug"
or higher.
This is valid for Arduino Core 2.0.8 .. 2.0.14.
Whenever Debug level is enabled, it will work fine and display this message:
[ 18577][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 1 - SCAN_DONE
Maybe this could be the workaround that helps your project.... 2.0.x won't receive new fixes.
@SuGlider Unfortunately this didn't work for me. I do get all of the debug output but still no WiFi networks and still only in v2.0.11. The other ones are still broken.
D (30259) wifi_prov_mgr: Scan results :
D (30263) wifi_prov_mgr: S.N. SSID BSSID RSSI AUTH
D (30442) proto_wifi_scan: Response packet size : 4
D (30443) protocomm_ble: Response from write:
D (30444) protocomm_ble: a6 e4 0a 22
D (30628) protocomm_ble: Inside read w/ session - 0 on param 42 0
However, since you mentioned the 2.0.x branch will not receive any new fixes we can close this as "Won't Fix" and I will port my community example to IDF 5.1. I appreciate your time in helping troubleshoot.
@SuGlider @me-no-dev In my case I'm fine to move to the 5.1 version of IDF. However, from a recent blog post announcing the 3.0.0 release it states:
"The expected stable release of the latest version is December 2023 and the 2.0.x will be under support maintenance until July 2024 then will be discontinued."
If that is true why wouldn't the 2.0.x branch receive any new fixes?
The branch may receive one final set of fixes by the end of Q1/24. It is possible that a final 2.0.15 version is released by that time.
I'll keep this issue in the list of issues to be verified for 2.0.x.
@lucasssvaz Can you please test this? thanks
I have the same problem with 2.0.15 as IDF components. Here is the logs:
I (765) boot: Disabling RNG early entropy source...
W (888) esp_claim: Generating the private key. This may take time.
E (2795) wifi_prov_scheme_ble: bt_mem_release of classic BT failed 259
W (2798) phy_init: failed to load RF calibration data (0x1102), falling back to full calibration
E (2880) simple_ble: simple_ble_start enable controller failed 259
E (2881) protocomm_ble: simple_ble_start failed w/ error code 0x103
E (2883) wifi_prov_scheme_ble: Failed to start protocomm BLE service
E (2890) wifi_prov_mgr: Failed to start service
[ 2062][E][WiFiProv.cpp:151] beginProvision(): wifi_prov_mgr_start_provisioning failed!
The sketch here: https://github.com/espressif/arduino-esp32/blob/master/libraries/RainMaker/examples/RMakerCustomAirCooler/RMakerCustomAirCooler.ino
Just tested as @SuGlider on the latest 2.x branch using ESP32-S3 and ESP32 and everything works as expected: The WiFi list also appears as expected.
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a80
entry 0x403c98d0
[ 266][I][WiFiProv.cpp:139] beginProvision(): Starting AP using BLE. service_name : Prov_123, pop : abcd1234
Waiting for Wi-Fi credentials. Open app to get started.
Provisioning started
Give Credentials of your access point using " Android app "
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Waiting for Wi-Fi credentials. Open app to get started.
Received Wi-Fi credentials
SSID : xxxxxxxxxxx
Password : xxxxxxxxxxxxx
Connected IP address : 192.168.15.59
Provisioning Successful
Connected to Wi-Fi and ready to run main application
@shahpiyushv Can you please take a look on this? Any ideas what should be wrong here? thanks
@dzungpv I am faced with the same error, did you find a way to resolve it ?
@dzungpv I am faced with the same error, did you find a way to resolve it ?
There is a bug with BLE, I make it work by un comment the line: https://github.com/espressif/arduino-esp32/blob/54c4b0c619458c2a1a830d8518bdc0fdaee435bf/cores/esp32/esp32-hal-misc.c#L268
https://github.com/espressif/arduino-esp32/commit/5548fbe02d74cf6f8895463d09cf3ab2e26ade35 this change seems to have broken this. It still doesn't work in 3.0.6 for me.
@azmi-plavaga can you please retest on version 3.1.0-RC1?
@VojtechBartoska E (127) network_prov_scheme_ble: bt_mem_release of classic BT failed 259
with 3.1.0-RC1 as well.
[env:development]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.10+rc1/platform-espressif32.zip
board = esp32dev
PLATFORM: Espressif 32 (53.3.10+rc1) > Espressif ESP32 Dev Module
PACKAGES:
- framework-arduinoespressif32 @ 3.1.0
- framework-arduinoespressif32-libs @ 5.3.0+sha.466a392a76
- ...
Dependency Graph
|-- WiFi @ 3.1.0
|-- WiFiProv @ 3.1.0
Hard resetting via RTS pin...
--- Terminal on /dev/ttyUSB0 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
[ 123][E][STA.cpp:343] connect(): STA connect failed! 0x300a: ESP_ERR_WIFI_SSID
WiFi not provisioned. Starting BLE provisioning...
E (127) network_prov_scheme_ble: bt_mem_release of classic BT failed 259
E (131) simple_ble: simple_ble_start enable controller failed 259
E (131) protocomm_ble: simple_ble_start failed w/ error code 0x103
E (138) network_prov_scheme_ble: Failed to start protocomm BLE service
E (144) network_prov_mgr: Failed to start service
[ 154][E][WiFiProv.cpp:155] beginProvision(): network_prov_mgr_start_provisioning failed!
@lucasssvaz can you please retest this on RC2? Thanks a lot
Board
ESP32 Dev Module
Device Description
DevKitC plain
Hardware Configuration
No additional hardware connected.
Version
latest master (checkout manually)
IDE Name
VSCode
Operating System
Linux
Flash frequency
40MHz
PSRAM enabled
no
Upload speed
2000000
Description
The use of
esp_bt_controller_mem_release
does not seem correct in esp32-hal-misc.c. In the functioninitArduino()
if you have set BT_ENABLED in sdkconfig, it will callbtInUse
to determine whether to release the BT memory. There are two problems.First, in using the sample sketch below (a slightly modified version of the provisioning sample included with this library) it does not appear to link correctly. The sample will fail to run properly as the BT memory is released in
initArduino
so trying to enable BT later for provisioning fails. The weak linking is not working as expected.Secondly, this pattern seems wrong as well. The code in
initArduino()
would imply that you could have CONFIG_BT_ENABLED but havebtInUse()
return false which, per the code, would never be possible. If CONFIG_BT_ENABLED is yes then esp32-hal-bt.c declaresbtInUse()
to return true always. So there is no scenario where if the config is enabledbtInUse()
should return false (although it does per the first problem mentioned above).This makes the following block of code in esp32-hal-misc.c puzzling:
To get the provisioning example code to work with BLE the call to
esp_bt_controller_mem_release
must NOT be called ininitArduino
.Sketch
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide