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.

Linux/AM5728: Problem bringup tlv320aic3100 with am5728

Part Number: AM5728
Other Parts Discussed in Thread: TLV320AIC3100, BEAGLEBOARD-X15

Tool/software: Linux

I'm using processor sdk linux 5.02

Hello i'm trying to bringup tlv320aic3100 with am5728 based on beagleboard-x15.

Pinout are same as beagleboard x15.

Where my device tree is like this

	sound0: sound0 {
		compatible = "simple-audio-card";
		simple-audio-card,name = "BeagleBoard-X15";
		simple-audio-card,widgets =
			"Line", "Line Out",
			"Line", "Line In";
		simple-audio-card,routing =
			"Line Out", "SPK";
		simple-audio-card,format = "dsp_b";
		simple-audio-card,bitclock-master = <&sound0_master>;
		simple-audio-card,frame-master = <&sound0_master>;
		simple-audio-card,bitclock-inversion;

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

		sound0_master: simple-audio-card,codec {
			sound-dai = <&tlv320aic31xx>;
			clocks = <&clkout2_clk>;
		};
	};

	tlv320aic31xx: tlv320aic31xx@18 {
		#sound-dai-cells = <0>;
		compatible = "ti,tlv320aic3100";
		reg = <0x18>;
		assigned-clocks = <&clkoutmux2_clk_mux>;
		assigned-clock-parents = <&sys_clk2_dclk_div>;

		status = "okay";
		ai31xx-micbias-vg = <MICBIAS_2_0V>;

		HPVDD-supply = <&vdd_3v3>;
		SPRVDD-supply = <&vdd_3v3>;
		SPLVDD-supply = <&vdd_3v3>;
		AVDD-supply = <&vdd_3v3>;
		IOVDD-supply = <&vdd_3v3>;
		DVDD-supply = <&aic_dvdd>;
	};

After this change kernel boot print below error

[    2.395168] tlv320aic31xx-codec 0-0018: aic31xx_set_dai_sysclk: Unsupported frequency 22579200
[    2.403844] tlv320aic31xx-codec 0-0018: simple-card: set_sysclk error
[    2.410326] asoc-simple-card sound0: ASoC: failed to init davinci-mcasp.0-tlv320aic31xx-hifi: -22
[    2.419264] asoc-simple-card sound0: ASoC: failed to instantiate card -22
[    2.436495] asoc-simple-card: probe of sound0 failed with error -22

Should i've to bypass mclk & use clk on bclk pin.

