JETSON-TX2 I2S controller with PCM5102a DAC module problem

Hi, I am using PCM5102a dac module to i2s@0 for JETSON-tx2 board. This module driver is not located in Linux-tegra kernel source. So I have downloaded the pcm5102a driver from latest kernel 4.17 revision. I have kept it in linux-tegra kernel-source/sound/soc/codexs/ and I modified Makefile and Kconfig file. Driver entry is created in Menuconfig. I have selected it and compiled successfully. Then i have checked in Rootfs inside /sys/snd/ all modules located over there. but my pcm5102a module is not there.
Is there any problem with module driver or Device tree problem.

Now My doubt is

  1. Is it necessary to add a module entry node inside the DTS file…?
  2. How to test it.

I am new for this module.

Can you please provide me some information

Hello!

The Linux kernel documentation [0] states the following about the ‘/sys/modules/’ location …

/sys/module/MODULENAME
	The name of the module that is in the kernel.  This
	module name will always show up if the module is loaded as a
	dynamic module.  If it is built directly into the kernel, it
	will only show up if it has a version or at least one
	parameter.

So if you have built the driver into the kernel, then you may not see it under ‘/sys/modules’ which is expected.

Looking at the PCM5102a, there is not control interface (ie. I2C or SPI interface) and hence no registers that need to be configured. Therefore, you should not need to modify the DTS files. You should be able to connect the codec to an I2S interface on the Jetson TX2 and use it. Yes I would recommend using the I2S0 interface on J21. Did you also connect the Tegra AUD_MCLK to the PCM5102a SCK pin?

To test it you should be able to …

amixer -c tegrasndt186ref cset name="I2S1 Mux" "ADMAIF1"
aplay -D hw:tegrasndt186ref,0 <wavfile>

Regards,
Jon

[0] https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-module

Yes Thanks Jonathanh, How can I test this module. Can you give me any test procedure because I am new to this i2s. Please provide me some docs.

This is my connection please tell me if anything wrong.
DAC module: PCM5102a(kit-PMC5102) Jetson tx2-Board(J21)
---------- --------------
Vcc ----------------------------------------------> 2 nd pin 5v.
GND ----------------------------------------------> 6th pin GND
BCK ----------------------------------------------> 7th pin MCLK
DIN ----------------------------------------------> 38th pin SIN
LCK ----------------------------------------------> 35th pin LRCK (Also tried with 12th Pin)

Please let me know how to ensure interfaced module detection?

Tried “ls /dev/snd/” and “ls /sys/module/”, but could not find interfaced module. I am not able to find “tegrasndt186ref”.

Thanks.

Hi Venkatesh,

So the PCM5102a should be connected to the I2S pins as follows …

PCM5102a TX2
SCK → Tegra AUD_MCLK (J21 pin 7)
BCK → Tegra I2S BCK (J21 pin 12)
DIN → Tegra I2S DOUT (J21 pin 40)
LCK → Tegra I2S FS (J21 pin 35)

To see what soundcards are present please check …

$ cat /proc/asound/cards 
 0 [tegrahda       ]: tegra-hda - tegra-hda
                      tegra-hda at 0x3518000 irq 403
 1 [tegrasndt186ref]: tegra-snd-t186r - tegra-snd-t186ref-mobile-rt565x
                      tegra-snd-t186ref-mobile-rt565x

The commands list is comment #2, describe how to test the I2S interface. If you execute these commands you should see the I2S being driven.

Regards
Jon

Hi Jon,

Thanks for the response.

Updated Tx2 board with Jetpack3.2.1 package and interfaced DAC module as mentioned above.

For command “cat /proc/asound/cards” I am not seeing interfaced board, I get same log without DAC connected.

nvidia@tegra-ubuntu:~$ cat /proc/asound/cards
0 [tegrahda ]: tegra-hda - tegra-hda
tegra-hda at 0x3518000 irq 400
1 [tegrasndt186ref]: tegra-snd-t186r - tegra-snd-t186ref-mobile-rt565x
tegra-snd-t186ref-mobile-rt565x

