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.

AM335x: mcasp0 frame sync no clock

Other Parts Discussed in Thread: PCM5102A

Hi,

We are working on a board and we would like to interface an I2S microphone. We have made the following steps to set it up:

1. Added capture element to pcm5102a.c

.capture = {
+		.stream_name = "Capture",
+		.channels_min = 1,
+		.channels_max = 2,
+		.rates = SNDRV_PCM_RATE_8000_192000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE |
+			   SNDRV_PCM_FMTBIT_S24_LE |
+			   SNDRV_PCM_FMTBIT_S32_LE
+	},

2. Setup the device tree (only relevant parts):

mcasp0_pins_default: pinmux_mcasp0_pins_default {
		pinctrl-single,pins = <
			AM33XX_IOPAD(0x9a0, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* (B12) mcasp0_aclkr.mcasp0_aclkr 			sck, bit clock		mic*/
			AM33XX_IOPAD(0x9a4, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* (C13) mcasp0_fsr.mcasp0_fsr 				ws, frame sync		mic*/
			AM33XX_IOPAD(0x998, PIN_INPUT_PULLDOWN | MUX_MODE0) /* (D12) mcasp0_axr0.mcasp0_axr0 				sd, data			mic*/

			AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* (A13) mcasp0_aclkx.mcasp0_aclkx 			clk, bit clock		dac*/
			AM33XX_IOPAD(0x994, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* (B13) mcasp0_fsx.mcasp0_fsx 				ws, frame sync		dac*/
			AM33XX_IOPAD(0x9a8, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* (D13) mcasp0_axr1.mcasp0_axr1 				data, data			dac*/
		>;
	};
&mcasp0 {
    #sound-dai-cells = <0>;
    pinctrl-names = "default";
    pinctrl-0 = <&mcasp0_pins_default>;
    status = "okay";
    op-mode = <0>;    /* MCASP_IIS_MODE */
    tdm-slots = <2>;
    num-serializer = <4>;
    serial-dir = < 2 1 0 0 >;
    rx-num-evt = <32>;
    tx-num-evt = <32>;
};
pcm5102a: pcm5102a {
        #sound-dai-cells = <0>;
        compatible = "ti,pcm5102a";
		status = "okay";
	};

sound0: sound@0 {
        compatible = "simple-audio-card";
        simple-audio-card,name = "PCM5102a";
        simple-audio-card,format = "i2s";
        simple-audio-card,bitclock-master = <&sound_master>;
        simple-audio-card,frame-master = <&sound_master>;

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

		simple-audio-card,codec {
			#sound-dai-cells = <0>;
			sound-dai = <&pcm5102a>;
		};
	};

When we try to use arecord to record something, the volume level is 0 and we cannot see any clock on frame sync pin (mcasp0.fsr). However we see bit clock(mcasp0.aclkr). Strange thing is that the mcasp0.fsr pin goes high, when we start recording and goes low when we stop.

We have a dac connected to mcasp0.aclkx(bit clock), mcasp0.fsx(frame sync) and mcasp0.axr1 data. When we play something, we can see bit clock, frame sync and data on the corresponding pins on the dac.

Is there anything we missed in the setup?

Thanks,

Marton

 

  • Hi Marton,

    Unfortunately, the default Linux framework does not support asynchronous mode for the McASP. Please make sure you are using the aclkx/fsx for capture and playback. 

    Regards,
    Krunal

  • Hi Krunal,

    Thanks for the clarification.

    I've reconfigured the microphone pins to use mcasp1 aclkx and fsx and now I can see the clock generated on frame sync.

    I am thinking maybe using mcasp1 for the microphone and mcasp0 for the dac would be a good solution.

    Could you confirm the below configuration would work?

    mcasp0:

    aclkx(A13, MODE0) -> dac bit clock

    fsx(B13, MODE0) -> dac frame sync

    axr0(D12, MODE0) -> transmit data

    mcasp1:

    aclkx(B12, MODE3) -> mic bit clock

    fsx(C13, MODE3) -> mic frame sync

    axr0(D13, MODE3) -> receive data

    Thank you in advance.

    Best,

    Marton

  • Hi Marton,

    Yes, that looks okay. I am wondering if you have tried capturing/recording and if yes, have you noticed any issues?

    Regards,

    Krunal

  • Hi Krunal,

    Yes, I've jump wired the mic and with using mcasp1 I've recorded with arecord. No issues whatsoever and the quality of the recording was really good.

    Thanks again for the help.

    Best,

    Marton