MBRBlockDevice::init() return error -4006, when called after attempting to connect to WiFi network.
MBRBlockDevice::init() returns success (0), when call to connect to WiFi is commented out.
QSPIF_BD_ERROR_DEVICE_NOT_UNIQUE = -4006, /* Only one instance per csel is allowed */
Anyone have any suggestion?
#include <WiFi.h>
#include "MBRBlockDevice.h"
#include "QSPIFBlockDevice.h"
void UseBlockDevice() {
QSPIFBlockDevice root(QSPI_SO0, QSPI_SO1, QSPI_SO2, QSPI_SO3, QSPI_SCK, QSPI_CS, QSPIF_POLARITY_MODE_1, 40000000);
mbed::MBRBlockDevice blockDevice(&root, 3);
int err = blockDevice.init();
Serial.print("blockDevice.init(): ");
Serial.println(err);
err = blockDevice.deinit();
Serial.print("blockDevice.deinit(): ");
Serial.println(err);
}
void ConnectToWiFi() {
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("Communication with WiFi module failed!");
return;
}
Serial.println("Attempting to connect");
auto status = WiFi.begin("BadSSID", "BadPassword");
Serial.println(status == WL_CONNECTED ? "Connected to wifi" : "Failed to connect to wifi");
}
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
ConnectToWiFi();
UseBlockDevice();
}
void loop() {
}
Output:
Attempting to connect
Failed to connect to wifi
blockDevice.init(): -4006
blockDevice.deinit(): 0