XIAO store data in QSPI flash memory

This library depends on other libraries and certain files in the “cores” directory. While each library has this structure and I can include it, the dependencies across multiple directories are beyond my programming skills.

This one worked for me (using BLE Sense board version 1.0 ). What are the problems you are running into?

  1. I cloned the git Adafruit_nRF52_Arduino, which is not valid library to be loaded
  2. I unzipped and zipped the libraries Adafruit_LittleFS and InternalFileSystem from within (those cannot be cloned individually)
    2a) I was able to add both libraries to my sketch
  3. I tried to add the library [Adafruit_TinyUSB_Arduino @ e58ed11] in the same way
    ==> Error: The library “Adafruit_TinyUSB_Arduino-e58ed11de15e2cfbd71f1a79cf84a2372ba27e08” cannot be used.
    Library names must contain only basic letters and numbers.
    (ASCII only and no spaces, and it cannot start with a number)
  4. I added Adafruit_TinyUSB via the library manager
  5. Compilation error:
    …/Arduino/libraries/InternalFileSytem/src/InternalFileSystem.cpp:26:0:
    …/Arduino/libraries/InternalFileSytem/src/flash/flash_nrf5x.h:28:10: fatal error: common_inc.h: No such file or directory
    #include “common_inc.h”
    ^~~~~~~~~~~~~~
    compilation terminated.
    exit status 1

If you installed SEED’s version 1.0 of the XIAO BLE Sense then you should be seeing this “example” file-tree. This comes with all the required libraries. If you do not have this file-tree showing under examples, then uninstall and reinstall version 1.0 (Adafruit) of the SEEED XIAO BLE Sense and check again.

Version 2.6.1 (Mbed) of the XIAO BLE Sense surely has a different structure and library.

1 Like

Anyone know how i can download the files to my computer from the flash directly through a cable? Thanks!

Hi,
I struggled for hours to find out how to write data to the flash memory. The subject itself is not well documented, there are several libraries its not clear which one to use. Some of them seem to write in the MCU internal flash…
Finally I get some success with Adafruit_SPIFlash.

I reworked their sample flash_speedtest and adapt it to this board. Here is a link to my gitlab repository.

You’ll see that it’s not so complicated, it’s mostly a lack of documentation.

@user1203 I think that your question is out of the scope of that thread.

Hi, have you tried to mount a filesystem to the qspi blockdevice? Thanks.

Please check my post about how to use the qspi on the seeed xiao ble sense. The qspi works.

But the littlefs does not work with that block device. I need help. Thanks.

Well,

How did you succeed in using the QSPI block device?
I tried to rebuild mbed including the patches 91 and 92 as described here. It took me a day to figure out how to do this. Including QSPIFBlockDevice.h still does not work.

Well… This board bored me a lot…

If others are thinking it, I’ll say it.
There is NO clear example that’s NOT a “HACK JOB” for SEEED on using the QSPI sure it works , If you want to buy a bridge I own one in Jersey I can Sell you.
No SEEED Engineers ever post definitive info.

Anyone have it working like a normal Flash memory with code ? , ie.You can read and write and erase , with out the need to wave a chicken over it and spin around 3.5 times and howl at the moon twice to get this stuff working?
C’mon SEEED, Adafruit is eating your lunch on this stuff…
–Soap box–OFF—
HTH
GL :slight_smile:

Hi,
Thank you @yangx30 for the hint, but… well, I know about this commit, it has been integrated in the master branch since more than a year. I checked the branch and didn’t found a “rollback” at least in the commit messages. So it is supposed to work out of box, even in the 2.9.1 release.

I tried the latest commit of that repository, it still doesn’t work. So there is probably a regression somewhere.
@yangx30 Actually, you opened this issue and closed it right after. But in my case I still have the same compilation errors as you had.

So, for now, I’m stuck with mbed, but I have some succes with the other … OS/solution/whatever?

Hi, that commit has NOT integrated in the master. Just modified the files and replace the local .a file with the provided .a file. It works.

Well,
according to what I see in git gui it is, but it has been reverted for some weird reason by this commit:

b659b54325c23ba69fdf3c252c5875436f52dc90 (for some reason I cannot make link to the repository like you did)

I cherry-picked that commit and indeed, QSPIF works. It would be nice to integrate it back. Maybe worth a merge request…

I don’t like when things are too… straight forward. But here… it’s a maze. I don’t like it too much either.

Hi there, Wonder if anyone has a working 2.9.1 board files QSPI flash that works, R,W,Erase…?
Seems this is TOO difficult for the SEEED (marketers) a.k.a engineering to provide a working example of this Smoke and Mirror Xiao line.
I beginning to wonder if they have any Xiao boards that actually do ALL they claim ?? Hmmm? also appears they CAN’t do Products on there own Software bases… Always need to poach other hardware platforms Gits… Hmmm.
GL :slight_smile:
PJ

Hello, the qspi flash does work with 2.9.1. Check this out:
Xiao BLE Sense using Mbed LittleFS on QSPI blockdevice - Products & Technology - Seeed Forum (seeedstudio.com)
For the erase, you need to erase at least 4kb (4096), which is the return value of bd.get_erase_size(0). In addition, you need to pre-erase the flash before read/write. Otherwise it is unstable. Good luck.

Yes, technically it works I suppose ? Does it break anything else? I have found changes to the variants’ and other files may fix symptoms but breaks certain Interrupt functionality for IMU and other GPIOE’s I find it Odd the SEEED doesn’t provide anything remotely close to a demo or example of the Xiao’s QSPI flash capabilities. Could they have implemented it incorrectly? Sound allot like the “SLEEP” modes it will do but is not supported WTH? SMH?
Xiao software is like an Onion.
HTH
GL :-p

With FreeRTOS its just a matter of providing the correct description of the Flash device. Though, I didn’t tried to use a file system on it… but I’m confident that it works.
With Mbed, yes, it’s more complicated, but it works.

Regarding whether or not something is broken with the corrected libmbed.a, basically, you have to try it. Since I don’t like black boxes, I tried to compile libmbed.a myself but I failed miserably and gave up.

LOL, I hear you… I’ll get some time and check it out. Sad it isn’t a no brainer. STD.lib.
maybe Adafruit will pick it up and clean it up.

GL :slight_smile:
PJ

Hi, I used the Seed Studio example for QSPI flash memory to store data instead of the external EEPROM I was using. The write and read to the memory is working.
My problem is that when I implement evrithing to my code the wire.h library stopped working and I can not get the sensor data.
Any help, please?

Sorry for bothering guys. the problem was the ISR time interrupt not the wire library. I will find a workaround.