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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
179 Views
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?

Labels (1)
0 Kudos
1 Solution
90 Views
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.

View solution in original post

0 Kudos
2 Replies
91 Views
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 Kudos
98 Views

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 Kudos