Hi friends,
new day, new problem: I am trying to save my cv-recorder buffer[1920000] to the preset, which gives me a DTCMRAM overflow. Usually the buffer lives in SDRAM, code runs from SRAM.
I assumed that I could use the full 8MB of QSPI, but now the DTCMRAM is in the way. Can this be solved?
Here is a small example:
Struct:
//Setting Struct containing parameters we want to save to flash
struct Settings {
int current_preset;
float p[5][6];
int modAssign[3][6];
float modAmt[3][6];
int modSource[3][6];
float modprm[14];
float cvaudioBuffer[1920000];
Load / Save:
//Persistent Storage Declaration. Using type Settings and passed the devices qspi handle
PersistentStorage<Settings>storage(hw.qspi);
bool trigger_save = false;
void Load() {
// Ensure storage.Init() has been called before Load()
storage.Save();
Settings &LocalSettings = storage.GetSettings();
current_preset = LocalSettings.current_preset;
for (int i = 0; i < 5; i++)
{
for (int y = 0; y < 6; y++)
{
p[i][y] = LocalSettings.p[i][y];
}
}
for (int i = 0; i < 3; i++)
{
for (int y = 0; y < 6; y++)
{
modAssign[i][y] = LocalSettings.modAssign[i][y];
modAmt[i][y] = LocalSettings.modAmt[i][y];
modSource[i][y] = LocalSettings.modSource[i][y];
}
}
for (int i = 0; i < 14; i++) {
modprm[i] = LocalSettings.modprm[i];
}
current_preset = LocalSettings.current_preset;
for (int i = 0; i < 5; i++)
{
stutter_1->prm[i] = p[i][0] / 48;
gdelay_2->prm[i] = p[i][1] / 48;
dist->prm[i] = p[i][2] / 48;
filter_4->prm[i] = p[i][3] / 48;
delay_5->prm[i] = p[i][4] / 48;
reverb_6->prm[i] = p[i][5] / 48;
}
for (int x = 0; x < 14; x++)
{
modprm[x] = modprms[x] / 48;
}
for (int x = 0; x < 1920000; x++)
{
cvrec->cvaudioBufferL[x] = LocalSettings.cvaudioBuffer[x];
}
for (int i = 0; i < 3; i++)
{
for (int x = 0; x < 6; x++)
{
mod[i][x] = modAmt[i][x] / 48;
}
}
}
void Save() {
Settings &LocalSettings = storage.GetSettings();
LocalSettings.current_preset = current_preset;
for (int i = 0; i < 5; i++)
{
for (int y = 0; y < 6; y++)
{
LocalSettings.p[i][y] = p[i][y];
}
}
for (int i = 0; i < 3; i++)
{
for (int y = 0; y < 6; y++)
{
LocalSettings.modAssign[i][y] = modAssign[i][y];
LocalSettings.modAmt[i][y] = modAmt[i][y];
LocalSettings.modSource[i][y] = modSource[i][y];
}
}
for (int i = 0; i < 14; i++) {
LocalSettings.modprm[i] = modprm[i];
}
for (int x = 0; x < 1920000; x++)
{
LocalSettings.cvaudioBuffer[x] = cvrec->cvaudioBufferL[x];
}
LocalSettings.current_preset = current_preset;
System::Delay(100);
trigger_save = true;
}
// Function to read the button state
bool ReadButton() {
return dsy_gpio_read(&button_pin) != 0; // Return true if the button is pressed
}
bool ReadClock() {
return dsy_gpio_read(&clock_pin) != 0; // Return true if the button is pressed
}
Thanks!