XIAO BLE Sense persistent data

I am planning to build a device using BLE. Mobile app will be connected to the device and device will send data over bluetooth. But mobile device may not be around the device all the time or bluetooth may be turned off. So I need to store data on the device until app connects. BLE sense has 1MB flash & 2MB onboard flash. Can I use it to store data? If so, is there any library or I just use global variables?

It’s better for you to store data to the 2MB onboard flash.
we have provide a demo of read and wirte to the onboard flash here

Before you run this demo code.
Please first download the arduino core and overwrite the arduino core in C:\Users\hk\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52


Perfect ! Thank you. I will give it a try.

It worked like a charm! Thank you ! In case anyone else facing an issue like

Error during Upload: Property 'upload.tool.serial' is undefined

Add following line in boards.txt file ( ~/Library/Arduino15/packages/Seeeduino/hardware/nrf52/2.6.1/boards.txt)


below the following line.


1 Like

I did overwrite mentioned folder but all I get is an error:
fatal error: QSPIFBlockDevice.h: No such file or directory

Invalid library found in C:\Users\Mike\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\2.6.1\libraries\Spi_Flash: no headers files (.h) found in C:\Users\Mike\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\2.6.1\libraries\Spi_Flash

Where can I get QSPIFBlockDevice.h from?

Thank you.

Sorry if it sounds stupid but how do we overwrite the core? I’m on Windows.

Take my own computer for example.
My core is store in C:\Users\hk\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\2.6.1
What you need to do is download the and unzip the new core and replace it with the previous directory.

Hi Xiongjian, thanks for the help!

Did you also download the mbed-os repository mentioned in GitHub page in your example link? If so where did you download it to?


EDIT: Solved, after downloading the repo posted in the solution, download this repo and add a symlink in the 2.6.1\cores\arduino to the ArduinoCore-API\api.

To add a symlink (on Mac/linux), type the following cmd in terminal:

ln -s /path/to/ArduinoCore-API/api /path/to/2.6.1/cores/arduino

Finally, I had to change the permissions to the Adafruit-nrfutil file, the cmd for this was:

cd /path/to/adafruit-nrfutil
chmod 775 adafruit-nrfutil

To check if it worked: ls -l and it should return that these are the following permissions: -rwxr-xr-x

Hope this helps someone!

Make sure you have the correct board selected for upload… I ran into this problem too.

You save my day. It really worked like a charm!