Daisy seed + SAI2

Hi there,

I am working on a project which makes use of two codecs. I got an external WM8731 codec board which I want to use with SAI2.

I butchered DaisySeed::ConfigureAudio() to include SAI2 initialization as per the below:

    // Configure
    SaiHandle::Config sai_config2;
    sai_config2.periph = SaiHandle::Config::Peripheral::SAI_2;
    sai_config2.sr = SaiHandle::Config::SampleRate::SAI_48KHZ;
    sai_config2.bit_depth = SaiHandle::Config::BitDepth::SAI_24BIT;
    sai_config2.a_sync = SaiHandle::Config::Sync::SLAVE;
    sai_config2.b_sync = SaiHandle::Config::Sync::MASTER;
    sai_config2.pin_config.fs = GetPin(27);
    sai_config2.pin_config.mclk = GetPin(24);
    sai_config2.pin_config.sck = GetPin(28);

    // Data Line Directions
    sai_config2.a_dir = SaiHandle::Config::Direction::RECEIVE;
    sai_config2.pin_config.sa = GetPin(26);
    sai_config2.b_dir = SaiHandle::Config::Direction::TRANSMIT;
    sai_config2.pin_config.sb = GetPin(25);

    I2CHandle::Config i2c_config;
    i2c_config.mode           = I2CHandle::Config::Mode::I2C_MASTER;
    i2c_config.periph         = I2CHandle::Config::Peripheral::I2C_1;
    i2c_config.speed          = I2CHandle::Config::Speed::I2C_400KHZ;
    i2c_config.pin_config.scl = GetPin(11);
    i2c_config.pin_config.sda = GetPin(12);

    I2CHandle i2c_handle;
    i2c_handle.Init(i2c_config);

    Wm8731::Config codec_cfg;
    codec_cfg.Defaults();

    Wm8731 codec;
    codec.Init(codec_cfg, i2c_handle);

    // Then Initialize
    SaiHandle sai_2_handle;
    sai_2_handle.Init(sai_config2);

    // Audio
    AudioHandle::Config audio_config;
    audio_config.blocksize  = 48;
    audio_config.samplerate = SaiHandle::Config::SampleRate::SAI_48KHZ;
    audio_config.postgain   = 1.f;
    audio_handle.Init(audio_config, sai_1_handle, sai_2_handle);

and then I simply write to the desired output streams in the audio callback. While this works, there is a problem related to some audible clicks when outputing a full amplitude sine. You can hear the effect here: https://hq.scene.ro/sai2-sine-output.flac

Am I doing something wrong? Does anybody else have this problem?

Thanks,
benishor