Jetson Nano i2s/tdm configuration

Hello everybody,
following various thread I was able to route I2S4 on the 40pin header. Now I would like to configure playback/record of a TDM stream of 16ch at 16bits 48KHz. Is there any guide that describes how to configure alsa using amixer? I’m using latest jetpack and as far I understood all configuration is made via userspace

Using following settings
amixer -c1 sset ‘ADMAIF1 Mux’ I2S4
amixer -c1 sset ‘ADMAIF1 Channels’ 16
amixer -c1 sset ‘I2S4 Mux’ ADMAIF1
amixer -c1 sset ‘I2S4 Channels’ 16
amixer -c1 sset ‘I2S4 Sample Rate’ 48000

If I play a raw file using

aplay -Dhw:tegrasndt210ref,0 -t raw -c16 -fS16_LE -r 48000 test.raw

with oscilloscope I see only the first L/R channels on the bus. All other slots are fixed to zero

Thanks,
Paul

Hello!

It should not be necessary to set all of the above. Can you try the following …

$ alsactl init tegrasndt210ref 
$ amixer -c tegrasndt210ref sset 'ADMAIF1 Mux' I2S4
$ amixer -c tegrasndt210ref sset 'I2S4 codec frame mode' dsp-a
$ aplay -Dhw:tegrasndt210ref,0 -t raw -c 16 -f S16_LE -r 48000 test.raw

Note that the number of channels will be set to 16 and the rate set to 48kHz by the aplay command. You only need to set the number controls for these if you wish to override the channels and rate specified in the aplay command. This is typically used in more complex scenarios where the number of channels is being change within the audio subsystem. For normal playback cases, it is not necessary to configure these.

Regards,
Jon

Hello Jon,
I did some tests but if I change the number of channels in aplay (2, 4, 8 or 16) I always see a 3MHz clock on the SCLK pin.
Furthermore my DSP needs the FS with a 50% duty cycle (left-j configuration).

Do you think it is possible to configure in this manner?

Thanks,
Paul

Hi Paul,

Can you apply the following settings and try again?

$ amixer -c tegrasndt210ref sset 'ADMAIF1 Channels' 0
$ amixer -c tegrasndt210ref sset 'I2S4 Channels' 0

My advise would be to use the dsp-a or dsp-b mode. The difference being that dsp-a has a 1-bit delay after the fsync goes high until the first data is outputed, where as dsp-b mode has a 0-bit delay. You can set the fsync width using the following control.

$ amixer -c tegrasndt210ref sset 'I2S4 fsync width' 128

Regards,
Jon

Hello Jon,
with those two additional commands, I was able to see correct waveforms with oscilloscope.

Is there any official documentation where all those alsa parameters are described?

Thanks for the support.

Hi Paul,

Thanks for the confirmation. Unfortunately, these mixer controls are not described in the documentation, but we are in the process of updating the audio documentation and so for the next L4T release this should be clearer.

Regards,
Jon

Hi I’m following this thread because i have the same problem. I will be waiting to use the audio when the documentation will be ready.

Regards

Gabriel

I tried to connect 16 MEMS ICS-52000 MIC Array to perform Beam Forming AI based with the Jatson NANO. I have an issue that seems like competability between the NANO TDM format settings and the ICS-52000 MEMS Mic TDM Protocol. From the MEMS device I see that it requires the MSB bit to be at same clock as the Rising edge of the WS Pulse.
The MEMS MIC Datasheet
Fig 11 shows the timing expected for TDM.
Thanks
Mati

Hi Mati,

Sorry for the delayed response. Can you please attach final DTB (tegra210-p3448-0000-p3449-0000-a02.dtb) flashed on Nano?

Also Kindly provide list of mixer controls set before the usecase.

Thanks,
Sharad

hi Sharad, Mait and I worked on same project … please same the command
amixer -c tegrasndt210ref sset ‘I2S4 fsync width’ 0
amixer -c tegrasndt210ref cset name=‘I2S4 codec frame mode’ dsp-a
arecord -D hw:tegrasndt210ref,0 -c 4 -r 48000 -f S32_LE -d 10 cap.wav

