I2S microphone - no sound

Hello,

I am trying to use I2S microphone (Adafruit I2S MEMS Mikrofon Breakout - SPH0645LM4H) with Jetson Nano.

I have connected the microphone using the following pinout:

Pin1 = 3V
Pin12 = BCLK
Pin35 = LRCL
Pin38 = DOUT
Pin39 = GND

After connecting the pins, I’ve set up the microphone using the command:
amixer -c tegrasndt210ref cset name=‘ADMAIF1 Mux’ I2S4

And then recorded a sample audio file using:
arecord -D hw:tegrasndt210ref,0 -r 48000 -f S16_LE -c 1 -d 10 test.wav

No errors are shown, a non-empty test file is created but with no sound. What could be the problem??

Many thanks!

Have you enable the I2S pins via the dtb file change? See my post about this.

Hi!

Thanks for your reply. I have followed your instructions and have managed to successfully change the dtb file.

Now, running

sudo grep dap4 /sys/kernel/debug/tegra_pinctrl_reg

outputs

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

Also running

sudo grep "Name:\|J:\|BB:" /sys/kernel/debug/tegra_gpio

outputs

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

However, the mic is still not working. I have tested the mic on raspberry pi, so I am sure the mic works.

Any ideas what could be the problem now? Is there any way to test if the mic is detected by Jetson?

Thanks!!

Bump.

@kira_canada were you ever able to figure out now to make this mic work with the jetson nano?

Yes, I have managed to get the mic to work!

It seems that the default Jetson configuration is erroneous, but I managed to fix accidentally by following these steps:

  1. Flash Jetson Nano using SDK Manager (JetPack version 4.2) [host machine]

For instructions on how to flash Nano using SDK Manager, please refer to p. 11 of the Jetson Nano User Guide.

  1. Fix I2S configuration using solution provided by @jas-mx above [host machine]

  2. Install Jetson.GPIO library [Jetson]

$ sudo apt update
$ sudo apt install python3-pip
$ pip3 --version
$ sudo pip3 install Jetson.GPIO

After installing Jetson.GPIO library, the I2S microphone starts to work!

I wonder if this solution is no longer needed with the recent release of JetPack 4.2.1.

Hope this helps!

Kira

comment removed

comment removed

Hi everyone,

I have been trying to use this setup and I am running into the same issue. Unfortunately, installing Jetson.GPIO doesn’t solve it for me.

I am changing the pin configuration to I2S using the jetson-io tool . After going through the fixes described in the devoloper guide this seems to work.

Setting up the connection between I2S and Memory Access Interface with:
$ amixer -c tegrasndt210ref cset name='ADMAIF1 Mux' I2S4
results in the following output:
numid=518,iface=MIXER,name='ADMAIF1 Mux' ; type=ENUMERATED,access=rw------,values=1,items=53 ; 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 'I2S1' ; Item #12 'I2S2' ; Item #13 'I2S3' ; Item #14 'I2S4' ; Item #15 'I2S5' ; Item #16 'SFC1' ; Item #17 'SFC2' ; Item #18 'SFC3' ; Item #19 'SFC4' ; Item #20 'MIXER1-1' ; Item #21 'MIXER1-2' ; Item #22 'MIXER1-3' ; Item #23 'MIXER1-4' ; Item #24 'MIXER1-5' ; Item #25 'AMX1' ; Item #26 'AMX2' ; Item #27 'AFC1' ; Item #28 'AFC2' ; Item #29 'AFC3' ; Item #30 'AFC4' ; Item #31 'AFC5' ; Item #32 'AFC6' ; Item #33 'OPE1' ; Item #34 'OPE2' ; Item #35 'SPKPROT1' ; Item #36 'MVC1' ; Item #37 'MVC2' ; Item #38 'IQC1-1' ; Item #39 'IQC1-2' ; Item #40 'IQC2-1' ; Item #41 'IQC2-2' ; Item #42 'DMIC1' ; Item #43 'DMIC2' ; Item #44 'DMIC3' ; Item #45 'ADX1-1' ; Item #46 'ADX1-2' ; Item #47 'ADX1-3' ; Item #48 'ADX1-4' ; Item #49 'ADX2-1' ; Item #50 'ADX2-2' ; Item #51 'ADX2-3' ; Item #52 'ADX2-4' : values=14

Recording a testfile:
arecord -D hw:tegrasndt210ref,0 -r 48000 -f S16_LE -c 1 -d 10 test.wav
outputs:
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
and produces a file like expected.

However, when I copy it to my computer and play it there is no sound.
Loading it with librosa shows that it only contains zeros.

I would really appreciate a hint what the problem could be!

Thanks
Lucas

Hi Lucas,

Please help to open a new topic for your issue. Thanks

I am running on Jetpack 4.4 now and managed to get the Adafruit I2S mic running with 8 bit, 16 bit and 32 bit mode. But take into consideration that the official support for the mic is S32_LE format and expect considerable loss in quality for anything less. Just stating all the steps once again to be clear:

  1. Connections:
    Pin1 = 3V
    Pin12 = BCLK
    Pin35 = LRCL
    Pin38 = DOUT
    Pin39 = GND

  2. sudo /opt/nvidia/jetson-io/jetson-io.py
    Under “Configure Jetson for compatible devices” select the Adafruit SPH0645LM4H, and then save/reboot.

  3. sudo grep dap4 /sys/kernel/debug/tegra_pinctrl_reg
    You should see something like this:
    Bank: 1 Reg: 0x70003144 Val: 0x00000044 -> dap4_fs_pj4
    Bank: 1 Reg: 0x70003148 Val: 0x00000054 -> dap4_din_pj5
    Bank: 1 Reg: 0x7000314c Val: 0x00000004 -> dap4_dout_pj6
    Bank: 1 Reg: 0x70003150 Val: 0x00000044 -> dap4_sclk_pj7

  4. Reset Mixer Controls
    alsactl init tegrasndt210ref

  5. Check mapping of I2S4 to ADMAIF1. Here you will see in the last line they are mapped to each other.
    amixer -c tegrasndt210ref sget “ADMAIF1 Mux”
    amixer -c tegrasndt210ref sget “I2S4 Mux”

  6. Add Volume Controls by tweaking the mapping and increasing the volume to boost it a bit.
    amixer -c tegrasndt210ref cset name="MVC1 Mux" I2S4
    amixer -c tegrasndt210ref cset name="ADMAIF1 Mux" MVC1
    amixer -c tegrasndt210ref cset name="MVC1 Vol" 13500

  7. From my observation this step is necessary to make the mic work with formats other than S32_LE as by default the I2S4 codec bit format control which has 3 options (None, 16, 32) is set to None. Once I changed this all applications trying to read from this device is able to request for any format it needs and it will actually record sound and not silence. (but quality might reduce if given lower sample format)
    amixer -c tegrasndt210ref cset name='I2S4 codec bit format' 32

  8. Make sure that the 'MVC1 Channels" is set to 0 so that it acts on all 8-channels.
    amixer -c tegrasndt210ref sget "MVC1 Channels"

  9. Record from the microphone
    arecord -D hw:tegrasndt210ref,0 -r 44100 -f S32_LE -c 1 -d 10 -vv test.wav

  10. If you setup pactl set-default-source correctly then you dont even need to mention the card and device arguments in the arecord command.

  11. In the end, to store this configuration for boot up use alsactl store. If it doesnt reboot with correct settings next time, write a startup script to run alsactl restore from stored config file. PulseAudio might undo the changes you made so take into consideration you might need to add some delay before restoring if that is the case.

2 Likes