Tried to play a simple wave file by using below commands but no sound. Are we missing anything here?
amixer -c tegrasndt186ref cset name=“I2S0 Mux” “ADMAIF1” // tried with name=“I2S1 Mux”
aplay -D hw:tegrasndt186ref,0

Platform driver list indicates “tegra210”, I hope this is fine. As our interfaced DAC module is based on TI “pcm5102a” chipset, do we need to add/enable any drivers ?

nvidia@tegra-ubuntu:~$ ls /sys/bus/platform/drivers/tegra210-i2s
bind tegra210-i2s.1 tegra210-i2s.3 tegra210-i2s.5 unbind
tegra210-i2s.0 tegra210-i2s.2 tegra210-i2s.4 uevent
nvidia@tegra-ubuntu:~$

we have all i2s drivers and devices informations in the above path. But it is not playing .wav file.
we are using I2S0 for audio DAC module.

we have seen this pcm5102a driver in kernel version 4.17.3. Can we download it…? Is it necessary to add in our 4.4 kernel version…?

Yes this is expected. You will not see any indication that the DAC is connected. The kernel is unaware of the presence of the DAC and given that there is no control interface for the DAC (ie I2C or SPI interface) it has no means of knowing that it is present.

You should use ‘I2S1 Mux’ and you should find that the mixer control ‘I2S0 Mux’ does not exist.

Yes this is also expected. The Tegra186 and Tegra210 devices have a lot of common devices and so you may see some device have the tegra210 prefix. Again you will never see any indication that the DAC is present.

Looking at the driver, the only useful thing that it does is define what sample-rates and sample-sizes are supported. However, given that there are no internal settings to configure on the DAC, for testing this is not necessary to make it work and so I would not worry with this for now.

Do you have an oscilliscope and can you verify that the I2S signals and MCLK are being driven when you execute the aplay command?

What is the sample-rate and sample-size of the WAV file you are using? You may wish to start with something that is 16-bit @ 44.1kHz or 48kHz.

Regards,
Jon

We have played 16bit/48khz piano.wav file. We are getting signals from Din, MCLK pins in oscilloscope.

see the below log files.

nvidia@tegra-ubuntu:~$ amixer -c tegrasndt186ref cset name=“I2S1 Mux” “ADMAIF1”
numid=661,iface=MIXER,name=‘I2S1 Mux’
; type=ENUMERATED,access=rw------,values=1,items=83
; Item #0 ‘None’
; Item #1 ‘ADMAIF1’
; Item #2 ‘ADMAIF2’
; Item #3 ‘ADMAIF3’
; Item #4 ‘ADMAIF4’
; Item #5 ‘ADMAIF5’
; Item #6 ‘ADMAIF6’
; Item #7 ‘ADMAIF7’
; Item #8 ‘ADMAIF8’
; Item #9 ‘ADMAIF9’
; Item #10 ‘ADMAIF10’
; Item #11 ‘ADMAIF11’
; Item #12 ‘ADMAIF12’
; Item #13 ‘ADMAIF13’
; Item #14 ‘ADMAIF14’
; Item #15 ‘ADMAIF15’
; Item #16 ‘ADMAIF16’
; Item #17 ‘I2S1’
; Item #18 ‘I2S2’
; Item #19 ‘I2S3’
; Item #20 ‘I2S4’
; Item #21 ‘I2S5’
; Item #22 ‘I2S6’
; Item #23 ‘SFC1’
; Item #24 ‘SFC2’
; Item #25 ‘SFC3’
; Item #26 ‘SFC4’
; Item #27 ‘MIXER1-1’
; Item #28 ‘MIXER1-2’
; Item #29 ‘MIXER1-3’
; Item #30 ‘MIXER1-4’
; Item #31 ‘MIXER1-5’
; Item #32 ‘AMX1’
; Item #33 ‘AMX2’
; Item #34 ‘AMX3’
; Item #35 ‘AMX4’
; Item #36 ‘ARAD1’
; Item #37 ‘SPDIF1-1’
; Item #38 ‘SPDIF1-2’
; Item #39 ‘AFC1’
; Item #40 ‘AFC2’
; Item #41 ‘AFC3’
; Item #42 ‘AFC4’
; Item #43 ‘AFC5’
; Item #44 ‘AFC6’
; Item #45 ‘OPE1’
; Item #46 ‘SPKPROT1’
; Item #47 ‘MVC1’
; Item #48 ‘MVC2’
; Item #49 ‘IQC1-1’
; Item #50 ‘IQC1-2’
; Item #51 ‘IQC2-1’
; Item #52 ‘IQC2-2’
; Item #53 ‘DMIC1’
; Item #54 ‘DMIC2’
; Item #55 ‘DMIC3’
; Item #56 ‘DMIC4’
; Item #57 ‘ADX1-1’
; Item #58 ‘ADX1-2’
; Item #59 ‘ADX1-3’
; Item #60 ‘ADX1-4’
; Item #61 ‘ADX2-1’
; Item #62 ‘ADX2-2’
; Item #63 ‘ADX2-3’
; Item #64 ‘ADX2-4’
; Item #65 ‘ADX3-1’
; Item #66 ‘ADX3-2’
; Item #67 ‘ADX3-3’
; Item #68 ‘ADX3-4’
; Item #69 ‘ADX4-1’
; Item #70 ‘ADX4-2’
; Item #71 ‘ADX4-3’
; Item #72 ‘ADX4-4’
; Item #73 ‘ADMAIF17’
; Item #74 ‘ADMAIF18’
; Item #75 ‘ADMAIF19’
; Item #76 ‘ADMAIF20’
; Item #77 ‘ASRC1-1’
; Item #78 ‘ASRC1-2’
; Item #79 ‘ASRC1-3’
; Item #80 ‘ASRC1-4’
; Item #81 ‘ASRC1-5’
; Item #82 ‘ASRC1-6’
: values=1
nvidia@tegra-ubuntu:~$ aplay -D hw:tegrasndt186ref,0 piano2.wav
Playing WAVE ‘piano2.wav’ : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
nvidia@tegra-ubuntu:~$

