Hello, I am unable to mount a mbed littlefs filesystem to the Xiao BLE Sense on-board qspi flash. Urgent help needed.
I am using Windows Arduino IDE 2.04, and I installed the Seeed NRF52 mbed-enabled Boards v2.9.1 through board manager.
First, I checked this post about qspi demo code.
However, the qspi demo code does not work with the above mentioned seeed library v2.9.1. I went to the lib repo and found a commit after the v2.9.1 release. I updated the lib files according to the commit and the demo code worked. The commit is linked below.
Second, I tried to mount a mbed littlefs to the qspi, but failed. Then I tried to mount the littlefs to a heap blockdevice, it worked! So I was wondering what should I do to mount the littlefs to the on-board qspi.
My testing code is attached below. The format error code is -4005, and the mount error code is -138. Thanks a lot!
#include “mbed.h”
#include “BlockDevice.h”
#include “QSPIFBlockDevice.h”
#include “LittleFileSystem.h”
#include “HeapBlockDevice.h”
//QSPIFBlockDevice bd(QSPI_FLASH1_IO0, QSPI_FLASH1_IO1, QSPI_FLASH1_IO2, QSPI_FLASH1_IO3, QSPI_FLASH1_SCK, QSPI_FLASH1_CSN, QSPIF_POLARITY_MODE_1, MBED_CONF_QSPIF_QSPI_FREQ);
//mbed::BlockDevice *bd = new mbed::HeapBlockDevice(2048, 1, 1, 512);
mbed::BlockDevice *bd = new QSPIFBlockDevice(QSPI_FLASH1_IO0, QSPI_FLASH1_IO1, QSPI_FLASH1_IO2, QSPI_FLASH1_IO3, QSPI_FLASH1_SCK, QSPI_FLASH1_CSN, QSPIF_POLARITY_MODE_1, MBED_CONF_QSPIF_QSPI_FREQ);
mbed::LittleFileSystem fs(“fs”);
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println(“init the blockdevice…”);
int err = bd->init();
if(err) {
Serial.print(“init error. err code=”);
Serial.println(err);
}
Serial.print("bd read size = ");
Serial.println(bd->get_read_size());
Serial.print("bd program size = ");
Serial.println(bd->get_program_size());
Serial.print("bd erase size = ");
Serial.println(bd->get_erase_size());
Serial.print("bd erase value at addr 0 = ");
Serial.println(bd->get_erase_size(0));
int force_format = 1;
if (force_format) {
err = fs.format(bd);
if (err) {
Serial.print("format err = ");
Serial.println(err);
}
}
err = fs.mount(bd);
if (err) {
Serial.print("mount err = ");
Serial.println(err);
}
bd->deinit();
}
void loop() {
Serial.println(“testing done”);
delay(10000);
}