Are there any working drivers for using i2s mems mic on jetson tx2 ?
Are there any working drivers for using i2s mems mic on jetson tx2 ?
Unfortunately, I am not aware of any I2S mems mics that we have tested. However, we do verify that I2S capture is working and so theoretically, if you have an I2S based mic and there is a Linux driver available for it, hopefully, it should be possible to make it work.
Do you have any particular mems mics in mind?
Thanks for the reply.
I’ve tried using Adafruits i2s mic (https://www.adafruit.com/product/3421) with no success.
They do not have any drivers for jetson. I’d like to know if this mic is going to work with any generic drivers which you’ve tested or happen to know.
I don’t see why this would not work. The mic does not require any configuration and so there is no driver required. You should be able to connect to the I2S interface on J21 and then …
amixer -c tegrasndt186ref sset "ADMAIF1 Mux" "I2S1" arecord -D hw:tegrasndt186ref,0 -r 48000 -f S32_LE -c 2 -d 10 cap.wav
Note that because the mic uses 32-bit per channel (requires 64 bit clocks per WS) you need to use S32_LE. It seems that only the 18 MSBs of the 32-bits are valid data. Furthermore, it appears that only 24-bits of the 32-bits for each channel are driven and so the 8 LSBs are floating and may introduce noise. It could be possible to enable the internal pull-down on the Tegra I2S DIN to avoid the 8 LSBs causing noise. However, it would be interesting if you can capture any data to begin with.
Thanks for the info.
It did work!
However, as you mentioned, I got noise at the beginning and ending of the record. Could you please help how to “enable the internal pull-down on the Tegra I2S DIN” to try eliminate the noise ?
Can you dump the following …
$ sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep dap1_din Bank: 0 Reg: 0x02431030 Val: 0x00000458 -> dap1_din_pj2
The above shows the contents of the ‘PADCTL_AUDIO_DAP1_DIN_0’ register. If you refer to the Tegra TX2 TRM you will see that bits 3-2 control the internal pull-up/down. Mine shows that there is a internal
pull-up enabled (which is probably ok).
The noise would be present on every sample and so if the noise you are hearing is just at the start and end, then that is probably a different problem. The Tegra I2S will start clocking in the data as soon as the bit-clock and fsync start, and so I am not sure if your mems device need the clock to be running for a certain period before it is ready to start sending actual data. So you may need to check the spec for the mems mic.
This is the dump data.
Bank: 0 Reg: 0x02431030 Val: 0x00000450 -> dap1_din_pj2
Bank: 0 Reg: 0x02431034 Val: 0x01616000 -> drive_dap1_din
I tried again and noticed noise even in between.
The above show there is no pull-up/down enabled for the din pin. For testing can you try …
$ sudo busybox devmem 0x02431030 32 0x454
It looks like there is no noise apart from start & stop after that step.
Thanks a lot.
To make the change permanent, you need to edit the following file …
… and update the value for the below (to the value in comment #8) and re-flash the board …
pinmux.0x02431030 = 0x00000450; # dap1_din_pj2: i2s1, tristate-enable, input-enable
I’ll do that.
Thanks a lot.
I should advise that typically we do not recommend editing the CFG file directly (although in this case it is a simple change), but to following 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. It is a bit of a convoluted process at the moment, but that is the officially supported path. Hopefully, if you did this the end result would be the same.
i use SPH0645 to connect my tx2.
i use TX2 R28.2
this is my connect pin with J21
when i use command to record the voice i can’t hear my record music.
nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$ amixer -c 1 sset 'I2S1 Mux' 'ADMAIF1' Simple mixer control 'I2S1 Mux',0 Capabilities: enum Items: 'None' 'ADMAIF1' 'ADMAIF2' 'ADMAIF3' 'ADMAIF4' 'ADMAIF5' 'ADMAIF6' 'ADMAIF7' 'ADMAIF8' 'ADMAIF9' 'ADMAIF10' 'ADMAIF11' 'ADMAIF12' 'ADMAIF13' 'ADMAIF14' 'ADMAIF15' 'ADMAIF16' 'I2S1' 'I2S2' 'I2S3' 'I2S4' 'I2S5' 'I2S6' 'SFC1' 'SFC2' 'SFC3' 'SFC4' 'MIXER1-1' 'MIXER1-2' 'MIXER1-3' 'MIXER1-4' 'MIXER1-5' 'AMX1' 'AMX2' 'AMX3' 'AMX4' 'ARAD1' 'SPDIF1-1' 'SPDIF1-2' 'AFC1' 'AFC2' 'AFC3' 'AFC4' 'AFC5' 'AFC6' 'OPE1' 'SPKPROT1' 'MVC1' 'MVC2' 'IQC1-1' 'IQC1-2' 'IQC2-1' 'IQC2-2' 'DMIC1' 'DMIC2' 'DMIC3' 'DMIC4' 'ADX1-1' 'ADX1-2' 'ADX1-3' 'ADX1-4' 'ADX2-1' 'ADX2-2' 'ADX2-3' 'ADX2-4' 'ADX3-1' 'ADX3-2' 'ADX3-3' 'ADX3-4' 'ADX4-1' 'ADX4-2' 'ADX4-3' 'ADX4-4' 'ADMAIF17' 'ADMAIF18' 'ADMAIF19' 'ADMAIF20' 'ASRC1-1' 'ASRC1-2' 'ASRC1-3' 'ASRC1-4' 'ASRC1-5' 'ASRC1-6' Item0: 'ADMAIF1' nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$ d 10 cap.wav-ubuntu:~$ arecord -D hw:tegrasndt186ref,0 -r 48000 -f S32_LE -c 2 -d Recording WAVE 'cap.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$ ls -la ./cap.wav -rw-r--r-- 1 nvidia nvidia 3840044 Aug 27 07:24 ./cap.wav nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$
i copy this cap.wav to windows and use vlc to play it, but i can’t hear the voice.
how did i debug this question??
Please dump the Tegra pinmux settings for the DAP1 interface by …
sudo grep dap1 /sys/kernel/debug/tegra_pinctrl_reg
Do you have an oscilloscope you can use to see if there is any data on the dout from the Mic?
very thanks for your reply.
here is my console log
nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$ sudo grep dap1 /sys/kernel/debug/tegra_pinctrl_reg Bank: 0 Reg: 0x02431028 Val: 0x00000440 -> dap1_fs_pj3 Bank: 0 Reg: 0x02431030 Val: 0x00000450 -> dap1_din_pj2 Bank: 0 Reg: 0x02431038 Val: 0x00000440 -> dap1_dout_pj1 Bank: 0 Reg: 0x02431040 Val: 0x00000440 -> dap1_sclk_pj0 Bank: 0 Reg: 0x0243102c Val: 0x01616000 -> drive_dap1_fs Bank: 0 Reg: 0x02431034 Val: 0x01616000 -> drive_dap1_din Bank: 0 Reg: 0x0243103c Val: 0x01616000 -> drive_dap1_dout Bank: 0 Reg: 0x02431044 Val: 0x01616000 -> drive_dap1_sclk nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$ head -n 1 /etc/nv_tegra_release # R28 (release), REVISION: 2.0, GCID: 10567845, BOARD: t186ref, EABI: aarch64, DATE: Fri Mar 2 04:57:01 UTC 2018 nvidia@tegra-ubuntu:~$ nvidia@tegra-ubuntu:~$
i use oscilloscope to detect SPH0645 DOUT pin and i found the strange phenomenon.
when i set the command arecord -D hw:1,0 -r 48000 -f S32_LE -c 2 -d 10 cap.wav
i see the wrong data from SPH0645 DOUT pin but i don’t play any music from my phone.
the same result after i do this command “sudo busybox devmem 0x02431030 32 0x454”
please see the video
should i connect the SPH0645 SEL pin ??
Your video does show data on the DOUT signal and so are you saying that there should not be any? If that is the case you may wish the check with the module vendor because they would be able to help with issues with the module.
I am not familiar with this module, but from a quick look at the adafruit website  it states …
“SEL - the channel select pin. By default this pin is low, so that it will transmit on the left channel mono. If you connect this to high logic voltage, the microphone will instantly start transmitting on the right channel.”
So no I do not think it is necessary to connect this pin and pull high.
According to the data sheet …
“The Data Format is I2S, 24 bit, 2’s compliment, MSB
first. The Data Precision is 18 bits, unused bits are zeros.”
So I don’t believe it can support 32-bit data, can you try …
arecord -D hw:1,0 -r 48000 -f S24_LE -c 2 -d 10 cap.wav
I have been trying to connect the Adafruit I2s Mem mic SPH0645LM4H (https://www.adafruit.com/product/3421) on the jeston TX2
I connected 3v -> Pin1
GND -> Pin 39
BCLK -> Pin 38
DOUT -> Pin 12
LRCL -> Pin 19
after which I typed the following on the terminal:
amixer -c tegrasndt186ref sset “ADMAIF1 Mux” “I2S1”
arecord -D hw:tegrasndt186ref,0 -r 48000 -f S32_LE -c 2 -d 10 cap.wav
but I could not hear any sound when I tried aplay cap.wav which is strange because I am normally able to hear other .wav files through the aplay command. Can someone help me figure out what I am doing wrong?
The pinout does not look quite correct for 40-pin header (J21) on Jetson TX2. You should connect up the mic as follows …
3V3 --> pin 1
BCLK --> pin 12
LRCK --> pin 35
DOUT --> pin 38
GND --> pin 39
Thank you for your response. It was a typo on my end, but I connected the pinouts just as you suggested but it is not working. I tried connecting an I2s amp to output sound and it works but the microphone is not working with the I2s connection for some reason
Can you dump the following registers?
$ sudo grep dap1 /sys/kernel/debug/tegra_pinctrl_reg