lib_i2s TDM performance on XS1
Posted: Thu Mar 15, 2018 2:59 pm
I'm getting started with the TDM master module in lib_i2s. My first goal is 16 channels in/out @ 96 kHz. This is implemented as 2 TDM data lines, each with 8 channels. If I clock SCLK at 25 MHz, I see that the data signal is not frame aligned correctly between the two TDM data output lines. If I slow the clock down to 48 kHz everything looks to be correct.
My TDM loopback is just dummy code at present
void tdm_loopback(server i2s_callback_if i2s)
{
int32_t samples[32];
while (1) {
select {
case i2s.init(i2s_config_t &?i2s_config, tdm_config_t &?tdm_config):
tdm_config.offset = 0;
tdm_config.sync_len = 1;
tdm_config.channels_per_frame = 8;
break;
case i2s.restart_check() -> i2s_restart_t restart:
restart = I2S_NO_RESTART;
break;
case i2s.receive(size_t index, int32_t sample):
samples[index] = sample;
break;
case i2s.send(size_t index) -> int32_t sample:
//sample = samples[index];
sample = 0xffff0000;
break;
}
}
}
I've read about i2s_frame, but that doesn't run on the XS1. Could I update the TDM code to forward samples to a streaming channel instead of using callbacks? Would that be expected to make a significant difference? Or, would a better approach be to try reduce the number of callbacks in the same manner that i2s_frame does?
Thanks,
Andrew
My TDM loopback is just dummy code at present
void tdm_loopback(server i2s_callback_if i2s)
{
int32_t samples[32];
while (1) {
select {
case i2s.init(i2s_config_t &?i2s_config, tdm_config_t &?tdm_config):
tdm_config.offset = 0;
tdm_config.sync_len = 1;
tdm_config.channels_per_frame = 8;
break;
case i2s.restart_check() -> i2s_restart_t restart:
restart = I2S_NO_RESTART;
break;
case i2s.receive(size_t index, int32_t sample):
samples[index] = sample;
break;
case i2s.send(size_t index) -> int32_t sample:
//sample = samples[index];
sample = 0xffff0000;
break;
}
}
}
I've read about i2s_frame, but that doesn't run on the XS1. Could I update the TDM code to forward samples to a streaming channel instead of using callbacks? Would that be expected to make a significant difference? Or, would a better approach be to try reduce the number of callbacks in the same manner that i2s_frame does?
Thanks,
Andrew