How to setup that interface.

  • Hi Jigarp,

    From what I understand, you supply 22.579200 MHz clock from AM572x clkout2 pin to AIC3100 MCLK input. Seems that AIC3100 codec do not support 22.579200 MHz for its MCLK, while AIC3104 do support. As this seems to be related to AIC3100 codec, not to AM572x device, I would suggest you to ask/post in the Audio forum (link below) if AIC3100 codec support 22.579200 MHz clock input for MCLK port.

    e2e.ti.com/.../6

    What I can suggest you is:

    - try with lower clock, i.e. 20MHz. You can change sys_clk2_dclk_div with sys_clk1_dclk_div. Thus if you have 20MHz from OSC0, you will export 20MHz on clkout2 pin

    - enable debug messages in aic31xx driver, thus will have more verbose output (dev_dbg)

    Regards,
    Pavel

  • Yes we have 20MHz at XO_OSC0 pins.
    Can you provide more details to set 20Mhz at clkout2 pin.
  • You can change sys_clk2_dclk_div with sys_clk1_dclk_div.


    tlv320aic31xx: tlv320aic31xx@18 {
    #sound-dai-cells = <0>;
    compatible = "ti,tlv320aic3100";
    reg = <0x18>;
    assigned-clocks = <&clkoutmux2_clk_mux>;
    - assigned-clock-parents = <&sys_clk2_dclk_div>;
    + assigned-clock-parents = <&sys_clk1_dclk_div>;
  • After changing divisor it has the same output like this
    tlv320aic31xx-codec 0-0018: aic31xx_set_dai_sysclk: Unsupported frequency 20000000
  • Jigarp,

    Looking into the tlv320aic31xx.c driver, seems to me that only 12MHz and 12.5MHz are supported for MCLK, see aic31xx_rate_divs. But you need to confirm this in the AIC31xx codec forum:

    e2e.ti.com/.../6

    See one e2e thread from this forum that is related to your problem:

    e2e.ti.com/.../795024

    From AM57x device side, I can provide you the below hints:

    - try with 12MHz or 12.5MHz freq on clkout2 pin
    - or you can update tlv320aic31xx.c driver with 20MHz or 22.5792MHz values for MCLK
    - enable debug messages in tlv320aic31xx.c file and in davinci-mcasp.c file

    Regards,
    Pavel
  • Then how to modify clkout2 pin divisor to generate 12MHz output .
  • Jigarp,

    That will be not easy. First check TRM "Figure 3-47. CM_CORE_AON_CLKOUTMUX Clock Manager Overview (CLKOUTMUX1 and CLKOUTMUX2)"

    You need to export different signal to clkout2, different from sys_clk1 (20MHz) or sys_clk2 (22.5792MHz). You need to export the output of a DPLL (i.e. DPLL_ABE, DPLL_CORE, DPLL_VIDEO1/2, DPLL_HDMI, etc). First you need to configure this DPLL to output 12MHz (or 24MHz, 48MHz, 82MHz, etc and use the divider to get 12MHz).

    Note that some other module might be using this DPLL and might be needed other than 12MHz frequency, thus you will start to get problems with this module.

    Regards,
    Pavel
  • Hello,

    We have updated aic31xx_divs structure as per below

    {12500000, 44100, 7, 2253, 128, 8, 2, 128, 8, 2},
    {20000000, 44100, 4, 4100, 100, 4, 5, 100, 4, 5},
    
    

    And modified device tree as per below

    	sound0: sound0 {
    		compatible = "simple-audio-card";
    		simple-audio-card,name = "BeagleBoard-X15";
            simple-audio-card,widgets =                             
                    "Speaker", "Speaker";                           
            simple-audio-card,routing =
                    "Speaker" , "SPK";
            simple-audio-card,format = "dsp_b";
    		simple-audio-card,bitclock-master = <&sound0_master>;
    		simple-audio-card,frame-master = <&sound0_master>;
    		simple-audio-card,bitclock-inversion;
    
    		simple-audio-card,cpu {
    			sound-dai = <&mcasp3>;
    		};
    
    		sound0_master: simple-audio-card,codec {
    			sound-dai = <&tlv320aic31xx>;
    			clocks = <&clkout2_clk>;
    		};
    
    	tlv320aic31xx: tlv320aic31xx@18 {
    		#sound-dai-cells = <0>;
    		compatible = "ti,tlv320aic3100";
    		reg = <0x18>;
    		assigned-clocks = <&clkoutmux2_clk_mux>;
    		assigned-clock-parents = <&sys_clk1_dclk_div>;
    
    		status = "okay";
    		ai31xx-micbias-vg = <MICBIAS_2_0V>;
    
    		HPVDD-supply = <&vdd_3v3>;
    		SPRVDD-supply = <&vdd_3v3>;
    		SPLVDD-supply = <&vdd_3v3>;
    		AVDD-supply = <&vdd_3v3>;
    		IOVDD-supply = <&vdd_3v3>;
    		DVDD-supply = <&aic_dvdd>;
    	};
    
    &mcasp3 {
    	#sound-dai-cells = <0>;
    	assigned-clocks = <&mcasp3_ahclkx_mux>;
    	assigned-clock-parents = <&sys_clkin2>;
    	status = "okay";
    
    	op-mode = <0>;	/* MCASP_IIS_MODE */
    	tdm-slots = <2>;
    	/* 4 serializers */
    	serial-dir = <	/* 0: INACTIVE, 1: TX, 2: RX */
    		1 2 0 0
    	>;
    	tx-num-evt = <32>;
    	rx-num-evt = <32>;
    };

    Now i'm getting clock & signals on MCLK & DATA_OUT pins but can't hear any audio on speaker.

    While playing audio i'm getting below error

    root@am57xx-evm:~# aplay audio/HIGH.wav 
    Playing WAVE 'audio/HIGH.wav' : [   33.237134] tlv320aic31xx-codec 0-0018: Can not produce exact bitclock
    Signed 16 bit Little Endian, Rate 44100 Hz, Mono

    Here is my mixer configuration 

    Simple mixer control 'Speaker',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [on]
    Simple mixer control 'Speaker Analog',0
      Capabilities: pvolume pvolume-joined
      Playback channels: Mono
      Limits: Playback 0 - 127
      Mono: Playback 127 [100%] [0.00dB]
    Simple mixer control 'Speaker Driver',0
      Capabilities: pvolume pvolume-joined pswitch pswitch-joined
      Playback channels: Mono
      Limits: Playback 0 - 3
      Mono: Playback 0 [0%] [6.00dB] [on]
    Simple mixer control 'Mic PGA',0
      Capabilities: cvolume cvolume-joined
      Capture channels: Mono
      Limits: Capture 0 - 119
      Mono: Capture 0 [0%] [0.00dB]
    Simple mixer control 'ADC',0
      Capabilities: cvolume cvolume-joined cswitch cswitch-joined
      Capture channels: Mono
      Limits: Capture 0 - 64
      Mono: Capture 24 [38%] [-8.00dB] [off]
    Simple mixer control 'ADC Fine',0
      Capabilities: cvolume cvolume-joined
      Capture channels: Mono
      Limits: Capture 0 - 4
      Mono: Capture 4 [100%] [0.40dB]
    Simple mixer control 'DAC',0
      Capabilities: pvolume
      Playback channels: Front Left - Front Right
      Limits: Playback 0 - 175
      Mono:
      Front Left: Playback 127 [73%] [0.00dB]
      Front Right: Playback 127 [73%] [0.00dB]
    Simple mixer control 'DAC Left Input',0
      Capabilities: enum
      Items: 'Off' 'Left Data' 'Right Data' 'Mono'
      Item0: 'Left Data'
    Simple mixer control 'DAC Right Input',0
      Capabilities: enum
      Items: 'Off' 'Right Data' 'Left Data' 'Mono'
      Item0: 'Right Data'
    Simple mixer control 'HP Analog',0
      Capabilities: pvolume
      Playback channels: Front Left - Front Right
      Limits: Playback 0 - 127
      Mono:
      Front Left: Playback 127 [100%] [0.00dB]
      Front Right: Playback 127 [100%] [0.00dB]
    Simple mixer control 'HP Driver',0
      Capabilities: pvolume pswitch
      Playback channels: Front Left - Front Right
      Limits: Playback 0 - 9
      Mono:
      Front Left: Playback 9 [100%] [9.00dB] [off]
      Front Right: Playback 9 [100%] [9.00dB] [off]
    Simple mixer control 'HP Left',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [off]
    Simple mixer control 'HP Right',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [off]
    Simple mixer control 'MIC1LM M-Terminal',0
      Capabilities: enum
      Items: 'Off' 'FFR 10 Ohm' 'FFR 20 Ohm' 'FFR 40 Ohm'
      Item0: 'Off'
    Simple mixer control 'MIC1LM P-Terminal',0
      Capabilities: enum
      Items: 'Off' 'FFR 10 Ohm' 'FFR 20 Ohm' 'FFR 40 Ohm'
      Item0: 'Off'
    Simple mixer control 'MIC1LP P-Terminal',0
      Capabilities: enum
      Items: 'Off' 'FFR 10 Ohm' 'FFR 20 Ohm' 'FFR 40 Ohm'
      Item0: 'Off'
    Simple mixer control 'MIC1RP P-Terminal',0
      Capabilities: enum
      Items: 'Off' 'FFR 10 Ohm' 'FFR 20 Ohm' 'FFR 40 Ohm'
      Item0: 'Off'
    Simple mixer control 'Output Left From Left DAC',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [off]
    Simple mixer control 'Output Left From MIC1LP',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [off]
    Simple mixer control 'Output Left From MIC1RP',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [off]
    Simple mixer control 'Output Right From MIC1RP',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [off]
    Simple mixer control 'Output Right From Right DAC',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [off]
    

    Here is the aplay -l output

    **** List of PLAYBACK Hardware Devices ****
    card 0: BeagleBoardX15 [BeagleBoard-X15], device 0: davinci-mcasp.0-tlv320aic31xx-hifi tlv320aic31xx-hifi-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: H58040000encode [HDMI 58040000.encoder], device 0: HDMI 58040000.encoder snd-soc-dummy-dai-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    

    Adding #define DEBUG in tlv320aic31xx.c file I'm getting below output 

    dmesg | grep tlv
    
    [ 7396.675807] tlv320aic31xx-codec 0-0018: ## aic31xx_hw_params: width 16 rate 44100
    [ 7396.675820] tlv320aic31xx-codec 0-0018: Can not produce exact bitclock
    [ 7396.686734] tlv320aic31xx-codec 0-0018: pll 4.4100/1 dosr 100 n 4 m 5 aosr 100 n 4 m 5 bclk_n 15
    [ 7396.686859] tlv320aic31xx-codec 0-0018: ## aic31xx_set_bias_level: 1 -> 2
    [ 7396.686865] tlv320aic31xx-codec 0-0018: codec clock -> on (rate 44100)
    [ 7396.700297] tlv320aic31xx-codec 0-0018: ## aic31xx_set_bias_level: 2 -> 3
    [ 7409.634198] tlv320aic31xx-codec 0-0018: ## aic31xx_set_bias_level: 3 -> 2
    [ 7409.634589] tlv320aic31xx-codec 0-0018: ## aic31xx_set_bias_level: 2 -> 1
    [ 7409.634597] tlv320aic31xx-codec 0-0018: codec clock -> off

  • jigarp said:

    We have updated aic31xx_divs structure as per below

    1
    2
    {12500000, 44100, 7, 2253, 128, 8, 2, 128, 8, 2},
    {20000000, 44100, 4, 4100, 100, 4, 5, 100, 4, 5},

    jigarp said:
    [ 7396.675807] tlv320aic31xx-codec 0-0018: ## aic31xx_hw_params: width 16 rate 44100
    [ 7396.675820] tlv320aic31xx-codec 0-0018: Can not produce exact bitclock
    [ 7396.686734] tlv320aic31xx-codec 0-0018: pll 4.4100/1 dosr 100 n 4 m 5 aosr 100 n 4 m 5 bclk_n 15

    Seems that AIC3100 codec can not produce the correct bitclock from 20MHz MCLK input. To verify this, you can attach a scope on the AIC3100 clock pins (MCLK, WCLK, BCLK) and check what frequency you have there. On MCLK you should have 20MHz, on WCLK you should have 44.1KHz, and on BCLK you should have 1.4112 MHz.

    If your AIC3100 codec clock pins (WCLK and BCLK) do not have the proper values, you need to check your 20MHz driver update with the Audio team in Audio e2e forum.

    Regards,
    Pavel

  • Hello Pavel,

    Here i'm getting 20 Mhz on MCLK pin

    44.1 KHz on WCLK pin

    1.47 MHz on BCLK pin

    Regards,

    Jigar

  • jigarp said:
    1.47 MHz on BCLK pin

    This doesn't seems to be correct. From what I understand, you need to have 1.4112 MHz on that pin. Seems that AIC3100 codec can not produce the correct bit clock (1.4112MHz) output from 20MHz MCLK input. You need to check this with AIC31x codec experts in Audio forum.

    You might also check what frequency your have on BCLK codec clock pin at rate 44.1KHz on TI AM572x EVM or X15 board, and compare the result with your custom board.

    If you have further questions related to AM57x McASP module, please let me know.

    Regards,
    Pavel