Skip to content

WiFi Provisioning with BLE throws runtime error when using pioarduino #125

Closed
@kumardeo

Description

@kumardeo

I am not sure if this is the correct repo to open this issue.

If it is irrelevant, feel free to close this issue.

WiFi Provisioning with BLE does not work and throws runtime errors when using PlatformIO IDE (platform: pioarduino 53.03.13 | core: v3.1.3) and ESP32 Dev Module (nodemcu-32s) board.

Note

The same code works as expected when using Arduino IDE (core: v3.1.3).

The runtime error:

E (247) simple_ble: simple_ble_start enable controller failed 259
E (248) protocomm_ble: simple_ble_start failed w/ error code 0x103
E (249) network_prov_scheme_ble: Failed to start protocomm BLE service
E (255) network_prov_mgr: Failed to start service
[   265][E][WiFiProv.cpp:165] beginProvision(): network_prov_mgr_start_provisioning failed!

src/main.cpp

#include <Arduino.h>
#include <WiFiProv.h>

const uint8_t LED_PIN = 2;
const char *pop = "12345678";                // Proof of possession - otherwise called a PIN - string provided by the device, entered by the user in the phone app
const char *service_name = "PROV_MYAPP";  // Name of your device (the Espressif apps expects by default device name starting with "Prov_")
const char *service_key = NULL;              // Password used for SofAP method (NULL = no password needed)
bool reset_provisioned = true;               // When true the library will automatically delete previously provisioned data.

void setup() {
  pinMode(2, OUTPUT);

  Serial.begin(115200);

  Serial.println("Begin Provisioning using BLE");
  // Sample uuid that user can pass during provisioning using BLE
  uint8_t uuid[16] = { 0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf, 0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02 };
  WiFiProv.beginProvision(
    NETWORK_PROV_SCHEME_BLE, NETWORK_PROV_SCHEME_HANDLER_FREE_BLE, NETWORK_PROV_SECURITY_1, pop, service_name, service_key, uuid, reset_provisioned);
  Serial.println("You may use this BLE QRCode:");
  WiFiProv.printQR(service_name, pop, "ble");
}

void loop() {
  bool isConnected = WiFi.isConnected();
  if (isConnected) {
    digitalWrite(LED_PIN, HIGH);
  } else {
    digitalWrite(LED_PIN, LOW);
    delay(200);
    digitalWrite(LED_PIN, HIGH);
    delay(200);
  }
}

platformio.ini

[env:esp32dev]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.13/platform-espressif32.zip
board = esp32dev
framework = arduino
board_build.partitions = rainmaker_4MB_no_ota.csv
monitor_speed = 115200

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions