Hi there,
I have developped my own script for using the AIC3254. Two micophones are connected as differential on IN1 and IN2. They are amplified and transmitted through the analog bypass to the headphones. An external Clock (16MHz) is driving the MCLK pin. Samplingfrequency is set to 44kHz with the internal dividers. The Codec is acting as a I2C master and streaming the digital samples to a connected MCU. So far everything is working. On the headphones I can hear both microphones and the MCU is showing correct audio data.
As I need to treat the audio stream before transmitting it through I2C I tried to activate the DSP_A. I created a project with nothing else than the I2S interface. Since then the MCU is receiving completely different values which might still be related to an audio signal but are nothing like before. Amplitude is much too high and there are always a few values consecutive with the exact same value. As well the headphones are not working anymore. Only unequal noise comes out of the left and right channel.
I program the CODEC as followed:
- program 'REG_Section_program' from generated .h-file
- program 'miniDSP_A_reg_values' from generated .h-file
- program 'miniDSP_D_reg_values' from generated .h-file
- program 'custom_program' (manually written script)
I would assume that by putting my script at the end that the CODEC should work similar as with only 'custom_program' with the exception that now the DSP part is loaded and used. I cannot understand why this automatic generated script is affecting the previously working script.
Thanks for your help.
jaiv
const reg_value custom_program[] = {
{ 0,0x00}, // Select Page 0
//{ 1,0x01}, // Software Reset
{ 18,0x81}, // NADC value (power up, divider 1)
{ 19,0x86}, // MADC value (power up, divider 6)
{ 20,0x40}, // AOSR value (64)
{ 5,0x00}, // Ensure PLL powered down
{ 11,0x81}, // NDAC value (power up, divider 1)
{ 12,0x86}, // MDAC value (power up, divider 6)
{ 13,0x00}, // DOSR value (64) MSB
{ 14,0x40}, // DOSR value (64) LSB
{ 4,0x00}, // Ensure MCLK used as Clock source
{ 27,0xCC}, // Select LeftJustifiedMode, 16bit, BCLK+WCLK as output
{ 29,0x07}, // Select clock source for BCLK to ADC_MOD_CLK
{ 30,0x82}, // Enable BCLK divider (divider 2)
{ 32,0x00}, // I2S interface settings
{ 33,0x10}, // Select source for WCLK output (ADC_FS)
{ 53,0x12}, // Ensure DOUT is enabled
{ 0,0x01}, // Select Page 1
//{ 61,0xXX}, // Adjust power tune settings (optional)
{ 1,0x08}, // Disable weak AVDD
{ 2,0x01}, // Enable AVDD generation
{ 71,0x32}, // Set the input powerup time to 6.4ms (for ADC)
{123,0x05}, // Force REF charging time to 40ms
{ 20,0x5C}, // Set headphone startup time to 50ms, N = 3, R = 25kOhm
{ 9,0x33}, // Power up headphones driver (L+R) and Mixer (L+R)
{ 0,0x00}, // Select Page 0
{ 81,0xC0}, // Power up ADC converter (L+R)
{ 0,0x01}, // Select Page 1
{ 10,0x40}, // Set Vcm to 0.75 instead of 0.9V, + all Vcm (optional)
{ 51,0x40}, // Power up Mic BIAS (1.25V if Vcm=0.9V)
{ 0,0x00}, // Select Page 0
//{ 61,0x01}, // Selecting Processing block PRB_R1 (optional)
{ 63,0xC0}, // DAC L+R power on, deactivate I2S stream
{ 0,0x01}, // Select Page 1
{ 55,0x40}, // Activate IN1_R with 10kOhm (MAR)
{ 57,0x10}, // Activate IN1_L with 10kOhm (MAR)
{ 52,0x10}, // Activate IN2_L with 10kOhm (MAL)
{ 54,0x10}, // Activate IN2_R with 10kOhm (MAL)
{ 59,0x46}, // Enable Left MicPGA and set gain 35dB(max 47.5dB)
{ 60,0x46}, // Enable Right MicPGA and set gain 35dB(max 47.5dB)
{ 12,0x02}, // Route MAL to HPL
{ 13,0x02}, // Route MAR to HPR
{ 24,0x00}, // Unmute MAL and set gain (0dB)
{ 25,0x00}, // Unmute MAR and set gain (0dB)
{ 0,0x00}, // Select Page 0
{ 82,0x00}, // Unmute ADC (L+R)
{ 0,0x01}, // Select Page 1
{ 16,0x00}, // Unmute headphones driver Left (0dB)
{ 17,0x00}, // Unmute headphones driver right (0dB)
};