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.

TLV320AIC3262: Configure WCLK

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

Hi,

We are interfacing ASI1 of TLV320AIC3262 to AM5728 on a Video Ip Phone product as shown in the attached image. The MCLK is 22.579MHz (similar to AM5728 EVM). Is it possible to generate WCLK of 16kHz/8kHz frequency with this setup?

When arecord command is used at rate of 16k, the WCLK probed on oscilloscope is 11.025kHz.

  • Hi,

    With MCLK=22.579MHz, you will need to configure the PLL to give 16KHz Fs.

    Here are the steps:

    1. Divide MCLK by 2 using PLL_CLKIN_DIV to give 11.2895MHz
    2. Then, set the respective divider as shown below to get Fs=16KHz.

    You can refer to section 2.7 of this reference document for clock generation/PLL.

    TLV320AIC3262 Applications Reference Guide

    Regards,

  • Hi,

    We configured the audiocodec as master. We also changed the configurations as suggested above in the audiocodec driver.

    Apart from this we also set the following registers:-

     AUDIOCODEC REGISTER SETTING :

    The following registers were set before recording from the mic.

    #ASI config
    /usr/sbin/i2cset -f -y 3 0x18 0x00 0x04

    /usr/sbin/i2cset -f -y 3 0x18 0x0a 0x24

    The following registers were set while recording from the mic.

    /usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
    /usr/sbin/i2cset -f -y 3 0x18 0x0c 0x8c
    /usr/sbin/i2cset -f -y 3 0x18 0x00 0x04
    /usr/sbin/i2cset -f -y 3 0x18 0x0c 0x88

    CLOCKING VERIFICATION BY OSCILLOSCOPE: -

    After the registers mentioned above were set both WCLK and BCLK were probed. Their values came out to be 16Khz and 256Khz 
    respectively.

    ARECORD TO VERIFY THE MICROPHONE : command used to record  is:-

    arecord -r 16000 -f S16_LE test_16.wav

    Then upon playing the test_16.wav using aplay the playback doesn't seem ok. It seems at a lower tempo(speed) and sound is also not clear.

    The command used to play the recorded file is:-

    aplay -r 16000 -f S16_LE  test_16.wav

    PFA the test_16.wav file

     

    Here is the register dumps for Book 0 Page 0, Book 0 Page 4 during recording done using arecord command mentioned above:-

    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: 00 00 30 00 33 00 91 06 14 bb 02 83 8c 00 80 00 ..0.3.???????.?.
    10: 00 00 83 8c 80 00 01 01 0f 80 00 18 6a 20 00 06 ..???.????.?j .?
    20: 1a 00 00 00 66 88 bb 00 00 00 ee 00 c0 60 00 00 ?...f??...?.?`..
    30: 80 00 00 c0 00 00 00 00 00 00 00 00 01 01 00 c0 ?..?........??.?
    40: 02 15 15 80 6c 10 00 05 04 00 00 ee 10 d8 7e e3 ????l?.??..???~?
    50: 00 c2 00 01 01 00 82 b2 5a 00 32 00 00 5a 82 b2 .?.??.??Z.2..Z??
    60: 5a 00 32 00 00 5a 00 00 00 00 00 00 00 00 00 00 Z.2..Z..........
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 03 01 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 ................

    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: 04 20 00 00 00 00 00 01 00 00 24 01 88 a0 00 00 ? .....?..$???..
    10: 00 00 00 00 00 00 00 00 00 00 00 01 84 20 20 00 ...........?? .
    20: 00 00 00 00 00 00 00 00 00 00 00 00 01 20 40 00 ............? @.
    30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    40: 00 04 00 22 20 06 06 22 20 06 06 22 20 00 00 00 .?." ??" ??" ...
    50: 00 00 00 00 00 00 16 02 00 00 00 02 01 00 00 00 ......??...??...
    60: 02 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 ?....?..........
    70: 00 00 00 00 00 00 00 f0 00 00 00 00 00 00 00 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 ................

  • One thing I noticed from the setting is the audio format is DSP, I don't know what the host audio format you are using.

    The settings are for DSP with 16 bit-depth/channel. Normally, it's I2S format and the BCLK will then be 512KHz with 16KHz WCLK for 16-bit depth data.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/6/setting

    Regards.

  • The Following changes have been made in addition to the previous query.same playback problem occurs as previous.Recorded wave file attached here.
    DTS file Changes


    &mcasp3 {
           #sound-dai-cells = <0>;
           assigned-clocks = <&l4per_clkctrl DRA7_MCASP3_CLKCTRL 24>;
           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>;
    };

    sound0: sound0 {
                   compatible = "simple-audio-card";
                   simple-audio-card,name = "BeagleBoard-X15";

                 //simple-audio-card,format = "dsp_b";
                   simple-audio-card,format = "i2s";
                    simple-audio-card,bitclock-master = <&sound0_master>;
                    simple-audio-card,frame-master = <&sound0_master>;
                    //simple-audio-card,bitclock-master = <&cpu_dai>;
                    //simple-audio-card,frame-master = <&cpu_dai>;
                    simple-audio-card,bitclock-inversion;

                   cpu_dai: simple-audio-card,cpu {
                            sound-dai = <&mcasp3>;
                            //clocks = <&clkout2_clk>;
                            //system-clock-id = <MCASP_CLK_HCLK_AUXCLK>;
                            //system-clock-direction-out;
                            //system-clock-frequency=<24000000>;
                    };

                   sound0_master: simple-audio-card,codec {
                            sound-dai = <&tlv320aic3262>;
                            clocks = <&clkout2_clk>;
                            //system-clock-frequency=<22579200>;
                            //system-clock-direction-out;
                    };

    Audio Codec Register Change for I2S :-

    /usr/sbin/i2cset -f -y 3 0x18 0x00 0x04 -->setting B0 Page 4

    /usr/sbin/i2cset -f -y 3 0x18 0x01 0x00 -->i2s Register (B0_P4_R1)

    PFA the recording with the above configuration:- 

    ----------------------------------------------------------------

  • Hi Vishal,

    Is the audio recording still slow? If so then it is almost certainly a problem with the receiver system resampling the data to a lower rate.

    I will forward this to our software team to check the DTS file changes.

    Best regards,
    Jeff McPherson

  • Yes the recording is still slow  ie., (low tempo). Is there any SOC  register that is to be modified ?

  • Hi, 
    Awaiting reply. Could you please provide any insight?

  • Kindly use scope to measure the i2s bck and ws clk, upload the clk waveform here and what's the expected sample rate you want?

  • PFA the wclk and bclk scope waveforms. 

    Expected WCLK / sampling rate is 16KHz only.

    Also PFA the audio file recorded at 16Khz sampling rate whose waveform is what has been attached above.




    Again, on playing this wav file at 16khz sampling rate it plays with a low tempo as  in earlier post too.

    But playing it on PC using audacity with sampling rate 48Khz plays it perfectly fine. Why is there a mismatch ??