How to use 4-channel Bidirectional TDM16 Slave interfaces

Hi

Our target board customized based on Jetson TX2 developer kit mainly use I2S/TDM interfaces as massive input/output channels.
Input data is many sensor values and audio channels, and output data is multi-channel audio.

We want to make TX2 receive input sensor/audio data from I2S/TDM interfaces, process those data, and output resultant audio data through the same I2S/TDM interfaces.

All four channel I2S/TDM interfaces(I2S0 ~ I2S3) of TX2 are connected with other DSP IC, which works as multichannel ADC, DAC, that is, codec.

The requirements are as follows:

  • Codec is “master” with regard to bclk/fs. So TX2 is “slave”.
  • All I2Sx_SCLK lines are tied together. One shared SCLK line is provided by codec DSP.
  • All I2Sx_LRCK lines are tied together. One shared LRCK line is provided by codec DSP.
  • All I2Sx must be “TDM 16”.
  • We will use all I2Sx channels with both input and output directions simultaneously.
  • Sampling rate: 48 KHz
  • Word length: 32 bits
  • There is no need for TX2 to control codec(DSP) by I2c, spi etc.

About requirements above I have two questions:
Q1. Is it possible for TX2 to work like these full specs?
Q2. What is the minimal modification on the reference kernel to achieve the requirement?
For example, as we expect, is it enough to modify just dts sound node properties without recompiling kernel image for adding codec/machine driver instead of rt565x codec driver?
If so, how should we modify the dts file?

Thank you in advance.

Best regards,
Johnny K. Jeong

Hello!

Sorry for the delay, some answer below …

Short answer YES!

Longer answer, each I2S interface can support a max bit clock frequency of 24.567MHz and at 48kHz with 16 32-bit channels, requires a bit clock of 24.567MHz which is within the spec.

I have created a test case that runs 4 I2S interfaces in parallel looping back the data and was able to verify on TX2 that at 24.567MHz I could run 4 simultaneously.

You will need to …

  1. Check the pin mux configuration
    We need to verify that all I2S interfaces you wish to use are correctly mux’ed enable the I2S interface on the pins. Please follow the instructions in the L4T documentation under the section ‘TX2 Configuring Pinmux GPIO and PAD’. Basically, there is a spreadsheet you can use to modify the pinmuxing which generates a dtsi file and then there is a tool to convert the dtsi file into the CFG file. This CFG file is used to configure the pin settings.

  2. Check the pin input-enable
    Given that the codec is the master, we need to check that the I2S SCLK and LRCK pins have the input enable bit set. By default I don’t believe that they are. While updating the pin mux settings in step 1, also check the input-enable bits are set for the SCLK and LRCK pins.

  3. Device-tree
    For each I2S interface in device-tree there is a DAI link defined for each of these links you need to configure the codec as master. For example see …

Regards,
Jon

Hello Jon

Thank you very much for your kind explanation.

I’ve made one loop for simple test and found it works!

The test loop is like this.
DSP(codec) generates sine wave and sends it to TX2 through I2S0 input channel.
I recorded it on test.wav using ALSA record utility.
And then I made TX2 send the audio data to DSP back through I2S3 output channel by using ALSA play utility.
Finally I’ve found DSP plays sine wave in the AMP outputs as expected.

For this I modified only sound node in dts file(step 3 in your advice), but while I try other channels if I meet a problem, I will try pin mux settings as you inform.

Thank you.

Regards,
Johnny

hi Johnny Jeong
I have a project I am about to start with a similar requirement of TDM audio as what you have detailed here. Looking to sub contract some components if your interested. Im not sure how to drop you a private message in this forum though.