When i played aplay command we are getting signals but we couldn’t get sound from speaker.
please give me any solution.

You should see that all the signals, MCLK, BCK, LRCK and DOUT are toggling. At 48kHz, the MCLK should be 12.288MHz (25648000), the BCK should be 1.536MHz (4800016*2), and the LRCK should be 48kHz. If this looks correct, then check that PCM5102a data sheet to ensure that these align with the PCM5102a specifications. If it all looks good and you still cannot hear anything please check with Texas Instruments through their support channels because this is not a DAC we test with.

Regards,
Jon

Thanks for the support, We have checked the signals, MCLK=12.288MHz BCK=1.536MHz, LRCK=48kHz, DOUT we are getting same clock frequency as you mentioned in above.

Still we are not getting proper sound from Module.

That’s great. So now you need to focus on the DAC side and for support on that please check with Texas Instruments support. If you have any questions with regard to clocking, frame format, etc, let us know.

Regards,
Jon

Thanks Jon, We are getting the sound from .wav file by connecting like this

PCM5102a TX2

Vcc ----------> Tegra Vcc 5V(J21 pin 2)
SCK ----------> Tegra AUD_MCLK (J21 pin 7)
BCK ----------> Tegra I2S BCK (J21 pin 12)
DIN ----------> Tegra I2S DOUT (J21 pin 40)
LCK ----------> Tegra I2S FS (J21 pin 35)
GND-----------> Tegra GND (J21 pin 6)
FLT (gnd)----> Tegra GND (J21-pin14) Filter select : Normal latency (Low) / Low latency (High)
DMP (gnd) Tegra GND (J21-pin20) ?De-emphasis control for 44.1kHz sampling rate(1): Off (Low) / On (High)

FMT (gnd)----> Tegra GND (J21-pin 39) Audio format selection : I2S (Low) / Left justified (High)
XMT (3.3v)–> Tegra 3.3V (J21-pin1).

3.3v---------> No need to connect it
Then by run this commands we were getting sound from speaker.

  1. amixer -c tegrasndt186ref cset name=“I2S1 Mux” “ADMAIF1”
  2. aplay -D hw:tegrasndt186ref,0

Thanks alot.