ESP32 WiFi Provision Error with BLE

I’ve been getting an error while trying to use wifi provision via ble on esp32. The error only appears when using esp32 on platformio. When using the same code with a esp32-c3 or esp32-s3 everything works fine. Also, uploading the same code via Arduino IDE doesn’t give me the error…

Any idea what would be causing this error only when using esp32 via platformio?


#include "WiFi.h"
#include "WiFiProv.h"

const char *service_name = "PROV_12345";
const char *pop = "1234567";

void setup()

void loop()


--- Terminal on COM14 | 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
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ets Jul 29 2019 12:21:46

configsip: 0, SPIWP:0xee
mode:DIO, clock div:2
entry 0x400805e4
E (899) wifi_prov_scheme_ble: bt_mem_release of classic BT failed 259
E (999) wifi_prov_scheme_ble: bt_mem_release of BTDM failed 259

And what version of the Arduino-ESP32 core are you running in the Arduino IDE? (Tools->Boards->Board Manager → esp32)

Unfortunately, I can confirm this error. I have tried the example WiFiProv using the bluetooth provisioning method in the Arduino IDE with Arduino-ESP32 2.0.6 and 2.0.7 and it works flawlessly. For some reason, that I haven’t figured out yet the same sketch (copied into a new PlatformIO project) build fine in platform IO, but I get the error mentioned above during runtime.

I have a similar problem with WiFiProv.beginProvision under PlatformIO: I copied the WifiProv example into PlatformIO and get this error:

/Users/bg/Documents/PlatformIO/Domino4_Applications/App-Standard/AppStandard/AppStandard.ino: In function 'void setup()':
/Users/bg/Documents/PlatformIO/Domino4_Applications/App-Standard/AppStandard/AppStandard.ino:98:164: error: no matching function for call to 'WiFiProvClass::beginProvision(prov_scheme_t, scheme_handler_t, wifi_prov_security, const char*&, const char*&, const char*&, uint8_t [16], bool&)'
     WiFiProv.beginProvision(WIFI_PROV_SCHEME_BLE, WIFI_PROV_SCHEME_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, pop, service_name, service_key, uuid, reset_provisioned);
In file included from /Users/bg/Documents/PlatformIO/Domino4_Applications/App-Standard/AppStandard/AppStandard.ino:5:
/Users/bg/.platformio/packages/framework-arduinoespressif32/libraries/WiFiProv/src/WiFiProv.h:49:14: note: candidate: 'void WiFiProvClass::beginProvision(prov_scheme_t, scheme_handler_t, wifi_prov_security_t, const char*, const char*, const char*, uint8_t*)'
         void beginProvision(prov_scheme_t prov_scheme = WIFI_PROV_SCHEME_SOFTAP, scheme_handler_t scheme_handler = WIFI_PROV_SCHEME_HANDLER_NONE,
/Users/bg/.platformio/packages/framework-arduinoespressif32/libraries/WiFiProv/src/WiFiProv.h:49:14: note:   candidate expects 7 arguments, 8 provided

I must use a wrong version of ESP32, but can’t figure out where/how to fix it…

The current latest stable of platform-espressif32 uses Arduino-ESP32 core version 2.0.9, as per

Meaning you have to copy example code from that version of Arduino-ESP32, as found per

Alternative, the latest bleeding edge version of the platform does use the latest Arduino-ESP32 2.11.0 version, so the sketch version that you probably copy-pasted straight from the master branch has a better chance of working. You can see how to use the upstream version per documentation.

Of course, stable versions should be preferred.

And btw, I’m expecting a new stable platform-espressif32 version soon due to the adding of the “Arduino Nano ESP32” board (and closing of related issues).

1 Like

It works, thank you!