Saving device state information between boots

Is it possible to save some basic stuff like parameter settings somewhere on the seed that will then be accessible next time I power up? or would this require an sd card?

Certainly, you can store information in the ‘flash memory’ - both the smaller on chip flash in the STM32H750IBK6 and the larger flash on the Seed, more or less permanently.

1 Like

Ok great, could you point me in the direction of any documentation on the commands id need? I assume its STM32 stuff rather than in libdaisy right? (i couldnt find anything in the libdaisy documentation)

I might try throw together a quick demonstration for other noobs

Really?
https://electro-smith.github.io/libDaisy/group__flash.html

:sweat_smile: Maybe my search could have been more extensive…

Thank you!

1 Like

That documentation doesn’t provide any guidance for how to actually use the commands.

An example of using the QSPI flash to store/retrieve settings is the Veno-Echo; source code can be found on GitHub.

See also the PersistentStorage Class in libDaisy.

2 Likes

Thank you! will check that now. Sounds like a demonstration might be helpful then. Will try and put something together once i wrap my head around it

Below is the code I use to save/load my synth’s configuration. Make sure you have
USE_FATFS = 1 in your makefile.

bool ByteBeatSynth::LoadParameters()
{
    bool   success = false;
    size_t byteswritten;
    size_t len = sizeof(config_);

    // Read back the test file from the SD Card.
    if(f_open(&SDFile_, CONFIG_FILE_NAME, FA_READ) == FR_OK)
    {
        f_read(&SDFile_, &config_, len, &byteswritten);
        f_close(&SDFile_);
        success = true;

    ...
    }

    return success;
}

bool ByteBeatSynth::SaveParameters()
{
    size_t byteswritten;
    size_t len = sizeof(config_);

    // initialize config_
    ...

    // Open and write the test file to the SD Card.
    if(f_open(&SDFile_, CONFIG_FILE_NAME, (FA_CREATE_ALWAYS) | (FA_WRITE))
       == FR_OK)
    {
        f_write(&SDFile_, &config_, len, &byteswritten);
        f_close(&SDFile_);
        return true;
    }

    return false;
}

I believe that is an example for saving params on SD-Card, and while that certainly makes sense and may be useful, the original question was how to save across boot, without using SD-Card.

You are right, I should have read the OP more carefully.

1 Like