I2s mic with tx2

Does anyone have a problem with low volume on these mics? Is there a way to boost the volume?

Hello!

I cannot say that I have. Are you using arecord to capture audio?

Otherwise, you could try using pulseaudio to boost the volume using pactl …

https://wiki.archlinux.org/index.php/PulseAudio#Keyboard_volume_control

Regards,
Jon

I was able to boost the volume in ALSA using a “softvol” device in the .asoundrc file. (Found details here: ALSA asoundrc capture config help? - Raspberry Pi Forums). I can confirm this works by using

arecord -D dmic_sv -r 48000 -f S32_LE -c 2 -d 10 cap-dmic_sv.wav

What is the best way to get this new “softvol” device to be the default input device used by Pulse? Applications like Chromium and the ubuntu settings screen still seem to be pointing to the old hw:tegrasndt186ref,0 input instead of my new softvol device. I tried adding this to the .asoundrc but it didn’t work.

pcm.!default {
	type plug
	slave.pcm dmic_sv
}

Am I correct to assume that Pulse is pointing to some default ALSA input device when it starts up? The pulse config file /etc/pulse/default.pa does not specifically load a module-alsa-source. Where is this configured? I tried adding one manually in default.pa, and it shows up in my applications, but has no audio.

Hello!

Thanks for the update/feedback. Yes you need to configure the default playback/sink for pulseaudio. See the following wiki for more information …

https://wiki.archlinux.org/index.php/PulseAudio/Examples#Set_the_default_output_source

However, to work with pulse you probably also need to configure the pulse plugin in asoundrc. See …

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/PerfectSetup/

Regards,
Jon

Thanks for the links. To clarify though, I’m trying to capture data from the microphone, not output through a speaker.

It’s not clear from these links how to get the new “dmic_sv” ALSA device to show up as a pulse source. I know I can set the default PulseAudio source once it’s in the list of sources, but it’s not there yet.

Hello!

Yes of course, you are capturing. I think that you need to configure the pulse plugin in the asoundrc to use the softvol.

Regards,
Jon

I have been trying to connect the Adafruit I2s Mem mic SPH0645LM4H (Adafruit I2S MEMS Microphone Breakout - SPH0645LM4H : ID 3421 : $6.95 : Adafruit Industries, Unique & fun DIY electronics and kits) on the jeston NANO

I connected
3V3 → pin 1
BCLK → pin 12
LRCK → pin 35
DOUT → pin 38
GND → pin 39

after which I typed the following on the terminal:
amixer -c tegrasndt210ref sset “ADMAIF1 Mux”
=> “I2S1”

arecord -D hw:tegrasndt210ref,0 -r 48000 -f S32_LE -c 2 -d 10 cap.wav
=> arecord: pcm_read:2103: read error: Input/output error

Can someone help me figure out what I am doing wrong?

PS:
sudo grep dap1 /sys/kernel/debug/tegra_pinctrl_reg
=> Bank: 1 Reg: 0x70003124 Val: 0x00006054 → dap1_fs_pb0
Bank: 1 Reg: 0x70003128 Val: 0x00006054 → dap1_din_pb1
Bank: 1 Reg: 0x7000312c Val: 0x00006054 → dap1_dout_pb2
Bank: 1 Reg: 0x70003130 Val: 0x00006054 → dap1_sclk_pb3

Hello!

Can you dump the following …

cat /proc/device-tree/nvidia,dtsfilename

If your DTS file has the suffix -a01.dts then it uses I2S1 but if you have -a02.dts or -b00.dts, it uses I2S4 and not I2S1.

Please note that you should not need to …

amixer -c tegrasndt210ref sset "ADMAIF1 Mux"

The ADMAIF1 Mux should be configured by default depending on the board version. Please try …

$ alsactl init tegrasndt210ref
$ arecord -D hw:tegrasndt210ref,0 -r 48000 -f S32_LE -c 2 -d 10 cap.wav

Regards,
Jon

Thanks for the commands~

But i try

$ alsactl init tegrasndt210ref
$ arecord -D hw:tegrasndt210ref,0 -r 48000 -f S32_LE -c 2 -d 10 cap.wav

