i2c_data[0] = CLK_CONTROL_REG;
#if 0 /* determine sample rate */
if(sample_rate <= 8000)
i2c_data[1] = SR_8KHZ | MCLK_64_FS; else if(sample_rate <= 16000)
i2c_data[1] = SR_16KHZ | MCLK_64_FS; else if(sample_rate <= 32000) i2c_data[1] = SR_32KHZ | MCLK_64_FS; else if(sample_rate <= 48000) i2c_data[1] = SR_441_48KHZ | MCLK_64_FS; else#endif
i2c_data[1] = 0x6C;//SR_441_48KHZ | MCLK_256_FS; //0110 1100
//i2c_data[1] = SR_441_48KHZ | MCLK_64_FS; //i2c_data[1] = SR_32KHZ | MCLK_64_FS; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
i2c_data[0] = SYS_CONTROL_REG;
i2c_data[1] = 0xA0; /* Reg3: , Value = 1010 0000 */; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
i2c_data[0] = SERIAL_DATA_REG;
i2c_data[1] = 0x05; /* Reg4: , 24bit I2s */; //i2c_data[1] = 0x03; /* Reg4: , 16bit I2s */; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
i2c_data[0] = SYS_CONTROL2_REG;
i2c_data[1] = 0x04; /* Reg5: , 2.1 mode(2SEL + 1BTL) */; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
i2c_data[0] = SOFT_MUTE_REG;
i2c_data[1] = 0x00; /* Reg6: , ALL channel unmute */; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
i2c_data[0] = MASTER_VOL_CONTROL;
i2c_data[1] = 0x30; /* 11db (0:0x30)-(24:0x00)*/ g_Master_Vol = 0x30;
ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}#if 1
i2c_data[0] = CHANNEL1_VOL_CONTROL;
i2c_data[1] = 0x30; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
i2c_data[0] = CHANNEL2_VOL_CONTROL;
i2c_data[1] = 0x30; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
i2c_data[0] = CHANNEL3_VOL_CONTROL;
i2c_data[1] = 0x30; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}#endif
#if 1 //2.1
/*ret = I2C_write(ADDR_WRITE, R07_DATA, 5);
if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
} ret = I2C_write(ADDR_WRITE, R05_DATA, 5);
if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
} */
i2c_data[0] = 0x05;
i2c_data[1] = 0x40; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
i2c_data[0] = 0x1B;
i2c_data[1] = 0x00; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
i2c_data[0] = 0x1A;
i2c_data[1] = 0x8F; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
i2c_data[0] = 0x05;
i2c_data[1] = 0x04; ret = I2C_write(ADDR_WRITE, i2c_data, 2); if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
#endif ret = I2C_write(ADDR_WRITE, R21_DATA, 5);
if (ret == I2C_ERROR)
{
i2c_suc = FALSE;
}
Andrew Wu:
建议到音频版块发帖,会有音频工程师负责解答,谢谢!
Fabian Zhang:
Hi Suddy,
你是在自己的板子还是TI EVM上测试的?用附件的配置试一下.