also we are using jetson nano emmc production module so i think the dtb is tegra210-p3448-0002-p3449-0000-b00.dtb. [tegra210-p3448-0002-p3449-0000-b00.log|attachment]
(upload://xWywLXBTsAw9w0vQMGYeNPkD7HL.log) (209.8 KB)

btw your system does not allow me to upload .dtb i renmae to .log please change to tegra210-p3448-0002-p3449-0000-b00.dtb then convert to dts

Hi terry8uwg2,

I can’t download tegra210-p3448-0002-p3449-0000-b00.log. Could you please share again?

Thanks,
Sharad

tegra210-p3448-0002-p3449-0000-b00.log (209.8 KB)

can you check again

Hi All,

I mentioned in email previously that the ICS-52000 MEMS MIC shows in the data sheet requirement for Start UP period where the SCLK ONLY running for at least 10ms. It is mentioned that this period is needed too make ALL the Microphones synchronized. Only after 10ms period the WS signal is allowed to go active. Can Jetson Nano implement such requirement? Is it possible to have WS pin default to GPIO Output drive LOW and after 10ms of Stadt of Audio Record the WS pin will change from GPIO to WS? any other suggestion its welcome!!!

Hi Mati,

Could you please probe and check start timings for SCK and WS/LRCLK? As per the driver design, WS should be delayed already (compared to SCK). You can also experiment with dapm_pop_time. This can be used to delay the WS further.

$ echo 50 | sudo tee /sys/kernel/debug/asoc/tegra-snd-t210ref-mobile-rt565x/dapm_pop_time

I was able to download DTB file now. Checking it.

Thanks,
Sharad

I will double check but when I probed them they look like stating exactly the same time. But it is GOOD news you say that the driver should support it that means we have some setting to do to make this happen. I will check with Terry. Do you actually sample the MSB of the sample on the first rising edge of SCLK after the WS goes Low?

Mati

Hi Mati,

sample the MSB of the sample on the first rising edge of SCLK after the WS goes Low

Could you try dsp-b mode inplace of dsp-a?

amixer -c tegrasndt210ref sset ‘I2S4 fsync width’ 0
amixer -c tegrasndt210ref cset name=‘I2S4 codec frame mode’ dsp-b
arecord -D hw:tegrasndt210ref,0 -c 4 -r 48000 -f S32_LE -d 10 cap.wav

Kindly check if you are able to capture some data with DSP-A/DSP-B mode? Is it all noise or silence in all/few channels?

Thanks,
Sharad

we tried this. capture all noise still.

Hi Mati and terry8uwg2,

We don’t have the setup at our end to debug and hence we require some more info from your side:

  • Is captured data all noise in DSP-A mode as well, or is it silence? Could you please share captured WAV file (small duration) in DSP-A mode. [Please try 2 channel and 4 channel capture and share observations separately.]

  • Not sure, if you got a chance to probe signals and experiment with dap_pop_time. Kindly let us know your observations and share signal snapshots.

  • Please dump I2S registers during the capture and share here.

$cat /sys/kernel/debug/regmap/tegra210-i2s.3/registers > ~/i2s4__reg_dump

Thanks,
Sharad

Hi Sharad,

I used below command to capture

echo 50 | sudo tee /sys/kernel/debug/asoc/tegra-snd-t210ref-mobile-rt565x/dapm_pop_time
amixer -c tegrasndt210ref cset name=‘ADMAIF1 Mux’ I2S4
amixer -c tegrasndt210ref cset name=‘I2S4 codec frame mode’ dsp-a
amixer -c tegrasndt210ref cset name=‘I2S4 fsync width’ 0
arecord -D hw:tegrasndt210ref,0 -c 4 -r 48000 -f S32_LE -d 10 cap_dsp_a_2_ch.wav

The dap_pop_time take effect. but still record file is incorrect. i sent the attachment to Mathias. as i can not upload to this forum.

THanks

Hi all ,
I’m trying to run the same configuration with jetson nano and ICS-52000 on 40 pin header with I2S4. and it doesn’t seem to work.

configuration:
alsactl init tegrasndt210ref
amixer -c tegrasndt210ref sset ‘ADMAIF1 Mux’ I2S4
amixer -c tegrasndt210ref sset ‘ADMAIF1 Channels’ 0
amixer -c tegrasndt210ref sset ‘I2S4 Channels’ 0
amixer -c tegrasndt210ref sset ‘I2S4 codec frame mode’ dsp-a
amixer -c tegrasndt210ref sset ‘I2S4 fsync width’ 0

all channels are connected in daisy chain , when I look in oscilloscope the data is synchronized but all I get is one channel , and the rest are noise.
how did you solve the problem ?


thanks,
Yossi