esp-idf-provisioning-ios icon indicating copy to clipboard operation
esp-idf-provisioning-ios copied to clipboard

ESP32 BLE Prov app never find any wifi netowrk

Open 0x0fe opened this issue 2 years ago • 10 comments

So, just installed the app from apple store, loaded the corresponding firmware, i can see the BLE device, connect to it, and reach the "select wifi network" step. Here if i try to scan for wifi networks it will scan and scan, but never find anything, ocasionally it stopped scanning and displayed a blank list. If i clic "join other network" and i type my SSID and password it works, however this is annoying and not really possible to use in many case where we dont know this information, it is also far less convenient than just clicking the SSID in a list. So, soemthing must be broken somewhere.

0x0fe avatar Jun 10 '23 11:06 0x0fe

Hi @0x0fe, I understand you are facing an issue with the Wi-Fi scan feature available in the app. I tried to reproduce the issue with the latest provisioning app on App Store but it is working fine for me. To help us find the root cause can you please provide us with the below details:

  1. IDF version
  2. IDF example being used for testing
  3. Any specific configuration set by you.
  4. iOS version.
  5. BLE Device logs.
  6. Total available Wi-Fi network count.

vikas-chandra-mnnit avatar Jun 13 '23 18:06 vikas-chandra-mnnit

Hi @vikas-chandra-mnnit 1: 4.4.4 2. tested from PIO so i did not directly used the IDF example but rather the arduino example 3. none 4. iOS 16.1 5. can provide that later 6. one

0x0fe avatar Jun 14 '23 10:06 0x0fe

Hi @0x0fe, regarding the 2nd point, can you please specify which Adruino example you are using in your case?

vikas-chandra-mnnit avatar Jun 14 '23 17:06 vikas-chandra-mnnit

@vikas-chandra-mnnit sure, here you go https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiSmartConfig/WiFiSmartConfig.ino

0x0fe avatar Jun 14 '23 17:06 0x0fe

actually this make me realize i used the example from IDF at first, because i could set the mode (AP or BLE) which is not the case in Arduino. Later i moved to AP mode and used the Arduino example (which fails to connect properly).

0x0fe avatar Jun 14 '23 17:06 0x0fe

https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiSmartConfig/WiFiSmartConfig.ino

For above example, the iOS app is different you can find it on App Store here: https://apps.apple.com/in/app/espressif-esptouch/id1071176700

The ESP Provisioning App is supposed to work with the example: https://github.com/espressif/arduino-esp32/tree/master/libraries/WiFiProv/examples/WiFiProv

vikas-chandra-mnnit avatar Jun 14 '23 17:06 vikas-chandra-mnnit

Sorry for the confusion on my side, in fact i tried BLE Prov, the SoftAP prov and later smartConfig, then a lot has been going on with other issues and i forgot.

So there is the firmware i used to teste BLE prov and which exhibited the issue of this ticket. https://github.com/cvonk/ESP32_factory-ble-prov/blob/master/src/factory_ble_prov.c

0x0fe avatar Jun 14 '23 17:06 0x0fe

@0x0fe, the sample code you mentioned is not official Espressif code. The ble_prov_start_provisioning() in that file itself looks fine, but in other files, I also see some code taken from legacy BLE provisioning. I would recommend that you try out these official examples:

Arduino: https://github.com/espressif/arduino-esp32/tree/master/libraries/WiFiProv/examples/WiFiProv

Esp idf: https://github.com/espressif/esp-idf/tree/master/examples/provisioning/wifi_prov_mgr

These are known to work fine with our apps. Once you validate that these are working fine, further queries can be followed up under esp-idf issues, since it could be related to firmware.

shahpiyushv avatar Jun 14 '23 18:06 shahpiyushv

@shahpiyushv So, back to this issue, i can confirm that we now use the exact same code as here https://github.com/espressif/arduino-esp32/tree/master/libraries/WiFiProv/examples/WiFiProv and the problem is still here. On iphone, sometimes it works, sometimes it doesnt, when it doesnt the scan shows no networks at all, and restarting the scan does nothing more. When it works the networks are found and the process is ok. On android it is even worst, it mostly never works. The testing has been conducted in close proximity to the router, with very strong wifi signal, so there is no problem of reaching the network, and tests have been conducted in two totally different network setups (by me at the hardware design phase, and by the applicative team when working on the APP), with identical results.

0x0fe avatar Aug 02 '23 12:08 0x0fe

@shahpiyushv We noticed a pattern too, the first attempt always works. But any subsequent attempt will fail. To be able to scan with success the BLE device has to be unpaired from the mobile settings, the board has to be reset, and the APP quitted and restarted.

0x0fe avatar Aug 02 '23 15:08 0x0fe