This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TLV320ADC3140: TLV320ADC3140 arecord error on AM4377

Part Number: TLV320ADC3140
Other Parts Discussed in Thread: AM4377, , AM4372

Hi TI team,

We have an AM4377 board MCASP0 connect to TLV320ADC3140, AM4377 is Slave and TLV320ADC3140 is Master, TLV320ADC3140 is configured as 8xDMIC.

we meet a problem is 'read error: Input/output error' when running 'arecord' command and test.wav has no data:

root@am437x-evm:~# arecord -Dhw:0,0 -c 8 -d 10 -r 48000 -f S32_LE test.wav                                        
Recording WAVE 'test.wav' :                        
Signed 32 bit Little Endian, Rate 48000 Hz, Channels 8                                                            
arecord: pcm_read:2143: read error: Input/output error                                                            
root@am437x-evm:~#

Please help to check it, thanks.

here are some our information:

1. block diagram:

Block Diagram

2. TLV320ADC3140 driver source code download from:
git.kernel.org/.../codecs
/tlv320adcx140.c?h=v5.9.6
git.kernel.org/.../codecs
/tlv320adcx140.h?h=v5.9.6

3. SDK is:

ti-processor-sdk-linux-rt-am437x-evm-06.03.00.106 (linux-rt-4.19.94+gitAUTOINC+a242ccf3f1-ga242ccf3f1).

4. Audio-releted device tree config:
#include "am4372.dtsi"
clk_mcasp0_fixed: clk_mcasp0_fixed {
    #clock-cells = <0>;
    compatible = "fixed-clock";
    clock-frequency = <24576000>;
};
clk_mcasp0: clk_mcasp0 {
    #clock-cells = <0>;
    compatible = "gpio-gate-clock";
    clocks = <&clk_mcasp0_fixed>;
    enable-gpios = <&gpio4 13 GPIO_ACTIVE_HIGH>; /* Clk enable on GPIO4_13 */
};
sound {
    compatible = "simple-audio-card";
    simple-audio-card,name = "AM4377-Audio-Card";
    #sound-dai-cells = <0>;
    simple-audio-card,dai-link@0 {
        format = "dsp_b";
        bitclock-inversion;
        bitclock-master = <&sound0_master>;
        frame-master = <&sound0_master>;
        cpu {
            sound-dai = <&mcasp0>;
            dai-tdm-slot-num = <8>;
            dai-tdm-slot-width = <32>;
            dai-tdm-slot-tx-mask = <1 1 1 1 1 1 1 1>;
            dai-tdm-slot-rx-mask = <1 1 1 1 1 1 1 1>;
        };
        sound0_master: codec {
            sound-dai = <&tlv320adc3140>;
            clocks = <&clk_mcasp0>;
        };
    };
};
&i2c2 {
    tlv320adc3140: codecadc@4c {
        reg = <0x4c>;
    };
};

&tlv320adc3140 {
    status = "okay";
    #sound-dai-cells = <0>;
    compatible = "ti,tlv320adc3140";
    /* areg-supply = <&vsys_1v8>; */
    ti,mic-bias-source = <6>;
    ti,pdm-edge-select = <0 0 0 0>;
    /* GPI1 ~ GPI4 */
    ti,gpi-config = <4 5 6 7>;
    ti,gpio-config = <10 0>;   
    ti,gpo-config-1 = <4 1>;
    ti,gpo-config-2 = <4 1>;
    ti,gpo-config-3 = <4 1>;
    ti,gpo-config-4 = <4 1>;
    ti,asi-tx-driver = <1>;
    reset-gpios = <&gpio4 12 GPIO_ACTIVE_HIGH>;
};
&mcasp0 {
    status = "okay";
    #sound-dai-cells = <0>;
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&mcasp0_pins_default>;
    pinctrl-1 = <&mcasp0_pins_sleep>;
    op-mode = <0>; /* MCASP_IIS_MODE */
    tdm-slots = <8>;
    /* 4 serializers ARX0, ARX1, ARX2, ARX3 */
    serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
        2 0 0 0
    >;
    tx-num-evt = <32>;
    rx-num-evt = <32>;
};
&am43xx_pinmux {
    gpio4_pins: gpio4_pins_default {
        pinctrl-single,pins = <
            AM4372_IOPAD(0x9e0 , PIN_OUTPUT_PULLUP | MUX_MODE7)  /* CAM1_FIELD.GPIO4_12 */
            AM4372_IOPAD(0x9e4 , PIN_OUTPUT_PULLUP | MUX_MODE7)  /* cam1_wen.GPIO4_13 */
        >;
    };

    mcasp0_pins_default: mcasp0_pins_default {
        pinctrl-single,pins = <
            AM4372_IOPAD(0x99c, PIN_INPUT_PULLUP | MUX_MODE0 ) /* (M24) mcasp0_ahclkr.mcasp0_ahclkr*/
            AM4372_IOPAD(0x9ac, PIN_INPUT_PULLUP | MUX_MODE0 )    /* (N24) mcasp0_ahclkx.mcasp0_ahclkx */
            AM4372_IOPAD(0x998, PIN_INPUT_PULLUP | MUX_MODE0 )  /* (H23) mcasp0_axr0.mcasp0_axr0 */
            AM4372_IOPAD(0x9a8, PIN_INPUT_PULLUP | MUX_MODE0 )  /* (L24) mcasp0_axr1.mcasp0_axr1 */
            AM4372_IOPAD(0x994, PIN_OUTPUT_PULLUP | MUX_MODE0 )   /* (N22) mcasp0_fsx.mcasp0_fsx */
            AM4372_IOPAD(0x9a4, PIN_INPUT_PULLUP | MUX_MODE0 ) /* (N24) mcasp0_fsr.mcasp0_fsr */
            AM4372_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE0 ) /* (N24) mcasp0_aclkx.mcasp0_aclkx, */
            AM4372_IOPAD(0x9a0, PIN_INPUT_PULLUP | MUX_MODE0 ) /* (N22) mcasp0_aclkr.mcasp0_aclkr */
        >;
    };

    mcasp0_pins_sleep: mcasp0_pins_sleep {
        pinctrl-single,pins = <
            AM4372_IOPAD(0x99c, PIN_INPUT_PULLUP | MUX_MODE7 ) /* (M24) mcasp0_ahclkr.mcasp0_ahclkr*/
            AM4372_IOPAD(0x9ac, PIN_INPUT_PULLUP | MUX_MODE7 )    /* (N24) mcasp0_ahclkx.mcasp0_ahclkx */
            AM4372_IOPAD(0x998, PIN_INPUT_PULLUP | MUX_MODE7 )  /* (H23) mcasp0_axr0.mcasp0_axr0 */
            AM4372_IOPAD(0x9a8, PIN_INPUT_PULLUP | MUX_MODE7 )  /* (L24) mcasp0_axr1.mcasp0_axr1 */
            AM4372_IOPAD(0x994, PIN_OUTPUT_PULLUP | MUX_MODE7 )   /* (N22) mcasp0_fsx.mcasp0_fsx */
            AM4372_IOPAD(0x9a4, PIN_INPUT_PULLUP | MUX_MODE7 ) /* (N24) mcasp0_fsr.mcasp0_fsr */
            AM4372_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (N24) mcasp0_aclkx.mcasp0_aclkx, */
            AM4372_IOPAD(0x9a0, PIN_INPUT_PULLUP | MUX_MODE7 ) /* (N22) mcasp0_aclkr.mcasp0_aclkr */
        >;
    };
};

5. I dumped TLV320ADC3140's all registers by i2cdump when running 'arecord' command and show them as below:

Regards,

Xing-Qin

  • Hi Xing-Qin

    We dont really support code debugging but i will look at register dump in help to pinpoint the problem.

    Best,

    Carson

    Low Power Audio Engineer

  • Hi Carson,

    Thanks for your reply, here is the wave of TLV320ADC3140's DAI signal for you, it seems that ADC work normally but CPU can not record, please help to check it, thanks.

    Best regards,

    Xing-Qin

  • If it is the processor is problem, you should post in that forum, but also verify clocks are being supplied properly from the ADC.

  • Hi Carson,

    Sorry for my update so late, I have created a new thread about this issue in processor forum, if I have any questions, I will update here, thanks.

    Regards,

    Xin-Qin

  • Hi Carson,

    After reworked our board as fallow block diagram:

    Our problem have been solved.

    But we meet anther problem as follow:

    I used 'arecord' command to record 8 channels audio in Linux, I found that only 4 channels(ch1-ch4) in the output .wav file have data and the other 4 channels(ch5-ch8) are zero.

    I dumped ADC's registers when recording:

    It shown that register 0x73 and 0x76 have been set to 0xf0, ch5-ch8 are disabled and PDM ch5-ch8 are power-downed.

    I also enabled all 8 channels by setting ADC register 0x73 to 0xff :

    i2cset -f -y 2 0x4c 0x73 0xff

    and verified its value have been set to 0xff by 'i2cget -f -y 2 0x4c 0x73'

    after that, re-dumped ADC registers as above, the result is same(reg.0x73=0xf0, reg.0x76=0xf0).

    By our experiment, it seems that ADC ch5-ch8 automatically be power-downed when recording, it causes channel5-channel8 to be zero.

    Could you help me to solve this problem?

    Thanks,

    Best regards,

    Xing-Qin

  • Hi Xing-Qin,

    Could you share full schematic regarding DMIC input configuration?

    Best Regards,

    Carson

  • Hi Carson,

    Sorry, I forgot it. Now I upload the schematic here, thanks.

    MIC_00.pdf

    Best Regards,

    Xing-Qin