1-slot delay when using I2S with DSP/TDM mode

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

1-slot delay when using I2S with DSP/TDM mode

跳至解决方案
231 次查看
carlocaione
Contributor II

Using the EVK MIMXRT685 as I2S slave configured as:

  • TDM / DSP mode A (mono)
  • 16 slots (channels) per frame
  • 512 SCK per frame
  • 32 SCK per slot
  • 24 bits of audio data per slot, left aligned (but I'm sampling 32-bits)
  • WS pulsed for one SCK time
  • Data sampled on WS rising edge

A sample capture for the first 2 channels in the following picture (`0x000001FF` on the first channel, and `0x00000200` on the second channel, ...)

Screenshot 2024-04-08 at 14.58.45.png

The I2S controller is used in interrupt mode configured as follows:

 

I2S_RxGetDefaultConfig(&s_RxConfig);

s_RxConfig.masterSlave = kI2S_MasterSlaveNormalSlave;
s_RxConfig.mode = kI2S_ModeDspWsShort;
s_RxConfig.leftJust = true;
s_RxConfig.divider = 1;
s_RxConfig.oneChannel = true;
s_RxConfig.dataLength = 32;
s_RxConfig.frameLength = 32;

 

The problem is that the first channels / slot is skipped.

If I break into the I2S ISR and check the content of `FIFORD` the first data I get is `0x00000200` instead of `0x000001FF`.

 

Why the first slot / channel is skipped?

标签 (1)
0 项奖励
1 解答
142 次查看
carlocaione
Contributor II

This is due to a misconfiguration of the I2S instance on my side.

To read 16-channels we need at least I2S instances (for example I2S4 and I2S5), configured as follows:

s_RxConfig.masterSlave = kI2S_MasterSlaveNormalSlave;
s_RxConfig.mode = kI2S_ModeDspWsShort;
s_RxConfig.dataLength = 32;
s_RxConfig.frameLength = 32 * 16U;
s_RxConfig.position = 0;

I2S_RxInit(I2S5, &s_RxConfig);
I2S_EnableSecondaryChannel(I2S5, kI2S_SecondaryChannel1, false, (64 * 1));
I2S_EnableSecondaryChannel(I2S5, kI2S_SecondaryChannel2, false, (64 * 2));
I2S_EnableSecondaryChannel(I2S5, kI2S_SecondaryChannel3, false, (64 * 3));

s_RxConfig.position = 256;

I2S_RxInit(I2S4, &s_RxConfig);
I2S_EnableSecondaryChannel(I2S4, kI2S_SecondaryChannel1, false, 256 + (64 * 1));
I2S_EnableSecondaryChannel(I2S4, kI2S_SecondaryChannel2, false, 256 + (64 * 2));
I2S_EnableSecondaryChannel(I2S4, kI2S_SecondaryChannel3, false, 256 + (64 * 3));
 

To be perfectly honest the user manual is not crystal clear about how and when to use multiple instances and channels pairs.

在原帖中查看解决方案

0 项奖励
2 回复数
143 次查看
carlocaione
Contributor II

This is due to a misconfiguration of the I2S instance on my side.

To read 16-channels we need at least I2S instances (for example I2S4 and I2S5), configured as follows:

s_RxConfig.masterSlave = kI2S_MasterSlaveNormalSlave;
s_RxConfig.mode = kI2S_ModeDspWsShort;
s_RxConfig.dataLength = 32;
s_RxConfig.frameLength = 32 * 16U;
s_RxConfig.position = 0;

I2S_RxInit(I2S5, &s_RxConfig);
I2S_EnableSecondaryChannel(I2S5, kI2S_SecondaryChannel1, false, (64 * 1));
I2S_EnableSecondaryChannel(I2S5, kI2S_SecondaryChannel2, false, (64 * 2));
I2S_EnableSecondaryChannel(I2S5, kI2S_SecondaryChannel3, false, (64 * 3));

s_RxConfig.position = 256;

I2S_RxInit(I2S4, &s_RxConfig);
I2S_EnableSecondaryChannel(I2S4, kI2S_SecondaryChannel1, false, 256 + (64 * 1));
I2S_EnableSecondaryChannel(I2S4, kI2S_SecondaryChannel2, false, 256 + (64 * 2));
I2S_EnableSecondaryChannel(I2S4, kI2S_SecondaryChannel3, false, 256 + (64 * 3));
 

To be perfectly honest the user manual is not crystal clear about how and when to use multiple instances and channels pairs.

0 项奖励
150 次查看
Habib_Melchor_Santos
NXP Employee
NXP Employee

Hello @carlocaione ,

I'm looking into this issue, and I'll respond you as soon as possible. In the meantime, can you provide me information about what example of the SDK you're using and in which version you're working with?
BR,
Habib.

0 项奖励