Hello all!
I have been having issues with successfully loading and storing data to QSPI on Daisy Seed v1.1 rev boards.
Loading and saving of small amounts of data (< 1 kB mixture of floats and ints) seems to work fine, but on occasion when I read the data back in, some of the data shows different values than the original saved values.
I am now trying to save larger amounts of data (192 kB floats per sample). The result is a combination of corrupted data (either noise, a mixture of noise and the sample sound) and also getting hard faults (Bus Errors).
Here is the snippet of code that seems to be the culprit;
// QSPI - load and save
// 4kB blocks
#define FLASH_BLOCK 4096
uint8_t DSY_QSPI_BSS qspi_buffer[FLASH_BLOCK * 2048]; // allocate all for sample storage
void FlashLoad(uint8_t aSlot)
{
hardware.qspi.DeInit();
QSPIHandle::Config qspi_config;
qspi_config.device = QSPIHandle::Config::Device::IS25LP064A;
qspi_config.mode = QSPIHandle::Config::Mode::MEMORY_MAPPED;
qspi_config.pin_config.io0 = {DSY_GPIOF, 8};
qspi_config.pin_config.io1 = {DSY_GPIOF, 9};
qspi_config.pin_config.io2 = {DSY_GPIOF, 7};
qspi_config.pin_config.io3 = {DSY_GPIOF, 6};
qspi_config.pin_config.clk = {DSY_GPIOF, 10};
qspi_config.pin_config.ncs = {DSY_GPIOG, 6};
hardware.qspi.Init(qspi_config);
size_t size = (48000 * bufferTime);
//memcpy(*dest, *src, sizet);
memcpy(&sBufferL, &qspi_buffer[(48000 * bufferTime * aSlot)], size);
}
void FlashSave(uint8_t aSlot)
{
hardware.qspi.DeInit();
QSPIHandle::Config qspi_config;
qspi_config.device = QSPIHandle::Config::Device::IS25LP064A;
qspi_config.mode = QSPIHandle::Config::Mode::INDIRECT_POLLING;
qspi_config.pin_config.io0 = {DSY_GPIOF, 8};
qspi_config.pin_config.io1 = {DSY_GPIOF, 9};
qspi_config.pin_config.io2 = {DSY_GPIOF, 7};
qspi_config.pin_config.io3 = {DSY_GPIOF, 6};
qspi_config.pin_config.clk = {DSY_GPIOF, 10};
qspi_config.pin_config.ncs = {DSY_GPIOG, 6};
hardware.qspi.Init(qspi_config);
size_t start_address = (48000 * bufferTime * aSlot);
size_t slot_address = start_address;
size_t size = (48000 * bufferTime);
hardware.qspi.Erase(slot_address, slot_address + size);
hardware.qspi.Write(slot_address, size, (uint8_t*)&sBufferL);
}
The entire code project is here .
Is there something I am overlooking as far as proper coding in the QSPI load/save subroutines?
Does anybody have any insights as to why the code is failing?
Thanks!