TAS2563: TDM clock error & no audio played

Part Number: TAS2563
Other Parts Discussed in Thread: AM623

Tool/software:

Hi Team,

I am working with the TAS2563 codec on the AM623 platform with kernel version 6.6.15.

When I try to play a sample audio file using aplay, I don't receive any error, but there is no audio output.

According to the register dump, B0P0R0x11=0x24, indicating that SBCLK:FSYNC=64 and the sample rate is configured to 48 kHz, which aligns with my setup. However, register B0P0R0x24=0x04, showing a TDM clock error.

Is there anything I could be missing?

while aplay:

$ sudo aplay -D hw:0,0 a1.wav -v
Playing WAVE 'a1.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Mono
Hardware PCM card 0 'AM623-GTC700C' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 1
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 24000
  period_size  : 6000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 6000
  period_event : 0
  start_threshold  : 24000
  stop_threshold   : 24000
  silence_threshold: 0
  silence_size : 0
  boundary     : 6755399441055744000
  appl_ptr     : 0
  hw_ptr       : 0

 
$ amixer
Simple mixer control 'Speaker Digital',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 255
  Mono: 253 [99%] [5.00dB]
Simple mixer control 'Speaker Force Firmware Load',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Speaker Profile Id',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 7 [100%]
$

reg dump while aplay:

