Part Number:TLV320AIC3107
TI的工程师,你们好,我们现在正在开发此芯片的耳机喇叭切换功能,通过读取耳机检测寄存器的值来打开或者关闭喇叭,但是有一个奇怪的问题是这颗芯片在上电的一段时间内不论是都带着耳机,如果不做拔插耳机的动作,该耳机寄存器内的值永远认为是有耳机存在的。这与我们使用逻辑出现相悖之处,希望贵司给予帮助,谢谢
void tlv320set() { // am_gpio_pin_cfg(PIO0_27,AM_GPIO_OUTPUT_INIT_LOW); // MyDelayMS(300); // am_gpio_set(PIO0_27,AM_GPIO_LEVEL_HIGH); uint8_t a = 0x80; am_i2c_write(&__i2c_tlv320,1,&a,1);//Èí¼þ¸´Î» GDelay(2000); a = 0x32; am_i2c_write(&__i2c_tlv320,102,&a,1);//CLKDIVIN use MCLK am_i2c_read(&__i2c_tlv320,102,&a,1); a = 0x18; am_i2c_write(&__i2c_tlv320,3,&a,1);//PLL disable and select Q value am_i2c_read(&__i2c_tlv320,3,&a,1); a = 1; am_i2c_write(&__i2c_tlv320,101,&a,1); //CLKIN use CLKDIV_OUT am_i2c_read(&__i2c_tlv320,101,&a,1); a = 0xa; am_i2c_write(&__i2c_tlv320,7,&a,1); //FSref = 48KHz am_i2c_read(&__i2c_tlv320,7,&a,1); a = 0x00; am_i2c_write(&__i2c_tlv320,2,&a,1); //sample am_i2c_read(&__i2c_tlv320,2,&a,1); a = 0x00; am_i2c_write(&__i2c_tlv320,8,&a,1); //SLAVE mode? am_i2c_read(&__i2c_tlv320,8,&a,1); a = 0x20; am_i2c_write(&__i2c_tlv320,9,&a,1); // i2s mode 24bit ? am_i2c_read(&__i2c_tlv320,9,&a,1); a = 0x0f; am_i2c_write(&__i2c_tlv320,12,&a,1); //audio codec diital filter control register am_i2c_read(&__i2c_tlv320,12,&a,1); a = 0x80; am_i2c_write(&__i2c_tlv320,13,&a,1);a = 0xd8; am_i2c_write(&__i2c_tlv320,14,&a,1);//Headset Configuration Register OUT AC-COUPLED //¶ú»ú²åÈë¼ì²â a = 0xc0; am_i2c_write(&__i2c_tlv320,25,&a,1); am_i2c_read(&__i2c_tlv320,25,&a,1); //0xc2 a = 0xc0; am_i2c_write(&__i2c_tlv320,37,&a,1); //left and right DAC power on am_i2c_read(&__i2c_tlv320,37,&a,1); a = 0x6; am_i2c_write(&__i2c_tlv320,38,&a,1); a = 0x01; am_i2c_write(&__i2c_tlv320,41,&a,1); ///*out path select*/ am_i2c_read(&__i2c_tlv320,41,&a,1); a = 0x78; am_i2c_write(&__i2c_tlv320,42,&a,1);//*out path select DTS2014123002762 change delay time from 2s to 200ms* am_i2c_read(&__i2c_tlv320,42,&a,1); a = 0x0; am_i2c_write(&__i2c_tlv320,43,&a,1); /*left DAC not muted*/ am_i2c_read(&__i2c_tlv320,43,&a,1); a = 0x0; am_i2c_write(&__i2c_tlv320,44,&a,1); /*right DAC not muted*/ am_i2c_read(&__i2c_tlv320,44,&a,1); a = 0x80; am_i2c_write(&__i2c_tlv320,47,&a,1); //DAC_L1 to HPLOUT Volume Control Register am_i2c_read(&__i2c_tlv320,47,&a,1);a = 0xd; am_i2c_write(&__i2c_tlv320,51,&a,1); am_i2c_read(&__i2c_tlv320,51,&a,1);//0x0c a = 0x80; am_i2c_write(&__i2c_tlv320,64,&a,1);//DAC_R1 to HPROUT Volume Control Register am_i2c_read(&__i2c_tlv320,64,&a,1); a = 0xd; am_i2c_write(&__i2c_tlv320,65,&a,1); am_i2c_read(&__i2c_tlv320,65,&a,1);//0x0c } uint8_t headdetect = 0; void headsetdetect() {uint8_t a = 0,b = 0; am_i2c_read(&__i2c_tlv320,14,&a,1);if (( a == 0xC8) && (headdetect != 2)) //À®°È¾²Òô { a = 0x91; am_i2c_write(&__i2c_tlv320,86,&a,1); headdetect = 2; } else if ((a == 0xD8) && (headdetect != 3)) //¿ªÆôÀ®°È { a = 0x80; am_i2c_write(&__i2c_tlv320,82,&a,1); a = 0x99; am_i2c_write(&__i2c_tlv320,86,&a,1); a = 0x0c; am_i2c_write(&__i2c_tlv320,73,&a,1); headdetect = 3; } // if ( a == 0xD8 ) // // { // am_i2c_read(&__i2c_tlv320,14,&a,1); // if ( a == 0xC8 ) // { // a = 0x80; // am_i2c_write(&__i2c_tlv320,82,&a,1); // a = 0x99; // am_i2c_write(&__i2c_tlv320,86,&a,1); // a = 0x0c; // am_i2c_write(&__i2c_tlv320,73,&a,1); // } // } // else if ( a == 0xc8 ) //À®°È¾²Òô // { // am_i2c_read(&__i2c_tlv320,14,&a,1); // if ( a == 0xd8 ) // { // a = 0x91; // am_i2c_write(&__i2c_tlv320,86,&a,1); // } // } }
还有一个问题是如果插入耳机,实际检测值是未插入耳机,与应用是个反逻辑。
Amy Luo:
您好,
首先,不使用的输入管脚建议通过电容接地以防止拾取周围的电磁干扰。
您可以附上耳机插座完整的接线图吗?
建议您看下下面文档,它与耳机检测有关,也适用于TLV320AIC3107。
Headset detection in AIC33 and AIC310x family
,
JIANFENG WEI:
您好,如下为完整的接线图
,
Amy Luo:
您是外接了3种耳机接口吗?
您是通过 Register 14检测的耳机状态吗?您是否查看了 Register 96和 Register 97 D2位值?
或者说您是怎样判断耳机的状态的?