XIAO BLE Sense persistent data

Hi,
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?

2 Likes

Hello.
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

2 Likes

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)

xiaonRF52840Sense.upload.tool.default=nrfutil

below the following line.

xiaonRF52840Sense.upload.tool=nrfutil

1 Like

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


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.
Thanks!

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?

Thanks!

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!

Running this now in February 2023 using Arduino IDE 2.0.3 and ArduinoCore-mbed-2.9.1 on a Mac and getting this error:
'QSPI_FLASH1_IO0' was not declared in this scope

Any ideas?

Had the same issue as described by @ bradocchs.
OS: windows 10. Installed the ArduinoCore-mbed-2.9.1 through board manager of Arduino IDE.
I guess there are some json files need to be modified. But not sure how to do it.

I faced the same issue and followed this advice (replacing those 5 files) after replacing the ‘arduino’ folder