当前位置:   article > 正文

audio调试:数字麦(DMIC)如何配置

dmic

        本文介绍rk3588平台DMIC的配置;首先了解下,常见的数字麦有纯pdm麦和通过一些codec芯片将数字麦转换为i2s信号输入到SOC;纯pdm麦就是直接进入SOC的pdm接口,走的是PDM信号,原理图如下所示;PDM信号就是两个线,一根数据线一根时钟线。

        阵列麦是PDM麦常见的形式,如下原理图;纯pdm麦的dts配置需要使用dummy_codec,内核要打开CONFIG_SND_SOC_DUMMY_CODEC=y;dts配置可以参考如下

  1. sound_micarray: sound-micarray {
  2. compatible = "simple-audio-card";
  3. simple-audio-card,format = "i2s";
  4. simple-audio-card,name = "rockchip,sound-micarray";
  5. simple-audio-card,mclk-fs = <256>;
  6. simple-audio-card,dai-link@0 {
  7. format = "pdm";
  8. cpu {
  9. sound-dai = <&pdm0>;
  10. };
  11. codec {
  12. sound-dai = <&dummy_codec>;
  13. };
  14. };
  15. };
  16. pdm有全映射设置,rockchip,path-map = <int int int int>,需要和硬件上接的一致。

        使用codec芯片rt5651,es7210等,接入到SOC,即数字MIC,接的引脚是codec芯片上的引脚,不是SOC的PDM;最后转换成i2s信号输入主控。以3588平台为例,数字麦的dts参考如下:

  1. rt5651_sound: rt5651-sound {
  2. status = "okay";
  3. compatible = "rockchip,multicodecs-card";
  4. rockchip,card-name = "rockchip-rt5651";
  5. hp-det-gpio = <&gpio1 RK_PC0 GPIO_ACTIVE_HIGH>;
  6. io-channels = <&saradc 3>;
  7. io-channel-names = "adc-detect";
  8. keyup-threshold-microvolt = <1800000>;
  9. poll-interval = <100>;
  10. rockchip,format = "i2s"; //通过i2s进入到SOC
  11. rockchip,mclk-fs = <256>;
  12. rockchip,cpu = <&i2s0_8ch>;
  13. rockchip,codec = <&rt5651>;
  14. pinctrl-names = "default";
  15. pinctrl-0 = <&hp_det>;
  16. play-pause-key {
  17. label = "playpause";
  18. linux,code = <KEY_PLAYPAUSE>;
  19. press-threshold-microvolt = <2000>;
  20. };
  21. };
  22. rt5651: rt5651@1a {
  23. status = "okay";
  24. #sound-dai-cells = <0>;
  25. compatible = "realtek,rt5651";
  26. reg = <0x1a>;
  27. clocks = <&cru I2S0_8CH_MCLKOUT>;
  28. clock-names = "mclk";
  29. assigned-clocks = <&cru I2S0_8CH_MCLKOUT>;
  30. assigned-clock-rates = <11289600>; //mclk
  31. realtek,dmic-en = "ture"; //数字麦的使能
  32. };

        声卡生成之后,就使用tinycap指定es7210或rt5651声卡进行录音,录音时用示波器测量看看7202的pdm_clkpdm_sdi是否有波形产生。

        如何兼容2个数字麦,即主板自带的一个数字麦+外接小板的数字麦;两个数字麦的clk是不一样的,所以dts怎么配置呢? 在&pdm0节点把两个clk同时配置上就可以了。

  1. pdm0: pdm@fe4b0000 {
  2. compatible = "rockchip,rk3588-pdm";
  3. reg = <0x0 0xfe4b0000 0x0 0x1000>;
  4. clocks = <&cru MCLK_PDM0>, <&cru HCLK_PDM0>;
  5. clock-names = "pdm_clk", "pdm_hclk";
  6. dmas = <&dmac0 4>;
  7. dma-names = "rx";
  8. pinctrl-names = "default";
  9. pinctrl-0 = <&pdm0m0_clk //板载数字麦时钟
  10. &pdm0m0_clk1 //外接数字麦时钟
  11. &pdm0m0_sdi0
  12. &pdm0m0_sdi1
  13. &pdm0m0_sdi2>;
  14. #sound-dai-cells = <0>;
  15. status = "disabled";
  16. };

        多个数字麦怎么录音呢?同一组pdm,录音时去设置通道就行了,直接tinycap +通道2/4/6/8。例如下面这个,硬件上看PDM_SDI0_M0接在809,PDM_SDI1_M0接在es7202,PDM_SDI2_M0接在es7202;所以总共可以录6路,使用tinycap直接录6通道就可以了,其中:

        PDM_SDI0_M0管脚是0-1通道,

        PDM_SDI1_M0管脚是2-3通道,

        PDM_SDI2_M0管脚是4-5通道。

        PDM_SDI0_M0是接在RK809上的,所以0-1通道就是它的数据。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/82888
推荐阅读
相关标签
  

闽ICP备14008679号