Than i copy this cap.wav to windows and use vlc to play it,
but i can’t hear the voice.

how can i fix it?

Hello!

Can you dump the following …

cat /proc/device-tree/nvidia,dtsfilename

I am not clear what board version you have.

Can you also dump the following as well …

sudo grep "dap1\|dap4" /sys/kernel/debug/tegra_pinctrl_reg

From what I can see from the above for DAP1, the tristate bit is still set for I2S1, meaning that the I2S will not drive the bit-clock and frame sync. However, I am not clear if the board you have uses I2S1 or I2S4.

Please provide the above information.

Regards
Jon

Sorry my bad…

cat /proc/device-tree/nvidia,dtsfilename

|
V
/dvs/git/dirty/git-master_linux/kernel/kernel-4.9/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts

sudo grep "dap1\|dap4" /sys/kernel/debug/tegra_pinctrl_reg

|
V
Bank: 1 Reg: 0x70003124 Val: 0x00006054 → dap1_fs_pb0
Bank: 1 Reg: 0x70003128 Val: 0x00006054 → dap1_din_pb1
Bank: 1 Reg: 0x7000312c Val: 0x00006054 → dap1_dout_pb2
Bank: 1 Reg: 0x70003130 Val: 0x00006054 → dap1_sclk_pb3
Bank: 1 Reg: 0x70003144 Val: 0x00000044 → dap4_fs_pj4
Bank: 1 Reg: 0x70003148 Val: 0x00000044 → dap4_din_pj5
Bank: 1 Reg: 0x7000314c Val: 0x00000044 → dap4_dout_pj6
Bank: 1 Reg: 0x70003150 Val: 0x00000044 → dap4_sclk_pj7

Hello,

Great, you have a B0x board and so it is using I2S4. The pin configuration looks good. Do you see a bit clock and frame-sync on pins 12 and 35 respectively? Assuming you have an o-scope to probe the pins?

If not, you can also try …

$ echo 0 | sudo tee /sys/kernel/debug/tracing/trace
$ echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
$ echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
$ echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable
$ arecord -D hw:tegrasndt210ref,0 -r 48000 -f S32_LE -c 2 -d 10 cap.wav
$ cat /sys/kernel/debug/tracing/trace

And send the output.

Regards,
Jon

oops…I didn’t have the o-scope. QAQ

$ cat /sys/kernel/debug/tracing/trace

tracer: nop

entries-in-buffer/entries-written: 30/30 #P:4

_-----=> irqs-off

/ _----=> need-resched

| / _—=> hardirq/softirq

|| / _–=> preempt-depth

||| / delay

TASK-PID CPU# |||| TIMESTAMP FUNCTION

