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.

CCS/TLV320DAC3101: The distortion of the output signal of TLV320DAC3101

Part Number: TLV320DAC3101

Tool/software: Code Composer Studio

Our products use DAC3101, the output signal distortion is very large, to 1.86%.

A foreign recorder ZOOM H6, distortion is only 0.0012%.

I use a 44.1k sample rate 1kHz sine wave wav file, play on ZOOM H6, and use audio analyzer AP ATS-2 to test the distortion of 0.0012%. (this shows that the wav file is normal. )

Using the same wav file to play on our products, the AP ATS-2 test has a very high distortion, to 1.86%.

What's the reason, please?

Processing Block uses PRB_7, and IIR uses default parameters,

You've also tried using PRB_1, using default parameters,

As a result, the distortion is the same.

DAC3101 tuning has been tested (the right part of the picture below) no problem.

Test method is: input signals from AIN1 and AIN2, signal routing is also set, the two inputs for the signal source, and other signal source is set to disconnect, test the output signal. Distortion 0.014%.

Also check the I2S control signal, the left part of the picture below, the timing of the signal is correct, using the standard I2S mode.

  • Hi Yong,

    Welcome to e2e.
    Could you share your register settings? What are your settings for gain and attenuation stages?
    By distortion you mean THD+N? Where are you measuring this, Is it at Class-D outputs?

    Best regards,
    -Ivan Salazar
    Audio Applications Engineer - Low Power Audio & Actuators
  • void tlv320_setup(void)
    {
    // uint8_t eq_id;
    //
    // eq_id = sample_rate/44100;
    // switch (eq_id) {
    // case 0:
    // case 1:eq_id = 0; break;
    // case 2:eq_id = 1; break;
    // case 3:
    // case 4:eq_id = 2; break;
    // default:eq_id = 2; break;
    // }

    // step 1 初始化起始指针
    tlv320_write_reg(0x00, 0x00); // 设置寄存器页为PAGE 0
    tlv320_write_reg(0x01, 0x01); // 软复位

    // step 2 编程时钟设置
    tlv320_write_reg(0x04, 0x03); // PLL_clkin = MCLK, CODEC_clkin = PLL_CLK
    tlv320_write_reg(0x06, 0x08); // J = 8
    tlv320_write_reg(0x07, 0x00); // D[13:8]=0
    tlv320_write_reg(0x08, 0x00); // D[7:0]=0
    tlv320_write_reg(0x05, 0x91); // 给PLL上电,且P=1,R=1
    tlv320_write_reg(0x0B, 0x88); // 给NDAC上电,并设置为8
    tlv320_write_reg(0x0C, 0x82); // 给MDAC上电,并设置为2

    // 特别注意:使用A型滤波器时D0SR必须是2的倍数,使用B型时D0SR必须是4的倍数,使用C型时D0SR必须是8的倍数
    tlv320_write_reg(0x0D, 0x00); // D0SR[9:8]=0
    tlv320_write_reg(0x0E, 0x80); // D0SR[7:0]=128

    tlv320_write_reg(0x1B, 0x30); // 标准I2S格式,32bit字宽,从机模式
    tlv320_write_reg(0x1C, 0x00); // 数据延迟0个BCLK

    // tlv320_write_reg(0x3C, 0x0B); // 选择处理模块PRB_P11
    // tlv320_write_reg(0x3C, 0x01); // 选择处理模块PRB_P1
    tlv320_write_reg(0x3C, 0x04); // 选择处理模块PRB_P4
    // tlv320_write_reg(0x3C, 0x07); // 选择处理模块PRB_P7
    // tlv320_set_eq(96000,0);//音效,正常-----------------------------------

    // 音效设置
    // tlv320_write_reg(0x00, 0x08); // 跳到寄存器页PAGE 8
    // tlv320_write_reg(0x01, 0x04); // 使能自适应滤波器
    //
    // // 写左声道参数
    // tlv320_write_regs(0x02, (uint8_t*)eq_coeff[eq_id][eq_type], 60);
    // // 写右声道参数
    // tlv320_write_regs(0x42, (uint8_t*)eq_coeff[eq_id][eq_type], 60);
    // // 切换Buffer
    // tlv320_write_reg(0x01, 0x05);
    //
    // tlv320_write_reg(0x00, 0x0C); // 跳到寄存器页PAGE 12
    // // 再次写左声道参数
    // tlv320_write_regs(0x02, (uint8_t*)eq_coeff[eq_id][eq_type], 60);
    // // 再次写右声道参数
    // tlv320_write_regs(0x42, (uint8_t*)eq_coeff[eq_id][eq_type], 60);

    tlv320_write_reg(0x00, 0x00); // 返回寄存器页PAGE 0

    tlv320_write_reg(0x74, 0x00); // 禁用DAC音量控制引脚

    // step 3 编程模拟模块
    tlv320_write_reg(0x00, 0x01); // 跳到寄存器页PAGE 1

    tlv320_write_reg(0x1F, 0x04); // 编程通用模式电压,默认1.35V
    tlv320_write_reg(0x21, 0x4E); // 耳机设置,Power on = 1.22s, step time = 3.9ms
    tlv320_write_reg(0x23, 0x44); // DAC路由输出:LDAC->HPL,RDAC->HPR 0100 0100
    // tlv320_write_reg(0x23, 0x22); // DAC路由输出:LDAC->HPL,RDAC->HPR 0010 0010

    tlv320_write_reg(0x28, 0x06); // HPL禁止静音,输出 0dB
    tlv320_write_reg(0x29, 0x06); // HPR禁止静音,输出 0dB
    // tlv320_write_reg(0x28, 0x36); // HPL禁止静音,输出 6dB
    // tlv320_write_reg(0x29, 0x36); // HPR禁止静音,输出 6dB

    // 喇叭/LINE OUT增益,bit4:bit3 = 00,6dB; = 01,12dB; = 10,18dB; = 11,24dB;
    tlv320_write_reg(0x2A, 0x04 | (LINE_OUT_GAIN<<3)); // D类左输出增益 LINE_OUT_GAIN = 0x00
    tlv320_write_reg(0x2B, 0x04 | (LINE_OUT_GAIN<<3)); // D类右输出增益

    tlv320_write_reg(0x1F, 0xC4); // HPL和HPR上电
    tlv320_write_reg(0x20, 0xC6); // D类驱动上电

    // 模拟音量,0x80+N,N的单位是-0.5,如N=18,则输出为-9dB
    tlv320_write_reg(0x24, 0x80 | 0); // 使能HPL输出模拟音量,set = -0dB
    tlv320_write_reg(0x25, 0x80 | 0); // 使能HPR输出模拟音量,set = -0dB

    // tlv320_write_reg(0x26, 0x80 | 12); // 使能D类左声道输出模拟音量,set = -6dB
    // tlv320_write_reg(0x27, 0x80 | 12); // 使能D类右声道输出模拟音量,set = -6dB
    tlv320_write_reg(0x26, 0x80 | 0); // 使能D类左声道输出模拟音量,set = -0dB
    tlv320_write_reg(0x27, 0x80 | 0); // 使能D类右声道输出模拟音量,set = -0dB

    // step 4 给DAC上电
    tlv320_write_reg(0x00, 0x00); // 跳到寄存器页PAGE 0

    // tlv320_write_reg(0x3F, 0xD4); // 给DAC左声道上电.软步进使能0xD4 = 1101 0100
    tlv320_write_reg(0x3F, 0xFC); // 给DAC左声道上电.软步进使能 0xFC = 1111 1100


    // DAC前级音量
    tlv320_write_reg(0x40, 0x00); // 关闭DAC左右声道静音功能
    // tlv320_write_reg(0x40, 0x0C); // DAC左右声道静音

    //R65,R66取值范围48~-127
    tlv320_write_reg(0x41, 0x00);// DAC左声道增益,=0时为0dB,步进0.5dB
    tlv320_write_reg(0x42, 0x00);// DAC右声道增益,=0时为0dB,步进0.5dB

    // DAC后级音量(LineOut)
    // tlv320_write_reg(0x00, 0x01); // 跳到寄存器页PAGE 1
    // //R36,R37取值范围0x80 | 0~127前面已经写
    // tlv320_write_reg(0x24, 0x80 | 0); // HPL衰减0dB
    // tlv320_write_reg(0x25, 0x80 | 0); // HPR衰减0dB
    // // R40,R41 前面已经写
    // tlv320_write_reg(0x28, 0x06); // HPL禁止静音,输出 0dB
    // tlv320_write_reg(0x29, 0x06); // HPR禁止静音,输出 0dB

    // DAC后级音量(Speaker)
    // tlv320_write_reg(0x00, 0x01); // 跳到寄存器页PAGE 1
    // //R38,R39取值范围0x10 | 0~127 前面已经写
    // tlv320_write_reg(0x26, 0x00 | 0x00); // SPL静音并衰减0dB
    // tlv320_write_reg(0x27, 0x00 | 0x00); // SPR静音并衰减0dB
    // //R42,R43前面已经写
    // tlv320_write_reg(0x2A, 0x04 | (LINE_OUT_GAIN<<3)); // D类左输出增益
    // tlv320_write_reg(0x2B, 0x04 | (LINE_OUT_GAIN<<3)); // D类右输出增益

    // 音量设置
    // tlv320_write_reg(0x41, 0xF4);// -6dB tlv320_write_reg(0x41, 0xD4); // DAC左声道增益-22dB
    // tlv320_write_reg(0x42, 0xF4);// -6dB tlv320_write_reg(0x42, 0xD4); // DAC右声道增益-22dB
    // 使能音量输出
    // tlv320_write_reg(0x40, 0x00); // 关闭DAC左右声道静音功能
    }