前面简单讲解了WM8960语音芯片工作方式,WM8960做master,之前参数配置ADC/DAC采样速率的是44.1K,有点问题,现在改为16K,下面会解释为什么要改成16K。
WM8960参数配置如下:注意录音时关掉内部路径,否则会有杂音。
#ifdef ALOOPBACK //先关掉内部路径播放 0x2d,0x080, //Left Input Boost Mixer to Left Output Mixer 0x2e,0x080, //Right Input Boost Mixer to Right Output Mixer #endif
//WM8960 slave mode // MCLK = 24MHz, SYSCLK = 12.288MHz, // PLL mode is fractional, MCLK div 2 const u16 wm8960_reg_master[]= { 0x0f,0x000, 0x19,0x17e, 0x1a,0x1e1, 0x2f,0x03c, 0x34,0x038, 0x35,0x031, 0x36,0x026, 0x37,0x0e6, 0x04,0x0dd, //ADC/DAC 采样速率12.288/(3*256) = 16KHz 0x08,0x00c, 0x20,0x138, 0x21,0x138, 0x2b,0x000, 0x2c,0x000, 0x00,0x157, 0x01,0x157, 0x05,0x000, 0x06,0x000, 0x07,0x042, //bit6=1, Enable master mode; bit[1:0]=10,I2S Format;bit[3:2]=00,16 bits 0x18,0x004, 0x30,0x000, 0x02,0x163,//179,// //LOUT1 Volume 0x03,0x163,//0x179,//ROUT1 Volume #ifdef DLOOPBACK //不开LOOPBACK 0x09,0x001, #endif 0x22,0x100, //Enable Left DAC to Left Output Mixer 0x25,0x100, //Enable Right DAC to Right Output Mixer #ifdef ALOOPBACK //先关掉内部路径播放 0x2d,0x080, //Left Input Boost Mixer to Left Output Mixer 0x2e,0x080, //Right Input Boost Mixer to Right Output Mixer #endif };