The problem: We want to use the microphone connected to the i2s interface to record the sound. We got a “static noise” that doesn’t change. Check the .wav file attached.
What we tried to do:
The microphone is connected, via a MIPI (CSI) cable, to the following pins:
Jetson nano signal name <-> Customer Usage <-> Pin Direction
I2S0_DIN <-> I2S4B_SDATA_IN <-> Input
I2S0_FS <-> I2S4B_LRCK <-> Output
I2S0_SCLK <-> I2S4B_SCLK <-> Output
These values were updated in the jetson nano pinmux template by the people who made the custom carrier board and all the connections. I’ve followed the tutorial from the official site [1] (Updating the Bootloader Pinmux), generated the gpio and pinmux .dtsi files, copied them to the porg-platforms, and then generated the dtb file. Then, I copied the dtb file to the kernel/dtb and reflashed the jetson module.
– I’ve executed the following command to see pinctrl:
→ sudo grep dap4 /sys/kernel/debug/tegra_pinctrl_reg
and got the result:
Bank: 1 Reg: 0x70003144 Val: 0x00000000 → dap4_fs_pj4
Bank: 1 Reg: 0x70003148 Val: 0x00000044 → dap4_din_pj5
Bank: 1 Reg: 0x7000314c Val: 0x00000015 → dap4_dout_pj6
Bank: 1 Reg: 0x70003150 Val: 0x00000000 → dap4_sclk_pj7
This means that the dtb was flashed with the new changes. (With the default pinmux there were other Val)
I’ve tried to record from the microphone using this command and settings from this post [2]:
→ arecord -D hw:tegrasndt210ref,0 -r 44100 -f S32_LE -c 1 -d 10 -v test.wav
The output was:
Recording WAVE ‘test.wav’ : Signed 32 bit Little Endian, Rate 44100 Hz, Mono
Hardware PCM card 1 ‘tegra-snd-t210ref-mobile-rt565x’ device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S32_LE
subformat : STD
channels : 1
rate : 44100
exact rate : 44100 (44100/1)
msbits : 32
buffer_size : 8192
period_size : 2048
period_time : 46439
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 2048
period_event : 0
start_threshold : 1
stop_threshold : 8192
silence_threshold: 0
silence_size : 0
boundary : 4611686018427387904
appl_ptr : 0
hw_ptr : 0
Using a production module with eMMC, I could not enable the i2s interface using jetson-IO. From this post [3] and this [4], it seems that it is necessary only to update the pinmux (for production module, if r32.3+) and the i2s will be enabled.
I’ve tried other settings for amixer (changing the number of channels, sample rate, fsync) and also I’ve tried to force the pins to the I2S, like in this post [5]. Or changed codec frame mode as in this post [6].
The solution, for the developer kit, seems to be enabling i2s4 vi jetson-io, and for the production module should have been changing the pinmux config.
Can someone give me a hint or some other ideas?
If you need other details let me know. Thanks in advance.
Thanks for taking effort in posting the issue along with necessary inputs.
Pinmux register values seem to be wrong. They should be as mentioned in Audio I2S on 40 Pin Connector - #54 by jonathanh. I would suggest to redo the pinmux changes as guided in link. Yes, Jetson-IO tool works for dev kit only.
No need to modify any amixer settings or other register rewrites. The default ones should work fine once the pinmux is set as desired.
Could you probe the Jetson SCLK, FS and DATA lines while running the record and quote the behaviour.
SCLK should be operating at Fs*sample_width*channel_count while FS should be running at a frequency equal to sample rate. Also is the i2s mic independently verified with any other board to rule out that its not an issue with mic?
Also, ensure below mixer settings are set and share the mixer setting dump f no issue with clocks (amixer -c tegrasndt210ref contents > ~/settings_dump)
Unfortunately, I do not have the necessary tools for probing.
I don’t know if the mic was verified with any other board, but I think I’ll try that. Also, maybe I’ll try with the original carrier board and developer module.
I know that the mic is activated if the frequency is > 1kHz, else the mic is in sleep mode. I’ll check those frequencies.
And the output of this command, before the recording and when I was recording.
sudo grep “clock|extern1|i2s4|pll_a_out” /sys/kernel/debug/clk/clk_summary
and chk clk_summary during the playback. This shall ensure that pinmux is taking effect (Ensure to set pinmux of I2S4 DOUT pin as well i.e all 4 pins of I2S4)
The result is the same as before, after running the commands, i2s4 is not up in clk summary during playback.
The I2s4 DOUT pin is not connected to anything on the board. But, I set the pin as output, reflash, but no change. I don’t think that DOUT is the problem.
I found though that there is something on I2S3 when recording.
Looks like the i2s numbering in clk summary starts from 0. so i2s3 is the right entry to be looked at and its running at 2822400 which implies that you might have played 44100*2*32 (Fs * chan * sample width) wav file. so I2S bit clock form Jetson I2S is fine. Since FS is derived from this line, I suppose it will also be fine
If you had oscilloscope, could have probed data Line to see if data input from mic is noisy even when clocks are fine. So, you may need to check if there is no issue with mic with some other board when supplied with same power voltage and clocks
After I checked the frequency of the mic from the documentation and saw that there was no problem with that, I connected the mic module to the pins of the devkit module. I enabled the i2s by using jetson-io.py and set the mixer controls as in this comment [1]. Then, I run the command for recording, and I got the same error (same buzzing sound). After that, I bought another i2s mic, connected it to the devkit pins, and tried again the command for recording. This time everything was ok, I succeded to record using the new mic.
When I saw that the new mic is working on the devkit module with the original carrier board, I’ve just connected the mic to my custom carrier board with the production module. The settings that are in the description of this post were ok. The pinmux changes that I’ve made were good. The i2s was enabled and I didn’t have to do anything else. Just modify the pinmux and flash the dtb/image to the jetson.
I’ve also made the mixer control setting from this comment (steps 4-8) [1]. Now I’ve got a clear sound from the mic using this command:
arecord -D hw:tegrasndt210ref,0 -r 44100 -f S32_LE -c 1 -d 10 -vv test.wav
The problem was the mic module. After I replaced it, everything was fine.