Problems with Versio and DSY_SDRAM_BSS

hi there,

I’m having difficulties using the SRAM memory on a versio module.

After compiling I’m hearing cracks and pops and somtimes ultra high frequency…

What am I doing wrong?

thanks and cheers!

#include "daisy_versio.h"
#include "daisysp.h"

using namespace daisy;
using namespace daisysp;

#define MAX_DELAY static_cast<size_t>(96000 * 2.5f)

DaisyVersio hw;

float currentDelay, feedback, delayTarget, cutoff, sample_rate;

static DelayLine<float, MAX_DELAY> DSY_SDRAM_BSS dell;


void GetDelaySample(float &outl, float inl);

void AudioCallback(AudioHandle::InputBuffer in, AudioHandle::OutputBuffer out, size_t size)
{
	float outl, inl;
    for(size_t i = 0; i < size; i++)
    {
		inl = in[0][i];
        GetDelaySample(outl,  inl);
    }

    
	
}

int main(void)
{
	hw.Init();
	

	hw.SetAudioBlockSize(4); // number of samples handled per callback
	hw.SetAudioSampleRate(SaiHandle::Config::SampleRate::SAI_96KHZ);
	sample_rate = hw.AudioSampleRate();
	

	hw.StartAdc();
	dell.Init();

	//delay parameters
    currentDelay = delayTarget = sample_rate * 0.75f;
    dell.SetDelay(currentDelay);

	hw.StartAudio(AudioCallback);


	

	while(1) {

	}
}




void GetDelaySample(float &outl, float inl)
{
    fonepole(currentDelay, delayTarget, .00007f);

    dell.SetDelay(currentDelay);
    outl = dell.Read();

    dell.Write((feedback * outl) + inl);
    outl = (feedback * outl) + ((1.0f - feedback) * inl);
}

ok. what the heck. why is that everytime I’m scratching my head for days and finally decide to post and ask for help in some forum, 5minutes later the solution is somehow here…???
anyhow, this works:

#include "daisysp.h"
#include "daisy_versio.h"


#define MAX_DELAY static_cast<size_t>(96000 * 1.f)

using namespace daisy;
using namespace daisysp;

DaisyVersio hw;



DelayLine<float, MAX_DELAY> DSY_SDRAM_BSS del;
float                        currentDelay;
float                        delayTarget;


Parameter p_delay, p_feedback, p_mix;

float feedback;
int   drywet;

void ProcessControls();

static void AudioCallback(AudioHandle::InputBuffer  in,
                          AudioHandle::OutputBuffer out,
                          size_t                    size)
{
    ProcessControls();

    for(size_t i = 0; i < size; i++)
    {
        float mix     = 0;
        float fdrywet = (float)drywet / 100.f;
		//set delay times
        fonepole(currentDelay, delayTarget, .0002f);
        del.SetDelay(currentDelay);

        float read = del.Read();
        del.Write((feedback * read) + in[0][i]);
        mix += read;

        //apply drywet and attenuate
        mix       = fdrywet * mix * .3f + (1.0f - fdrywet) * in[0][i];
        out[0][i] = mix;
    }
}

void InitDelays(float samplerate)
{
	del.Init();
	p_delay.Init(hw.knobs[DaisyVersio::KNOB_0],
					samplerate * .1,
					MAX_DELAY,
					Parameter::LOGARITHMIC);

    //feedback
    p_mix.Init(hw.knobs[DaisyVersio::KNOB_1], 0, 100, Parameter::LINEAR);
    p_feedback.Init(hw.knobs[DaisyVersio::KNOB_2], 0, 1, Parameter::LINEAR);
}

int main(void)
{
    float samplerate;
    hw.Init(); // Initialize hardware (daisy seed, and hw)
	hw.SetAudioBlockSize(4); // number of samples handled per callback
	hw.SetAudioSampleRate(SaiHandle::Config::SampleRate::SAI_96KHZ);
    samplerate = hw.AudioSampleRate();

    InitDelays(samplerate);


    hw.StartAdc();
    hw.StartAudio(AudioCallback);
    while(1){
    }
}


void ProcessControls()
{
    hw.ProcessAnalogControls();
    hw.ProcessAllControls();

	delayTarget = p_delay.Process();
    feedback = p_feedback.Process();
	drywet = p_mix.Process();
}