cancel
Showing results for 
Search instead for 
Did you mean: 

PCMD3140 Audio Codec on STM32MP13 (Kirkstone BSP): Only 1 PDM Microphone Channel Working

MattiaP
Visitor

Moved from MCUs forum. STM32MP13 is an MPU - not MCU.


Hello everyone,
I'm working on porting the PCMD3140IRTER codec to the Kirkstone BSP on an STM32MP13 platform. At the moment, I have connected only two microphones (presumably the left and right ones) to the PDMDIN1_GPI1 line.

The microphones are Adafruit PDM MEMS, based on the MP34DTx chip. I verified their behavior using an oscilloscope, and the signals look correct according to the datasheet. So far, everything seems fine.

The issue arises when I try to record audio using the following command:

arecord -D hw:0,0 -f S16_LE -r 48000 -c 2 test.wav

When I listen to the recorded file, I can hear only the left channel, as if the right microphone is not being captured. If I change the ti,pdm-edge-select property from:

<0 1 0 1>
to
<1 0 1 0>

I still hear only the left channel, but it now seems to come from the other microphone. So, it looks like only one microphone at a time is being used, and it's always recorded as the left channel, regardless of the pdm-edge-select setting.

Additionally, if I disable CH1_ASI_EN and enable only CH2_ASI_EN, nothing gets recorded in either pdm-edge-select configuration. In Audacity, the right channel is completely silent.

My impression is that only one channel is actually being used, instead of both, as expected for stereo input from two microphones.

Below, I will include the relevant device tree nodes, hoping someone can help me identify what I'm missing or doing wrong in the configuration.

 

sound {
        compatible = "audio-graph-card";
        label = "i.Core STM32MP1";
        dais = <&sai1a_port>;
        status = "okay";
    };

 

    sai1a_pins_mx: sai1a_mx-0 {
        pins {
            pinmux = <STM32_PINMUX('D', 6, AF6)>, /* PCMD_SDOUT */
                     <STM32_PINMUX('E', 11, AF6)>, /* PCMD_FSYNC */
                     <STM32_PINMUX('C', 0, AF2)>; /* PCMD_BCLK */
                     
            bias-disable;
            drive-push-pull;
            slew-rate = <0>;
        };
    };

    sai1a_sleep_pins_mx: sai1a_sleep_mx-0 {
        pins {
            pinmux = <STM32_PINMUX('D', 6, AF6)>, /* PCMD_SDOUT */
                     <STM32_PINMUX('E', 11, AF6)>, /* PCMD_FSYNC */
                     <STM32_PINMUX('C', 0, AF2)>; /* PCMD_BCLK */
        };
    };

    sai1b_pins_mx: sai1b_mx-0 {
        pins {
            pinmux = <STM32_PINMUX('G', 10, AF10)>; /* SAI1_SD_B */
            bias-disable;
            drive-push-pull;
            slew-rate = <0>;
        };
    };

    sai1b_sleep_pins_mx: sai1b_sleep_mx-0 {
        pins {
            pinmux = <STM32_PINMUX('G', 10, ANALOG)>; /* SAI1_SD_B */
        };
    };

 

&sai1{
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&sai1a_pins_mx>;
    pinctrl-1 = <&sai1a_sleep_pins_mx>;
    status = "okay";

    /* USER CODE BEGIN sai1 */
    clocks = <&rcc SAI1>, <&scmi_clk CK_SCMI_PLL3_R>, <&scmi_clk CK_SCMI_PLL3_Q>;
    clock-names = "pclk", "x8k", "x11k";

    /* USER CODE END sai1 */

    sai1a:audio-controller@4400a004{
        status = "okay";
        
        /* USER CODE BEGIN sai1a */
        //frame-master;
        //bitclock-master;
        
        #clock-cells = <0>; /* Set SAI1A as master clock provider */
        dma-names = "rx"; /* SAI set as receiver */
        sai1a_port: port {
            sai1a_endpoint: endpoint {
                    remote-endpoint = <&pcmd3140_tx_endpoint>;
                    format = "i2s";
                    dai-format = "i2s";
                    mclk-fs = <256>; /* Set mclk/fs ratio. (256 or 512) */
            };
        };
        /* USER CODE END sai1a */
    };

};

 

&i2c2{

...

...

    pcmd3140_codec: pcmd3140_codec@4e {
        compatible = "ti,tlv320adc3140";
        reg = <0x4e>;
        // ti,mic-bias-source = <6>;
        ti,pdm-edge-select = <0 1 0 1>;
        ti,gpi-config = <4 5 0 0>;
        ti,gpio-config = <2 1>;
        ti,gpo-config-1 = <4 1>;
        // ti,gpo-config-2 = <0 0>;
        clocks = <&sai1a>;
        clock-names = "MCLK1";


        pcmd3140_port: port {
            #address-cells = <1>;
            #size-cells = <0>;

            pcmd3140_tx_endpoint: endpoint@0 {
                reg = <0>;
                remote-endpoint = <&sai1a_endpoint>;
            };
            /*
            pcmd3140_rx_endpoint: endpoint@1 {
                reg = <1>;
                remote-endpoint = <&sai1b_endpoint>;
            };
            */
        };
    
      };

};

0 REPLIES 0