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.

AM623: am62x audio debugging

Part Number: AM623

Hello, I am currently debugging the audio function of the AM6234.  The audio chip used on the board is the ES8388, connected to the main_i2c2 of the AM6234.  The audio interface is connected to the mcasp0 of the AM6234.  Hardware-wise, an external 11.2896 MHz crystal oscillator is connected to the MCLK of the ES8388 and the AUDIO_EXT_REFCLK1 of the AM6234.  The schematic diagram is as follows:image.png

The device tree configuration is as shown in the attachment.

main_mcasp0_pins_default: main-mcasp0-pins-default {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x01d4, PIN_INPUT, 5) /* (B15) UART0_RTSn.AUDIO_EXT_REFCLK1 */

			AM62X_IOPAD(0x01a4, PIN_INPUT, 0) /* (B20) MCASP0_ACLKX */
			AM62X_IOPAD(0x01a8, PIN_INPUT, 0) /* (D20) MCASP0_AFSX */
			AM62X_IOPAD(0x0198, PIN_OUTPUT, 0) /* (A19) MCASP0_AXR2 */
			AM62X_IOPAD(0x0194, PIN_INPUT, 0) /* (B19) MCASP0_AXR3 */
		>;
	};

sound {
		status = "okay";
		compatible = "simple-audio-card";
		simple-audio-card,name = "AM62x-SKEVM";
		simple-audio-card,widgets =
		  	"Microphone", "Mic Jack",
		 	"Line", "Line In",
		 	"Headphone", "Headphone Jack";
		simple-audio-card,routing =
		 	"Headphone Jack", "LOUT1",
		 	"Headphone Jack", "ROUT1",
		 	"Line In", "LINPUT2",
		 	"Line In", "RINPUT2",
		 	"Mic Jack", "Mic Bias";

		simple-audio-card,cpu {
			sound-dai = <&mcasp0>;
		};

		sound_master:simple-audio-card,codec {
			sound-dai = <&es8388>;
			system-clock-frequency = <11289600>;
		};
	};
&audio_refclk1 {
	status = "okay";


	assigned-clocks = <&k3_clks 157 10>, <&k3_clks 157 17>, <&k3_clks 157 18>, <&k3_clks 157 19>;
    assigned-clock-parents = <&k3_clks 157 10>;
    assigned-clock-rates = <11289600>, <0>, <0>, <11289600>;
};
&mcasp0 {
	pinctrl-names = "default";
	pinctrl-0 = <&main_mcasp0_pins_default>;
        status = "okay";
	#sound-dai-cells = <0>;
	op-mode = <0>;          /* MCASP_IIS_MODE */
	tdm-slots = <2>;

	assigned-clocks = <&k3_clks 190 9>, <&k3_clks 190 15>;
	assigned-clock-parents = <&k3_clks 190 13>, <&k3_clks 190 19>;
	assigned-clock-rates = <11289600>, <11289600>;


	/* 16 serializers */
	serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
		0 0 1 2
		0 0 0 0
		0 0 0 0
		0 0 0 0
	>;
	tx-num-evt = <32>;
	rx-num-evt = <32>;
};

Now, after recording the audio through "arecord-c 2-r 44100-f cd-d 5 mic.wav", the sound played through "aplay mic.wav" is much faster than the original sound.

  • Hi Huan,

    From what you have shared, I interpret the following.

    MCASP0 is being used as slave.  ES8388 is the master providing clocks to MCASP0. 

    If you are providing the MCLK using external crystal to the codec, is the codec able to generate BCLK and Frame sync correctly? Which is what is being provided to ACLKX and AFSX of MCASP.

    Why are you providing AUDIO_EXT_REFCLK1? Where are you referencing the " audio_refclk1" in the device tree?  

    Are you able to play the recorded audio on host PC correctly? Is it a playback or record issue to debug?

    Best Regards,

    Suren

  • Hello, I am currently using the MCASP0 as the host and the es8388 as the slave. An external 11.2896MHZ crystal oscillator is connected to the MCLK of the es8388 and the AUDIO_EXT_REFCLK1 of the am62. When the recorded audio is played on the PC, the effect is the same. The playback is much faster than the original audio.

  • Your device tree is saying MCASP0 is a slave. That means its receiving clocks externally, but your previous reply said ES8388 is a slave. 

    see below snippet from the DTS:

    simple-audio-card,cpu { sound-dai = <&mcasp0>; }; sound_master:simple-audio-card,codec { sound-dai = <&es8388>; system-clock-frequency = <11289600>; };

    Could you answer the below query?

    Why are you providing AUDIO_EXT_REFCLK1? Where are you referencing the " audio_refclk1" in the device tree?  

    Could you provide a visual showing how you are connecting MCASP0 to ES8388 with external crystal.

    Please refer the below document:

    https://www.ti.com/lit/an/sprack0/sprack0.pdf

    Best Regards,

    Suren

  • I am ‘sound/soc/codecs/es8328.c ’ The c drive to print information is added to es8388 is indeed working in from the pattern.

  • Hi Huan,

    Just for your example, if I have the cpu/SOC as the clock master, then you have to modify the DTS file like below:

    codec_audio: sound {
     
                    compatible = "simple-audio-card";
                    simple-audio-card,name = "AM62X-DUMMY";
                    simple-audio-card,format = "i2s";
                    simple-audio-card,bitclock-master = <&sound_master0>;
                    simple-audio-card,frame-master = <&sound_master0>;
     
      
     
                    sound_master0: simple-audio-card,cpu {
                    sound-dai = <&mcasp1>;
                    system-clock-direction-out;
                    };
     
      
     
                    simple-audio-card,codec {
                            sound-dai = <&codec_test>;
                    };
            };

    Best Regards,

    Suren