Persistent Storage freezing daisy

Hello im trying to use persistent storage to store some settings but it keeps freezing my daisy

here’s a basic example I tried to build by looking at the header cause I cant find any other examples on how to implement it.

#include <DaisyDuino.h>

// Define a struct for your settings
struct MySettings {
  int myValue;
  float anotherValue;
  // Add a comparison operator for the PersistentStorage to use
  bool operator!=(const MySettings& other) const {
    return myValue != other.myValue || anotherValue != other.anotherValue;

// Instantiate QSPIHandle
QSPIHandle qspi;

// Create an instance of PersistentStorage
PersistentStorage<MySettings> storage(qspi);

void setup() {
  // Initialize your settings with default values
  MySettings defaultSettings = {42, 3.14};
  // Initialize PersistentStorage
  // Load settings into a variable
  MySettings currentSettings = storage.GetSettings();
  // Modify settings
  currentSettings.myValue = 43;
  // Save settings

Try adding delay after GetSettings() and Save()

Hi KnightHill, thanks for the reply, unfortunately it didn’t help. This particular line is making the daisy to freeze it seems.


I suspect you need to initialize qspi before using it. This fragment is from daisy_seed.cpp:

    if(memory != System::MemoryRegion::QSPI)

Rather than initializing a new qspi handle and passing that to the persistent storage class, you need to pass the qspi handle member of the hardware object you are using (i.e. seed, pod, patch etc…) . qspi is a member of the seed class which is a subclass of the pod/patch/petal (etc…) class.

//Persistent Storage Declaration. Using type Settings and passed the devices qspi handle
PersistentStorage<Settings> SavedSettings(hw.seed.qspi);

I wrote a little guide on using persistent storage here: