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.

AM3358: I2S microphone array recording issue

Part Number: AM3358
Other Parts Discussed in Thread: PCM1864, PCM1865, PCM5102A

I enabled the PCM sound card with bcm1864 on i2s but I can't get working all 4 channel for recording and only recording with 96khz mono is ok.

If I want to record 10s audio with 48khz, arecord is working only 5s and creating file with 0.5x speed. 

In the case of trying record stereo  arecord is creating multiple file  of size 44B and never finishing recording.

the result of /opt/scripts/tools/version.sh:

eeprom:[A335BNLTBWA51719EW000513]
dogtag:[BeagleBoard.org Debian Image 2017-03-19]
bootloader:[/dev/mmcblk1]:[U-Boot 2017.03-00002-gd12b1519b4]
kernel:[4.19.73-ti-rt-r27]
nodejs:[v4.8.0]
device-tree-override:[dtb=am335x-boneblack-wireless.dtb]

bcm1864 i2c configuration:

i2cset -r -y 2 0x4a 0x01 0x40
i2cset -r -y 2 0x4a 0x02 0x40
i2cset -r -y 2 0x4a 0x03 0x40
i2cset -r -y 2 0x4a 0x04 0x40
i2cset -r -y 2 0x4a 0x00 0xfe
i2cset -r -y 2 0x4a 0x06 0x41
i2cset -r -y 2 0x4a 0x07 0x41
i2cset -r -y 2 0x4a 0x08 0x44
i2cset -r -y 2 0x4a 0x09 0x44
i2cset -r -y 2 0x4a 0x20 0x11
i2cset -r -y 2 0x4a 0x0b 0xcc

  • Debian Linux is not supported by TI. This forum supports only the Processor SDK released by TI. For support on Debian please contact the community on www.beagleboard.org

  • I created sd card with latest ti sdk for am335x and following by this guide http://www.ti.com/lit/an/sprac97/sprac97.pdf I added the pcm1864 array microphone and still the issue  described earlier is present.

    The true record is only available with fs = 96kHz, with any other fs the speed of recording is faster or slower than realtime

  • Marcin,

    In this forum (Processors forum), we support AM335x device, from the devices listed in SPRAC97 document.

    In SPRAC97 document, we have AM335x McASP1 module receive I2S audio data from C5517 DSP. AM335x McASP1 receives I2S audio data from 3 pins: bit clock (mcasp1_aclkx), sample rate (mcasp1_fsx) and data in (mcasp1_axr0).

    The sample rate is 16KHz, which is one of the supported sample rates, for full list refer to below wiki page:

    Regarding AM335x McAPS1 module, what issue exactly you have with it? Do you try to receive audio data from more than one pin? Do you need to receive data not only from mcasp1_axr0 pin, but from more axr pins?

    Regards,
    Pavel

  • I'm trying to record simple audio with arecord. I have pcm1864 directly connected to beaglebone:

    24 -> P9 19

    23 -> P9 20

    18 -> P9 41

    16 -> P9 27

    17 -> P9 42 

  • Acording to i2s specs and 1864 data sheet... Is it possible to connnect pcm1864 as 4 channel audio input by i2s to beaglebone or I need to configure this in tdm format?

  • Marcin Rosiek said:

    I'm trying to record simple audio with arecord. I have pcm1864 directly connected to beaglebone:

    24 -> P9 19

    23 -> P9 20

    18 -> P9 41

    16 -> P9 27

    17 -> P9 42 

    BeagleBone Black board has AM335x device of type ZCZ, thus you are using below pins:

    P9_19 is D17 UART1_RTSn

    P9_20 is D18 UART1_CTSn

    P9_41 is D14 XDMA_EVENT_INTR1

    P9_27 is C13 MCASP0_FSR

    P9_42 is C18 ECAP0_IN_PWM0_OUT


    From all these pins, only C13 can be selected to mcasp1_fsx. All other pins do not have McASP1 pinmux options. Please revise you HW pinout connection.

    Regards,
    Pavel

  • Marcin Rosiek said:
    Acording to i2s specs and 1864 data sheet... Is it possible to connnect pcm1864 as 4 channel audio input by i2s to beaglebone or I need to configure this in tdm format?

    For AM335x McASP input options and formats, please refer to AM335x TRM, ch22 McASP. Below doc might be also useful:

    Regards,
    Pavel

  • I created dts file for using tdm and driver pcm186x from ti sdk. When recording with arecord the clock of BCK is changing, the output data is generated (view by osciloscope) but system returns: arecord: pcm_read:2143: read error: Input/output error

    My dts:

    &am33xx_pinmux {
        myi2c1_pins_default: myi2c1_pins_default {
            pinctrl-single,pins = <
                AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE2) /* (A16) spi0_cs0.I2C1_SCL P9_17   */
                AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE2) /* (B16) spi0_d1.I2C1_SDA P8_18  */
            >;
        };

        /* Optional sleep pin settings. Must manually enter values in the below skeleton. */
        myi2c1_pins_sleep: myi2c1_pins_sleep {
            pinctrl-single,pins = <
                AM33XX_IOPAD(0x95c,  PIN_INPUT_PULLUP | MUX_MODE2) /* (A16) spi0_cs0.I2C1_SCL */
                AM33XX_IOPAD(0x958,  PIN_INPUT_PULLUP | MUX_MODE2) /* (B16) spi0_d1.I2C1_SDA */
            >;
        };

        mymcasp0_pins_default: mymcasp0_pins_default {
            pinctrl-single,pins = <
                0xd0 ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (V2) lcd_data12.mcasp0_aclkr */
                0xd4 ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (V3) lcd_data13.mcasp0_fsr */
                0xc8 ( PIN_OUTPUT | MUX_MODE3 ) /* (U3) lcd_data10.mcasp0_axr0 */
                0xd8 ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (V4) lcd_data14.mcasp0_axr1 */
                0xcc ( PIN_INPUT_PULLUP | MUX_MODE4 ) /* (U4) lcd_data11.mcasp0_axr2 */
            >;
        };

    };


    &mcasp0 {
            #sound-dai-cells = <0>;
            pinctrl-names = "default";
            pinctrl-0 = <&mymcasp0_pins_default>;

            status = "okay";

            op-mode = <0>;          /* MCASP_IIS_MODE */
            tdm-slots = <2>;
            serial-dir = <    /* 0: INACTIVE, 1: TX, 2: RX */
                0 2 2 0
                >;
            tx-num-evt = <32>;
            rx-num-evt = <32>;
    };

    &i2c1 {
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&myi2c1_pins_default>;
        pinctrl-1 = <&myi2c1_pins_sleep>;

        status = "okay";
        clock-frequency = <100000>;

        pcm1865: pcm1865@4a {
            compatible = "ti,pcm1865";
            #sound-dai-cells = <0>;
            reg = <0x4a>;
            status = "okay";
            /* Regulators */
            AVDD-supply = <&vmmcsd_fixed>;
            IOVDD-supply = <&vmmcsd_fixed>;
            DVDD-supply = <&vmmcsd_fixed>;
        };
    };


    / {
        pcm5102a: pcm5102a {
            #sound-dai-cells = <0>;
            compatible = "ti,pcm5102a";
            status = "okay";
        };
        
        sound {
        compatible = "simple-audio-card";
        simple-audio-card,name = "ADC Sound";

        simple-audio-card,widgets =
                "Line", "Line In Jack 1",
                "Line", "Line In Jack 2",
                "Line", "Line In Jack 3",
                "Line", "Line In Jack 4";
        simple-audio-card,routing =
                "Line In Jack 1", "VINL1",
                "Line In Jack 1", "VINR1",
                "Line In Jack 2", "VINL2",
                "Line In Jack 2", "VINR2",
                "Line In Jack 3", "VINL3",
                "Line In Jack 3", "VINR3",
                "Line In Jack 4", "VINL4",
                "Line In Jack 4", "VINR4";

        simple-audio-card,format = "i2s";

        simple-audio-card,bitclock-master = <&sound0_master>;
        simple-audio-card,frame-master = <&sound0_master>;

        simple-audio-card,cpu {
            sound-dai = <&mcasp0>;
            system-clock-frequency = <24576000>;
            system-clock-direction = "in";
        };

        sound0_master: simple-audio-card,codec {
            sound-dai = <&pcm1865>;
            system-clock-frequency = <24576000>;
        };
    };


    };

  • Marcin Rosiek said:
    When recording with arecord the clock of BCK is changing, the output data is generated (view by osciloscope) but system returns: arecord: pcm_read:2143: read error: Input/output error

    The input and output error typically happens when the ALSA PCM device is not consuming any data. Check again with scope if you have valid data transfer from PCM1865 codec to AM335x McASP module through the axr pins. Check also below user guide, section 6.7 Input and Output Error During Audio Record

    Regards,
    Pavel