AM623: BCLK and WCLK Stop When Audio Playback Stops

Part Number: AM623
Other Parts Discussed in Thread: TAS2563,

Tool/software:

Hello Team,

I am using the AM623 platform with the TAS2563 audio codec. I am encountering an issue where the BCLK and WCLK clocks are active during audio playback but stop when the playback ends. This causes a TDM clock error on the device.

I need the clocks (BCLK and WCLK) to remain active at all times to avoid this issue. Could you please assist me in resolving this?

Here’s the link to a related ticket I created earlier: TAS2563 TDM Clock Error - No Audio Played.

Thank you!

  • Hi Sakshi,

    I looked your interactions with Ivan on the other thread. Upon seeing your device tree changes, can you add the below line and see if the BCLK and WCLK remain active: the main change is system-clock-direction-out; 

    Below is a sample device tree expecting MCLK to be 25MHz.

    sound_master: simple-audio-card,cpu {
    sound-dai = <&mcaspx>;
    bitclock-master;
    frame-master;
    system-clock-frequency = <25000000>;
    system-clock-direction-out

    Let me know how it goes with this change.

    Best Regards,

    Suren

  • Hi Suren,

    Thankyou for your quick response. I tried adding this property, but the clock still stops when playback ends.

    This is my current devicetree configuration:

          main_mcasp2_pins_default: main-mcasp2-pins-default {
                    pinctrl-single,pins = <
                            AM62X_IOPAD(0x0178, PIN_INPUT, 2) /* (AC20) RGMII2_TD3.MCASP2_ACLKX */
                            AM62X_IOPAD(0x0174, PIN_INPUT, 2) /* (AD21) RGMII2_TD2.MCASP2_AFSX */
                            AM62X_IOPAD(0x018c, PIN_INPUT, 2) /* (AC21) RGMII2_RD2.MCASP2_AXR0 */
                            AM62X_IOPAD(0x0170, PIN_OUTPUT, 5)/* (AA18) RGMII2_TD1.MCASP2_AXR8 */
                            AM62X_IOPAD(0x016c, PIN_INPUT, 7) /* (Y18)  RGMII2_TD0.GPIO0_89 */
                    >;
            };     
    
    
          codec_audio: sound {
                    compatible = "simple-audio-card";
                    simple-audio-card,name = "AM623-GTC700C";
                    simple-audio-card,widgets =
                            "Speaker",      "Internal Speaker",
                            "Microphone",   "Internal Mic";
                    simple-audio-card,routing =
                            "Internal Speaker",     "OUT",
                            "DMIC",                 "Internal Mic";
                    simple-audio-card,format = "i2s";
                    simple-audio-card,bitclock-master = <&sound_master>;
                    simple-audio-card,frame-master = <&sound_master>;
                    simple-audio-card,mclk-fs = <256>;
                    simple-audio-card,bitclock-inversion;
    
                    sound_master: simple-audio-card,cpu {
                            sound-dai = <&mcasp2>;
                            system-clock-frequency = <12288000>;
                            system-clock-direction-out;
                            dai-tdm-slot-num = <2>;
                            dai-tdm-slot-width = <16>;
                    };
    
                    simple-audio-card,codec {
                            sound-dai = <&tas2563>;
                    };
            };
    
    
           tas2563: tas2563@4c{
                    status = "okay";
                    reg = <0x4c>;
                    compatible = "ti,tas2563";
                    #sound-dai-cells = <0>;
                    ti,imon-slot-no = <0>;
                    ti,vmon-slot-no = <0>;
                    ti,asi-format = <0>;
                    reset-gpios = <&main_gpio0 89 GPIO_ACTIVE_HIGH>;
            };
    
    &mcasp2 {
            status = "okay";
            #sound-dai-cells = <0>;
    
            pinctrl-names = "default";
            pinctrl-0 = <&main_mcasp2_pins_default>;
    
            op-mode = <0>;          /* MCASP_IIS_MODE */
            tdm-slots = <2>;
    
            assigned-clock-rates = <12288000>;
            serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
                   2 2 1 0
            >;
            tx-num-evt = <32>;
            rx-num-evt = <32>;
    };
    

  • Hi Sakshi,

    The Device tree changes looks good to me.

    Why would you want the BCLK and WCLK to be active and not stopped after the playback ends?

    They are generally set in context of stream running so when stream stops it may not hold the same context.

    Best Regards,

    Suren

  • Hi Suren,

    If BCLK and WCLK goes low, the device shows TDM clock error and we are also not able to hear any sound, as we discussed in the audio forum, they suggested the clock should always be active, it should not go low when the playback stops.

  • Hi Sakshi,

    Can you change the ACLK and AFSX pinmux controls as PIN_OUTOUT instead of PIN_INPUT as CPU is acting as sound master.

    Let me know if this solves the problem

    Best Regards,

    Suren

  • Hi Suren,

    I tried already updating the pin configuration for ACLK and AFSX to PIN_OUTPUT, but it doesn't have any affect.

  • Hi Suren, Could you please suggest what else changes i can try to keep the clock active all the time?

  • Hi Sakshi,

    I am on business travel till next weekend. Will only be able to try and play on my EVM when I get back. 

    In the meantime, Can you share the BCLK and WCLK waveforms before, while playing and after the playback stops. 

    The clocks should be present before the device comes out of shutdown mode, otherwise it will detect TDM clock error.

    Best Regards,

    Suren

  • Hi Suren, 

    Below are the bclk and wclk waveforms:

    bclk before aplay:(the voltage level is not perfect as it should be either high or low, but once it starts playing bclk and wclk shows 3.3V level as expected)

    wclk before aplay:

    bclk while aplay:

    wclk while aplay:

     

    once it stops playing, we donot get any clock, as in the before aplay waveform images.

    These are some logs i am getting from the driver which shows the clock goes 0 when aplay stops:

    tasdevice-codec 3-004c: firmware: direct-loading firmware tas2562-1amp-reg.bin
    tasdevice-codec 3-004c: tasdev: regbin_ready start
    tasdevice-codec 3-004c: nconfig = 8
    tasdevice-codec 3-004c: img_sz = 1528 total_config_sz = 1236 offset = 292
    tasdevice-codec 3-004c: Firmware init complete
    
    tasdevice-codec 3-004c: tasdevice_set_dai_sysclk: clk_id = 0, freq = 12288000, CLK direction IN
    tasdevice-codec 3-004c: tasdevice_hw_params: Playback
    tasdevice-codec 3-004c: tasdevice_hw_params: BCLK rate = 1536000 Channel = 2Sample rate = 48000 slo            t width = 16
    tasdevice-codec 3-004c: powercontrol_routine:1204: enter
    tasdevice-codec 3-004c: select_cfg_blk: profile_conf_id = 1
    tasdevice-codec 3-004c: select_cfg_blk: conf 1, block type:PRE_POWER_UP         device idx = 0x01
    tasdevice-codec 3-004c: powercontrol_routine:1213: leave
    tasdevice-codec 3-004c: select_cfg_blk: profile_conf_id = 1
    tasdevice-codec 3-004c: select_cfg_blk: conf 1, block type:PRE_SHUTDOWN         device idx = 0x00
    tasdevice-codec 3-004c: tasdevice_set_dai_sysclk: clk_id = 0, freq = 0, CLK direction IN
    
    tasdevice-codec 3-004c: tasdevice_set_dai_sysclk: clk_id = 0, freq = 12288000, CLK direction IN
    tasdevice-codec 3-004c: tasdevice_hw_params: Playback
    tasdevice-codec 3-004c: tasdevice_hw_params: BCLK rate = 1536000 Channel = 2Sample rate = 48000 slo            t width = 16
    tasdevice-codec 3-004c: powercontrol_routine:1204: enter
    tasdevice-codec 3-004c: select_cfg_blk: profile_conf_id = 1
    tasdevice-codec 3-004c: select_cfg_blk: conf 1, block type:PRE_POWER_UP         device idx = 0x01
    tasdevice-codec 3-004c: powercontrol_routine:1213: leave
    tasdevice-codec 3-004c: select_cfg_blk: profile_conf_id = 1
    tasdevice-codec 3-004c: select_cfg_blk: conf 1, block type:PRE_SHUTDOWN         device idx = 0x00
    tasdevice-codec 3-004c: tasdevice_set_dai_sysclk: clk_id = 0, freq = 0, CLK direction IN
    

  • Hi Suren,

    Is there any update on this?

  • Hi Sakshi,

    I am on business travel, will be able to verify it on my EVM next week when I am back in office.

    Also, can you use k3conf utility to dump clocks to see if the clocks related to MCASP change during playback/ no-playback scenarios?

    Can you dump the MCASP registers (pertaining to AHCLK/ACLKX) to see the values before and after as well.

    Apologies for the delay.

    Best Regards,

    Suren

  • Hi Suren,

    I hope you're back now. Could you please help us to resolve this issue? we are not able to resolve it yet.

  • Hi Sakshi,

    Based on my internal discussion, the McASP in Linux will only generate clocks when a user launches an application(arecord/aplay/gstreamer). Are there any other devices on your board that are capable of being clock masters? On TI EVMs, we usually configure the McASP as a slave. 

    Also, if I understand correctly, you are able to hear audio when you start aplay and not able to hear audio after the BCLK/WCLK gets stopped due to TDM error. 

    Best Regards,

    Suren

  • Hi Suren,

    In our setup we are using codec as slave. We are not able to hear any sound from the starting. Once the playback ends, and bclk/wclk stops, it shows tdm clock error.

    Also, I saw some similar query where the user wanted mcasp as master and codec as slave. I think it's somewhat related to what we also want. https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1272002/am623-audio_ext_refclk1-input/4844633#4844633. were you able to provide a solution for this?

  • Hi Sakshi, 

    Can you share the output of this command on your board: k3conf dump clocks | grep MCASP 

    Have you tried to play with ALSA Mixer controls to see if audio plays fine?

    Best Regards,

    Suren