如何在 Beaglebone AI 中录制 I2S 音频麦克风

How to record I2S audio microphone in Beaglebone AI

我正在尝试从圆形麦克风板 TIDA-01454 在 Beaglebone AI 中录音。我已经用 I2S DAC 检查了 CMB 的输出是否正确(我可以听到麦克风的声音)。但是,我无法在 Beaglebone AI 中录制,这是我尝试录制时发生的情况:

arecord --device="hw:1,0" -c2 -f S32_LE test.wav

Recording WAVE 'test.wav' : Signed 32 bit Little Endian, Rate 8000 Hz, Stereo

arecord: pcm_read:2145: read error: Input/output error

我认为问题一定出在我的 DTS 文件或 ALSA 配置中。但我真的不知道,所以如果需要更多信息,请询问。

DTS(未完成):

pcm5102a: pcm5102a {
   #sound-dai-cells = <0>;
   compatible = "ti,pcm5102a";
   status = "okay";
};


sound {compatible = "simple-audio-card";
        simple-audio-card,format = "i2s";
        simple-audio-card,name = "PCM5102a";
        simple-audio-card,bitclock-master = <&sound1_master>;
        simple-audio-card,frame-master = <&sound1_master>;
        simple-audio-card,bitclock-inversion;
        
        
        simple-audio-card,cpu {
                sound-dai = <&mcasp1>;
        };
        sound1_master: simple-audio-card,codec {
            #sound-dai-cells = <0>;
            sound-dai = <&pcm5102a>;
            
        };
      };
};
&mcasp1 {
    #sound-dai-cells = <0>;
    status = "okay";
    pinctrl-names = "default";  
    pinctrl-0 = <&mcasp1_pins>;  
    op-mode = <0>;    /* MCASP_IIS_MODE */
    tdm-slots = <2>;
    num-serializer = <4>;
    /* 16 serializers */
    serial-dir = < /* 1 TX 2 RX 0 unused */
             2 0 0 0
        >;
    rx-num-evt = <1>;
    tx-num-evt = <1>;
};

asound.conf:

pcm.onboard{
    type hw
    card 0
}
ctl.onboard {
    type hw
    card 0
}

### Dsnoop splited channels
pcm.onboard_capture_left {
     type dsnoop
     ipc_key 32
     slave {
         pcm "onboard"
         channels 2
     rate 48000
         format S32_LE
     }
     bindings.0  0
}
pcm.onboard_playback_left {
     type dmix
     ipc_key 33
     slave {
         pcm "onboard"
         channels 2
     }
     bindings.0  0
}


pcm.onboard_capture_right {
     type dsnoop
     ipc_key 32
     slave {
         pcm "onboard"
         channels 2
     rate 48000
     format S32_LE
     }
     bindings.0  1
}
pcm.onboard_playback_right {
     type dmix
     ipc_key 33
     slave {
         pcm "onboard"
         channels 2
     }
     bindings.0  1
}


### PLUGS ##
### used with darkice
### device = plug:plug_onboard_left
pcm.plug_onboard_capture_left{
        type plug
        slave.pcm "onboard_capture_left"
}
pcm.plug_onboard_playback_left{
        type plug
        slave.pcm "onboard_playback_left"
}

pcm.!default {
    type asym
    playback.pcm "plug_onboard_playback_left"
    capture.pcm "plug_onboard_capture_left"
}

您的 DTS 文件可能有误。鉴于其 I2S 输入,您应该使用这 3 个引脚:

#define P9_31b (0x3400 + 4 * 169)
#define P9_29b (0x3400 + 4 * 170)
#define P9_18b (0x3400 + 4 * 173)

DRA7XX_CORE_IOPAD(P9_29b, PIN_INPUT | MUX_MODE0) // 29b 0  mcasp1_fsx    FRAME SYNC           RCLK
   DRA7XX_CORE_IOPAD(P9_31b, PIN_INPUT | MUX_MODE0) // 31b 0  mcasp1_aclkx  BIT CLOCK            BCLK
   DRA7XX_CORE_IOPAD(P9_18b, PIN_INPUT | MUX_MODE0) // 18b 0  mcasp1_axr0   I2S INPUT            DATA