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.

AM625: Audio Playback issue

Part Number: AM625

Hi TI Expert Team,

I am using DA7212 codec connected with AM6254 cpu over mcasp0. I have connected headphone negative terminal on GND and headphone positive terminal on I2S0_HP_R as shown in below figure. I am successfully detected codec as card1 and able to select it. I have played music through aplay -Dplughw:1,0 -t orgsong.wav and getting playback in slow motion than the original sound. I have also attached playback .wav file and original song file.  

clock frequency of BCLK is at 1.4MHz and WCLK is at 21KHz.

Can you please suggest if any settings I have to do to get playback file same as original music file.

  • Hi Maulik,

    Could you share the DTS file with the changes you have made? Is MCASP master or slave in your configuration?

    Also, if you could refer the McASP design guide in order to debug the issue:

    https://www.ti.com/lit/an/sprack0/sprack0.pdf?ts=1677781402811

    Regards,

    Suren

  • Hi Suren,

    Thanks for quick response. As  per my dts file audio codec connected with AM6254 cpu over mcasp0 is taken as master. Here below are my dts file changes.

    under i2c node
    
    da7213_codec: da7212@1a {
    	#sound-dai-cells = <0>;
    	compatible = "dlg,da7213";
    	reg = <0x1a>;
    
    	dlg,micbias1-lvl = <3000>;
    	dlg,micbias2-lvl = <3000>;
    
    	VDDA-supply = <&vcc_1v8>;
    	VDDSP-supply = <&vcc_5v0>;
    	VDDIO-supply = <&vcc_1v8>;
    	VDDMIC-supply= <&vcc_3v3_sys>;
    	clocks = <&clk_ext_audio_codec>;
    	clock-names = "mclk";
    };
    
    
    
    Clock
    
    clk_ext_audio_codec: clock-codec {
    	compatible = "fixed-clock";
    	#clock-cells = <0>;
    	clock-frequency = <12288000>;
    };
    
    
    
    sound node
    
    sound {
    	compatible = "simple-audio-card";
    	simple-audio-card,name = "sm2s-am62x";
    	simple-audio-card,format = "i2s";
    	simple-audio-card,bitclock-master = <&dailink_master>;
    	simple-audio-card,frame-master = <&dailink_master>;
    	simple-audio-card,widgets =
    	"Headphone", "Headphone Jack",
    	"Line", "Line In",
    	"Microphone", "Microphone Jack";
    
    	simple-audio-card,audio-routing = "Mic1", "Mic Bias 1",
    	"MIC1", "Mic 1",
    	"Headphone Jack", "HPL",
    	"Headphone Jack", "HPR",
    	"Speaker", "LINE",
    	"Ext Spk", "Line In",
    	"Line", "Mic Bias";
    
    
    	simple-audio-card,cpu {
    	sound-dai = <&mcasp0>;
    	};
    
    	dailink_master: simple-audio-card,codec {
    	sound-dai = <&da7213_codec>;
    	system-clock-frequency = <12000000>;
    	};
    };
    
    
    
    under mcasp0 node
    
    &mcasp0 {
    	status = "okay";
    	#sound-dai-cells = <0>;
    
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_mcasp0_pins_default>;
    	op-mode = <0>;
    	tdm-slots = <2>;
    
    	serial-dir = <
    	1 0 2 0
    	0 0 0 0
    	0 0 0 0
    	0 0 0 0
    	>;
    
    	tx-num-evt = <32>;
    	rx-num-evt = <32>;
    };
    
    
    
    Pin muxing
    
    main_mcasp0_pins_default: main-mcasp0-pins-default {
    	pinctrl-single,pins = <
    
    	//Connected with I2S0
    
    	AM62X_IOPAD(0x01a4, PIN_INPUT, 0) /* (B20) MCASP0_ACLKX.MCASP0_ACLKX */
    	AM62X_IOPAD(0x01a8, PIN_INPUT, 0) /* (D20) MCASP0_AFSX.MCASP0_AFSX */
    	AM62X_IOPAD(0x01a0, PIN_OUTPUT, 0) /* (E18) MCASP0_AXR0.MCASP0_AXR0 */
    	AM62X_IOPAD(0x019c, PIN_INPUT, 0) /* (B18) MCASP0_AXR1.MCASP0_AXR1 */
    
    
    
    	//Connected with I2S1
    
    	AM62X_IOPAD(0x01b0, PIN_INPUT, 0) /* (A20) MCASP0_ACLKR.MCASP0_ACLKR */
    	AM62X_IOPAD(0x01ac, PIN_INPUT, 0) /* (E19) MCASP0_AFSR.MCASP0_AFSR */
    	AM62X_IOPAD(0x0198, PIN_OUTPUT, 0) /* (A19) MCASP0_AXR2.MCASP0_AXR2 */
    	AM62X_IOPAD(0x0194, PIN_INPUT, 0) /* (B19) MCASP0_AXR3.MCASP0_AXR3 */
    
    	>;
    };
    

    I did codec connection with I2S port as per below image.

    Please suggest if I missed anything.

    Thanks,

    Maulik

  • Hi Maulik,

    Thanks for sharing the DTS entries. 

    On AM62SK we use simple-audio-card, format = "dsp_b"  where McASP is slave and Codec on SK board is Master providing the clocks.

    Can you try to change the format and give it a try and see if you are able to have audio playback.

    Ref File:

    git.ti.com/.../k3-am62x-sk-common.dtsi

    Thanks

    Best Regards

    Suren

  • Hi Suren,

    Thanks for the update. I tried  'simple-audio-card,format = "dsp_b";' but Still I hear sound in slow motion with the same result as earlier.

    Thanks,

    Maulik

  • Hi Maulik,

    Upon reviewing your DTS entries one thing that I observed was you got 12288000 in clk_ext_audio_codec and system-clock-frequency of 12000000 in the sound-dai area? 

    Also what is the MCLK based on the clock modes that I have attached for your reference?

    One more thing, how are you verifying the WCLK is 21Khz , shouldn't it be 22050?

    Hope this helps in your debugging.

    Best Regards

    Suren