| | | |||| | |

     arecord-15684 [002] .... 20526.839812: snd_soc_dapm_widget_power: widget=Capture 1 val=1
     arecord-15684 [002] .... 20526.839816: snd_soc_dapm_widget_power: widget=ADMAIF1 Transmit val=1
     arecord-15684 [002] .... 20526.839818: snd_soc_dapm_widget_power: widget=ADMAIF1 TX val=1
     arecord-15684 [002] .... 20526.839819: snd_soc_dapm_widget_power: widget=ADMAIF1 Mux val=1
     arecord-15684 [002] .... 20526.839828: snd_soc_dapm_widget_power: widget=I2S4 RX val=1
     arecord-15684 [002] .... 20526.839830: snd_soc_dapm_widget_power: widget=I2S4 Receive val=1
     arecord-15684 [002] .... 20526.839831: snd_soc_dapm_widget_power: widget=I2S4 CIF Transmit-I2S4 Receive val=1
     arecord-15684 [002] .... 20526.839831: snd_soc_dapm_widget_power: widget=I2S4 CIF Transmit val=1
     arecord-15684 [002] .... 20526.839832: snd_soc_dapm_widget_power: widget=I2S4 CIF TX val=1
     arecord-15684 [002] .... 20526.839833: snd_soc_dapm_widget_power: widget=I2S4 DAP RX val=1
     arecord-15684 [002] .... 20526.839834: snd_soc_dapm_widget_power: widget=I2S4 DAP Receive val=1
     arecord-15684 [002] .... 20526.839835: snd_soc_dapm_widget_power: widget=x Capture-I2S4 DAP Receive val=1
     arecord-15684 [002] .... 20526.839836: snd_soc_dapm_widget_power: widget=x Capture val=1
     arecord-15684 [002] .... 20526.839837: snd_soc_dapm_widget_power: widget=x IN val=1
     arecord-15684 [002] .... 20526.839838: snd_soc_dapm_widget_power: widget=x Mic val=1
     arecord-15684 [000] .... 20536.849747: snd_soc_dapm_widget_power: widget=Capture 1 val=0
     arecord-15684 [000] .... 20536.849769: snd_soc_dapm_widget_power: widget=ADMAIF1 Transmit val=0
     arecord-15684 [000] .... 20536.849777: snd_soc_dapm_widget_power: widget=ADMAIF1 TX val=0
     arecord-15684 [000] .... 20536.849782: snd_soc_dapm_widget_power: widget=ADMAIF1 Mux val=0
     arecord-15684 [000] .... 20536.849833: snd_soc_dapm_widget_power: widget=I2S4 RX val=0
     arecord-15684 [000] .... 20536.849843: snd_soc_dapm_widget_power: widget=I2S4 Receive val=0
     arecord-15684 [000] .... 20536.849849: snd_soc_dapm_widget_power: widget=I2S4 CIF Transmit-I2S4 Receive val=0
     arecord-15684 [000] .... 20536.849855: snd_soc_dapm_widget_power: widget=I2S4 CIF Transmit val=0
     arecord-15684 [000] .... 20536.849861: snd_soc_dapm_widget_power: widget=I2S4 CIF TX val=0
     arecord-15684 [000] .... 20536.849866: snd_soc_dapm_widget_power: widget=I2S4 DAP RX val=0
     arecord-15684 [000] .... 20536.849872: snd_soc_dapm_widget_power: widget=I2S4 DAP Receive val=0
     arecord-15684 [000] .... 20536.849878: snd_soc_dapm_widget_power: widget=x Capture-I2S4 DAP Receive val=0
     arecord-15684 [000] .... 20536.849884: snd_soc_dapm_widget_power: widget=x Capture val=0
     arecord-15684 [000] .... 20536.849891: snd_soc_dapm_widget_power: widget=x IN val=0
     arecord-15684 [000] .... 20536.849896: snd_soc_dapm_widget_power: widget=x Mic val=0

Hello!

The above trace looks good and I can see that I2S4 is being started and runs for 10 seconds before stopping. So it should be capturing any data on the I2S data output from the Mic. Do you happen to have an extra Mic? At this point it is difficult to know if the Mic is sending any data or not.

Regards,
Jon

Hello!

I just wanted to let you know that with the release of JetPack 4.3 (L4T 32.3.1) we now have a tool for configuring the 40-pin header on Jetson and we have included a configuration for the Adafruit SPH0645LM4H I2S Mic. Please see …

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fhw_setup_jetson_io.html%23

Regards,
Jon

This is fantastic @jonathanh! Using that guide, how would you connect up multiple sets of MEMS microphones? Say 4 or 8?

Hello!

With regard to the Adafruit SPH0645LM4H, I believe that you can only connect upto 2 of these mics per I2S interface. This is because each mic has a ‘SEL’ pin that indicates if the mic output on the low or high half of the I2S frame. See the datasheet for more details [0]. So to support 4 of these mics with TX2 you would need to use multiple I2S interfaces. Note there are a total of 6 I2S interfaces available on the TX2 module and on the TX2 devkit 4 of the 6 are accessible.

Alternatively the I2S interface on Jetson can support upto 16 channels in TDM mode. So it could be possible to interface a microphone array to Jetson. For example, something like the Seeed ReSpeaker 4-Mic Array [1].

Regards,
Jon

[0] https://cdn-shop.adafruit.com/product-files/3421/i2S+Datasheet.PDF
[1] ReSpeaker 4-Mic Array for Raspberry Pi | Seeed Studio Wiki