$ i2cdump -f -y 3 0x4c
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 20 c6 22 09 02 20 10 f1 02 00 04 05 06    ... ?"?? ???.???
10: 07 24 12 76 01 2e 60 0e 0c 00 fc a6 df ff ff 00    ?$?v?.`??.???...
20: 00 11 00 00 04 00 51 80 00 dc 34 c0 7c 8c c0 a7    .?..?.Q?.?4?|???
30: 99 40 81 34 4b 74 01 00 0d 0c be 58 68 08 10 00    ?@?4Kt?.???Xh??.
40: 76 41 d8 c0 10 21 00 4e ac 4d c0 00 00 00 00 00    vA???!.N?M?.....
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 f0 00 0f 00 00 cc 00 00 00 00 10 98 00    ...?.?..?....??.
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

Device tree configuration:

       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>;
                        dai-tdm-slot-num = <2>;
                        dai-tdm-slot-width = <32>;
                };

                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>;
                ti,left-slot = <0>;
                ti,right-slot = <1>;
        };
        
    &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,

    Do you see the Interrupt flag in register 0x24 trigger only after attempting aplay command?
    Please check the sequence of the playback test. The input clocks should be enabled first and only after that the register 0x02 should be set to 0x00 for Active mode. Do not change to active mode if the input clocks are not running or change its frequency.

    You may also double check that input clocks are stable, if the frequency of these clocks vary too much it would still cause clock error.

    Best regards,
    -Ivan Salazar
    Applications Engineer

  • Hi Ivan,

    I only see TDM clock error while aplay.

    before aplay:

    user@prometheus:~$ i2cdump -f -y 3 0x4c                                       No size specified (using byte-data access)
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 02 00 00 00 00 00 00 00 40 00 00 00 71 cf 54 71    ?.......@...q?Tq
    10: 03 4a 51 6c 2d 6a 86 6f 47 5c 28 f6 16 66 66 66    ?JQl-j?oG\(??fff
    20: 1a 66 66 66 10 00 00 00 17 33 33 33 15 99 99 9a    ?fff?...?333????
    30: 7f ff ff ff 00 00 00 00 00 00 00 00 7f ff ff ff    ?...........?...
    40: 00 00 00 00 00 00 00 00 40 00 00 00 40 00 00 00    ........@...@...
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 20 c4 9c    ............. ??
    60: 02 46 b4 e4 00 00 4b 00 7f fb b6 14 80 04 49 ec    ?F??..K.??????I?
    70: 7f f7 6c 28 00 00 00 00 00 00 00 00 ef 5d 5e 9d    ??l(........?]^?
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    user@prometheus:~$
    

    while aplay:

    user@prometheus:~$ i2cdump -f -y 3 0x4c
    No size specified (using byte-data access)
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 00 00 00 20 c6 22 09 02 20 10 f1 02 00 04 05 06    ... ?"?? ???.???
    10: 07 24 12 76 01 2e 60 0e 0c 00 fc a6 df ff ff 00    ?$?v?.`??.???...
    20: 00 11 00 00 04 00 11 80 00 cc 34 d0 80 8c c0 a7    .?..?.??.?4?????
    30: 99 40 81 34 4b 74 01 00 0d 0c be 58 68 08 10 00    ?@?4Kt?.???Xh??.
    40: 76 41 d8 c0 10 21 00 4e 2c 4e 60 00 00 00 00 00    vA???!.N,N`.....
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    70: 00 00 00 f0 00 0f 00 00 cc 00 00 00 00 10 09 00    ...?.?..?....??.
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    user@prometheus:~$
    
    

    Also, i could only see clocks, when i use aplay.

  • Hi Sakshi,

    I'll try to get someone from our driver expert team to take a look at your log and device tree.

    In the meantime, I've been going through the regdumps you shared and register 0x08 seems odd.
    By default, this register should read 0x4a, however you either read 0x40 before aplay and 0x20 during aplay. Not sure if this is the reason for the device to trigger TDM clock error, but can you confirm if the data slot is 16-bit or 32-bit?

    Is it also possible to get an oscilloscope capture of the clocks being sent to TAS2563? Since you're playing a mono audio file, I'd like to double check there's a proper amount of SBCLK and FSYNC edges.

    Best regards,
    -Ivan Salazar
    Applications Engineer

  • Hi Ivan,

    I've configured it for 32-bit.

    I will provide the oscilloscope capture shortly.

  • Hi Sakshi,

    If the host controller is sending 32-bit slots, then you should adjust the regbin used to configure TAS2563, based on the regdump it is set for 16-bit instead of 32-bit.

    Best regards,
    -Ivan Salazar
    Applications Engineer

  • Hi Ivan,

    Okay let me check this.

    Below are the bclk and wclk captures

    bclk:

    wclk:

  • Hi Sakshi,

    Thanks, the clocks seem OK.
    Let's double check on the slot configuration and see if that helps.

    Best regards,
    -Ivan Salazar
    Applications Engineer

  • Hi Ivan, 

    Yeah, the clocks look okay, but I observed few things, I only get the clocks when I start aplay, also the codec is in active mode (reg 0x02=0x00) even when the clocks are not present. is that fine?

  • Hi Sakshi,

    That is not OK, the device should be active only with input clocks present.
    You may stop the input clocks during no playback; however, you must change between active and SW shutdown accordingly.

    Best regards,
    -Ivan Salazar
    Applications Engineer

  • Hi Ivan, 

    Do I need to make any driver changes for that? since from the initial state, codec remains in the active mode. when i start playing audio using aplay and stop it, then the codec goes to shutdown mode (reg 0x02=0x0e), then again when i start aplay it goes in active mode(0x02=0x00).

    Not sure why the initial state is active.

    Initial state:
    user@prometheus:~$ i2cdump -f -y 3 0x4c
    No size specified (using byte-data access)
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 02 00 00 00 00 00 00 00 40 00 00 00 71 cf 54 71    ?.......@...q?Tq
    10: 03 4a 51 6c 2d 6a 86 6f 47 5c 28 f6 16 66 66 66    ?JQl-j?oG\(??fff
    20: 1a 66 66 66 10 00 00 00 17 33 33 33 15 99 99 9a    ?fff?...?333????
    30: 7f ff ff ff 00 00 00 00 00 00 00 00 7f ff ff ff    ?...........?...
    40: 00 00 00 00 00 00 00 00 40 00 00 00 40 00 00 00    ........@...@...
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 20 c4 9c    ............. ??
    60: 02 46 b4 e4 00 00 4b 00 7f fb b6 14 80 04 49 ec    ?F??..K.??????I?
    70: 7f f7 6c 28 00 00 00 00 00 00 00 00 ef 5d 5e 9d    ??l(........?]^?
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    
    
    While aplay:
    user@prometheus:~$ i2cdump -f -y 3 0x4c
    No size specified (using byte-data access)
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 00 00 00 20 c6 22 09 02 20 10 f1 02 00 04 05 06    ... ?"?? ???.???
    10: 07 24 12 76 01 2e 60 0e 0c 00 fc a6 df ff ff 00    ?$?v?.`??.???...
    20: 00 11 00 00 04 00 11 80 00 cc 34 d0 83 8c 80 aa    .?..?.??.?4?????
    30: 99 40 81 34 4b 74 04 00 0d 0c be 58 68 08 10 00    ?@?4Kt?.???Xh??.
    40: 76 41 d8 c0 10 21 00 4e 2c 4f 00 00 00 00 00 00    vA???!.N,O......
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    70: 00 00 00 f0 00 0f 00 00 cc 00 00 00 00 10 09 00    ...?.?..?....??.
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    
    
    After aplay:
    user@prometheus:~$ i2cdump -f -y 3 0x4c
    No size specified (using byte-data access)
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 00 00 0e 20 c6 22 09 02 20 10 f1 02 00 04 05 06    ..? ?"?? ???.???
    10: 07 7f 12 76 01 2e 60 0e 0c 00 fc a6 df ff ff 00    ???v?.`??.???...
    20: 00 00 80 00 04 00 51 80 00 dc 34 d0 83 8c 40 ab    ..?.?.Q?.?4???@?
    30: 99 40 81 34 4b 74 0c 00 0d 0c be 58 68 08 10 00    ?@?4Kt?.???Xh??.
    40: 76 41 d8 c0 10 21 00 4d ec 4f 00 00 00 00 00 00    vA???!.M?O......
    50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    70: 00 00 00 f0 00 0f 00 00 80 00 00 00 00 10 15 00    ...?.?..?....??.
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    

  • Hi Sakshi,

    Can you share the json file you used to generate the configuration files?
    Not sure if this requires driver changes, I'll get some comments from our driver expert team.

    Best regards,
    -Ivan Salazar
    Applications Engineer

  • Hi Ivan,

    This is the json file i am using: https://git.ti.com/cgit/tas2781-linux-drivers/tas2781-linux-driver/tree/regbin/jsn/tas2563-1amp-reg.json

    Please let me know if i need to make any changes.

  • Hi Sakshi,

    I'll circle this back to the driver experts and get back to you.

    Best regards,
    -Ivan Salazar
    Applications Engineer

  • Hi Ivan,

    Is there any update on this?

    I'm still not able to resolve this issue.

  • Hi Sakshi,

    I've got no feedback yet; I'll check back again.

    Best regards,
    -Ivan Salazar
    Applications Engineer

  • Also fyi, i've added some debug logs in the driver:

    user@prometheus:~$ sudo aplay -D hw:0,0 sample1.wav
    [   38.868930] tasdevice_startup
    [   38.868974] tasdevice_startup: sysclk: 0
    Playing WAVE 'sample1.wav' : Signed 16 bit Little Endian, Rate 4[   38.881839] tas: sysclk freq = 12288000
    8000 Hz, Stereo
    [   38.890993] tas: hw_params: sysclk: 12288000
    [   38.896581] tasdevice_hw_params: fsrate = 48000
    [   38.901244] tasdevice_hw_params: slot_width = 16
    [   38.905991] tasdevice_hw_params: bclkrate = 1536000
    [   45.292083] tas: sysclk freq = 0
    user@prometheus:~$
    

  • Hi Ivan, Hope you're well.

    Did you get any update regarding this issue? We need to get it working on priority. 

    I still have these issues:

    • I still get tdm clock error.
    • The codec is in active mode from the initial point, even when clock is not present (reg 0x02 should be 0x0e). 
    • How can I stop clocks from turning off when the audio is not playing.
    • Is the device-tree changes and the firmware I'm using, correct?

    Thanks.

  • Hi Sakshi,

    I think you'll have to contact the processor vendor to solve the question about not stopping the clocks when not playing audio. That is not related to the amplifier.
    You get the TDM clock error most likely because the device is active while clocks are not present.

    Best regards,
    -Ivan Salazar
    Applications Engineer

  • Hi Ivan, I'm using TI AM623 platform only.

    Could you please confirm if the device tree configuration is correct or i need to modify anything?

  • Hi Sakshi,

    I've asked our team to check on the device tree config.
    Regarding the platform, I mean you may reach to the relevant support team.

    Best regards,
    -Ivan Salazar
    Applications Engineer

  • Hi Ivan, thankyou, I have created a ticket to discuss the clock issue on the processor forum.

    I want to confirm one more thing here, I am also not able to get any audio from the speakers, that could also be because of the tdm clock error only?

  • Hi Sakshi,

    That's right, the moment the device detects clock error it will go into SW shutdown. You can set it back to Active mode manually once the clocks are enabled, this may be a thing to test manually.

    Best regards,
    -Ivan Salazar
    Applications Engineer