Hello,
I also have problem using qspi.
I’d like to save/ load a structure (with all my synth parameters).
struct CONFIGURATION
{ … }
with curent_config an instance of this structure:
CONFIGURATION curent_config;
so far, I’ve made 2 functions to save / load this structure. This is working :
static CONFIGURATION DSY_QSPI_BSS saved_config;
void save_config() {
uint32_t base = 0x90000000;
hw.seed.qspi_handle.mode = DSY_QSPI_MODE_INDIRECT_POLLING;
dsy_qspi_init(&hw.seed.qspi_handle);
dsy_qspi_erase(base, base+sizeof(CONFIGURATION) );
dsy_qspi_write(base, sizeof(CONFIGURATION), (uint8_t*)&curent_config);
dsy_qspi_deinit();
}
void load_config() {
hw.seed.qspi_handle.mode = DSY_QSPI_MODE_DSY_MEMORY_MAPPED;
dsy_qspi_init(&hw.seed.qspi_handle);
memcpy(&curent_config, &saved_config, sizeof(CONFIGURATION));
dsy_qspi_deinit();
}
I tried without dsy_qspi_deinit(); as sugested by adam_f, but it was working only few times (after 2 or 3 write / read sequence, the datas where not read or write anymore).
Now, I’d like to have multiples slot to load / save. I change my functions to this :
void save_config(uint32_t address) {
uint32_t base = 0x90000000;
base += address * sizeof(CONFIGURATION);
hw.seed.qspi_handle.mode = DSY_QSPI_MODE_INDIRECT_POLLING;
dsy_qspi_init(&hw.seed.qspi_handle);
dsy_qspi_erase(base, base+sizeof(CONFIGURATION) );
dsy_qspi_write(base, sizeof(CONFIGURATION), (uint8_t*)&curent_config);
dsy_qspi_deinit();
}
void load_config(uint32_t address) {
hw.seed.qspi_handle.mode = DSY_QSPI_MODE_DSY_MEMORY_MAPPED;
dsy_qspi_init(&hw.seed.qspi_handle);
memcpy(&curent_config, &saved_config + (address * sizeof(CONFIGURATION)), sizeof(CONFIGURATION));
dsy_qspi_deinit();
}
but it’s not working : as soon as I write a configuration to an other slot than 0, the data read are not valid.
What I am doing wrong? how should I compute the correct address of the data to read and to write?