No sound from 40 pin I2S

This is a repost from [0] but I thought I would create a new topic since the last topic has already been marked as solved.

I finally managed to get some hardware to test the I2S interface but unfortunately I can’t hear anything. I was hoping that you may be able to offer some advice about where I may have gone wrong.

I am using a Hifiberry Amp2 [1] with two speakers (left and right).

I have upgraded to using Jetpack 4.2.3 running L4T 32.2.3.

$ cat /etc/nv_tegra_release
# R32 (release), REVISION: 2.3, GCID: 17644089, BOARD: t210ref, EABI: aarch64, DATE: Tue Nov  5 21:56:03 UTC 2019

From what I can tell I have the I2S interface working correctly on the 40 pin connector.

$ sudo grep "Name:\|J:\|BB:" /sys/kernel/debug/tegra_gpio
Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL
 J: 2:1 00 00 00 00 00 00 000000
BB: 6:3 00 00 00 00 00 00 000000

Checking the GPIO configuration based on the post here [2]. The value for Reg: 0x7000314c is different to the linked post however I think that it still indicates that I2S is configured.

$ sudo grep dap4 /sys/kernel/debug/tegra_pinctrl_reg
Bank: 1 Reg: 0x70003144 Val: 0x00000044 -> dap4_fs_pj4
Bank: 1 Reg: 0x70003148 Val: 0x00000044 -> dap4_din_pj5
Bank: 1 Reg: 0x7000314c Val: 0x00000004 -> dap4_dout_pj6
Bank: 1 Reg: 0x70003150 Val: 0x00000044 -> dap4_sclk_pj7

Resetting the mixer controls.

$ alsactl init tegrasndt210ref
Reset Tegra APE sound-card controls

Verify that I2S4 is mapped to the ADMAIF1

$ amixer -c tegrasndt210ref sget "ADMAIF1 Mux"
Simple mixer control 'ADMAIF1 Mux',0
  Capabilities: enum
  Items: 'None' 'ADMAIF1' 'ADMAIF2' 'ADMAIF3' 'ADMAIF4' 'ADMAIF5' 'ADMAIF6' 'ADMAIF7' 'ADMAIF8' 'ADMAIF9' 'ADMAIF10' 'I2S1' 'I2S2' 'I2S3' 'I2S4' 'I2S5' 'SFC1' 'SFC2' 'SFC3' 'SFC4' 'MIXER1-1' 'MIXER1-2' 'MIXER1-3' 'MIXER1-4' 'MIXER1-5' 'AMX1' 'AMX2' 'AFC1' 'AFC2' 'AFC3' 'AFC4' 'AFC5' 'AFC6' 'OPE1' 'OPE2' 'SPKPROT1' 'MVC1' 'MVC2' 'IQC1-1' 'IQC1-2' 'IQC2-1' 'IQC2-2' 'DMIC1' 'DMIC2' 'DMIC3' 'ADX1-1' 'ADX1-2' 'ADX1-3' 'ADX1-4' 'ADX2-1' 'ADX2-2' 'ADX2-3' 'ADX2-4'
  Item0: 'I2S4'

$ amixer -c tegrasndt210ref sget "I2S4 Mux"
Simple mixer control 'I2S4 Mux',0
  Capabilities: enum
  Items: 'None' 'ADMAIF1' 'ADMAIF2' 'ADMAIF3' 'ADMAIF4' 'ADMAIF5' 'ADMAIF6' 'ADMAIF7' 'ADMAIF8' 'ADMAIF9' 'ADMAIF10' 'I2S1' 'I2S2' 'I2S3' 'I2S4' 'I2S5' 'SFC1' 'SFC2' 'SFC3' 'SFC4' 'MIXER1-1' 'MIXER1-2' 'MIXER1-3' 'MIXER1-4' 'MIXER1-5' 'AMX1' 'AMX2' 'AFC1' 'AFC2' 'AFC3' 'AFC4' 'AFC5' 'AFC6' 'OPE1' 'OPE2' 'SPKPROT1' 'MVC1' 'MVC2' 'IQC1-1' 'IQC1-2' 'IQC2-1' 'IQC2-2' 'DMIC1' 'DMIC2' 'DMIC3' 'ADX1-1' 'ADX1-2' 'ADX1-3' 'ADX1-4' 'ADX2-1' 'ADX2-2' 'ADX2-3' 'ADX2-4'
  Item0: 'ADMAIF1'

I get no errors when I try to play sample WAV file however I cannot hear anything. You can get a copy of the file here [3].

$ aplay -D hw:tegrasndt210ref,0 CantinaBand3.wav
Playing WAVE 'CantinaBand3.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono

I can run the speaker test command and it does not give any errors - but I also cannot hear anything.

speaker-test -c2 -twav -D plughw:CARD=tegrasndt210ref,DEV=0

speaker-test 1.1.3

Playback device is plughw:CARD=tegrasndt210ref,DEV=0
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 8192
Period size range from 32 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 2048
was set buffer_size = 8192
 0 - Front Left
 1 - Front Right
Time per period = 2.860768
 0 - Front Left
 1 - Front Right
Time per period = 3.027660
 0 - Front Left
 1 - Front Right

Do you have any idea why the sound isn’t working?

Regards,
Ben

[0] https://devtalk.nvidia.com/default/topic/1066239/jetson-nano/request-simple-procedure-for-enabling-i2s-support-on-jetson-nano/post/5406516/#5406516
[1] https://www.hifiberry.com/shop/boards/hifiberry-amp2/
[2] https://devtalk.nvidia.com/default/topic/1049674/jetson-nano/audio-i2s-on-40-pin-connector/post/5390631/#5390631
[3] https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand3.wav

Hi benky58un

Please refer to Audio Troubleshooting section if can help:
https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fasoc_driver.html%23wwpID0E0SH0HA