How to change clock rate of DMIC3?

Hello,
On tx2 board,the original frequency of DMIC3 is 3072000, i want to change it to 2048000(2MHz),

  1. modify assigned-clock-rates = <3072000> in tegra_dmic3 node in tegra186-soc-base.dtsi file as <2048000>;
  2. recompile and upgrade to board, then reboot;

but when I use record command to capture, the dmic3 clock is still 3MHz;
How to change clock rate of DMIC3?

Please check the corresponding node in /proc/device-tree first to see if your change really loaded.

I had copyed dtb files to /boot on board and reboot, but it didn’t affect,
Need I flash whole system?

Put it to Linux_for_Tegra/kernel/dtb and use sudo ./flash.sh -r -k kernel-dtb jetson-tx2 mmcblk0p1. It will only update the kernel dtb partition.

Re-flash the whole system will also work.

Hello!

What is the command you are using to capture the audio? The DMIC clock should be set according to the sample-rate, sample-size and channels you are capturing.

Regards,
Jon

I used the following commands to capture audio from dmic3 interface:
“”"
amixer -c tegrasndt186ref cset name=“MVC1 Mux” DMIC3
amixer -c tegrasndt186ref cset name=“ADMAIF1 Mux” MVC1
amixer -c tegrasndt186ref cset name=“DMIC3 Boost Gain” 50
amixer -c tegrasndt186ref cset name=“MVC1 Vol” 12602
arecord -D hw:tegrasndt186ref,0 -r 48000 -c 1 -f S16_LE sample.wav
“”"

I updated kernel-dtb partition, but no effect…
Are the file and node i modified correct?
file location:hardware/nvidia/soc/t18x/kernel-dts/tegra186-soc/tegra186-soc-base.dtsi
device-tree node:
1621244002777

Hello!

How are you measuring the DMIC clock frequency? Are you probing the DMIC clock with an oscilloscope?

Regards
Jon

Hello!

The DMIC clock rate is configured by the sample-rate multiplied by the OSR (over-sampling ratio). By default the OSR is set to 64 and so 48000 * 64 = 3072000. The supported OSR values are 64, 128 and 256. So to set the bit clock to 2048000 Hz, you will need to lower the sampling rate to 32kHz …

arecord -D hw:tegrasndt186ref,0 -r 32000 -c 1 -f S16_LE sample.wav

You can change the OSR via the mixer control …

amixer -c tegrasndt186ref cget name=“DMIC3 OSR Value"

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/asoc_driver.19.2.html#wwpID0E0CBB0HA

Regards,
Jon

yes, i am measuring by oscilloscope…


it still does not work after executed arecord and amixer command…

That is surprising I see …

$ arecord -D hw:tegrasndt186ref,1 -r 48000 -c 1 -f S16_LE -d 10 cap.wav &
$ sudo grep dmic3 /sys/kernel/debug/clk/clk_summary
             dmic3                                          1            1     3071999     3072000          0 0  

And then …

$ arecord -D hw:tegrasndt186ref,1 -r 32000 -c 1 -f S16_LE -d 10 cap.wav &
$ sudo grep dmic3 /sys/kernel/debug/clk/clk_summary
             dmic3                                          1            1     2047999     2048000          0 0  

Regards,
Jon

it works after re-flashed whole system…
might some kernel functions were modified in wrong way by myself before…
Thank you for your supports.

Hello!

Thanks for confirming!

Jon

Hello!

You can always execute …

$ alsactl init tegrasndt186ref

This should reset most controls to their default, but admittedly may not set everything.

Please note that there is a DMIC3 Sample Rate mixer control where you can override the sample-rate passed by arecord and so if you had happened to set this, this would have prevented the clock rate from changing.

Regards,
Jon

Ok i got it. I will try to execute the command you mentioned if my system was broken again…
Thank you for your reply.