Part Number: TAC5112
Hello,
I am trying to work with the TAC5112 codec. I was told to make a new account with a proper email address so hopefully this one from my domain is ok. If not well, what can you do really. I have also seen there is a program you can download to help configure but i requested a few times and was denied, i think because i did not but the evaluation board, i just used my own board. So basically im just looking for some guidance configuring the IC.
I cant seem to get the outputs to work as desired. The inputs and i2s communication seem ok (the host MCU gets good accurate data from the codec) . The i2c communication with the codec to configure it also seems ok and i can write and verify through reading back that the registers are being set as intended.
What i can't seem to get is any signal output on the outputs beyond the configured DC offset. On a scope it looks like the I2S data is there being sent to the codec so I believe it to be a configuration issue.
The inputs are configured as differential.
For the outputs we want output 1 to be configured as stereo single ended and configured to drive headphones.
For output 2 we also want stereo single ended and just configured as a line output.
I want the same data to go to both outputs though. SO from the data sheet is seems this is possible using the DAC mixer. With that in mind, you can see the register/setting data in the attached c code. I added some comments also. The function called to transmit the setting puts 'tac_value' in 'tac_register' via i2c. 'tac_verify' determines whether or not the function will do a read after write to verify the value was written correctly (we are doing this but as stated it does seem like i2c comms is not the issue).
void hope_codec_ctl_port_856_tac5112_init()
{
uint8_t tac_register = 0x00;
uint8_t tac_value = 0x00;
uint32_t tac_value_word = 0x00000000;
uint8_t tac_verify = 2;
//set to page 0.
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//wait at least 2 ms
LL_mDelay(100);
//DEV_MISC_CFG Register
//Wake up the device by writing to P0_R2 to disable sleep mode
tac_register = 0x02;
tac_value = 0x01;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//wait at least 2 ms
LL_mDelay(100);
//PASI_CFG0
//set format to i2s and 16 bits data
tac_register = 0x1a;
tac_value = 0b01000000;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//CH_EN
//enable ins and outs
tac_register = 0x76; //CH_EN Register
tac_value = 0b11001100; //
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//PASI_TX_CH1_CFG
//put pasi tx channel 1 on the appropriate I2S slot (right slot 1)
tac_register = 0x1e;
tac_value = 0b00110000;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//PASI_TX_CH2_CFG
//put pasi tx channel 2 on the appropriate I2S slot (left slot 1)
tac_register = 0x1f;
tac_value = 0b00100000;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//PASI_RX_CH1_CFG
//ch1 is left data say
tac_register = 0x28;
tac_value = 0b00100000;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//PASI_RX_CH2_CFG
tac_register = 0x29;
tac_value = 0b00110000;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
// go to page 1
tac_register = 0x00;
tac_value = 0b00000001;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//MIXER_CFG0
//now turn on the dac asi mixer
tac_register = 0x2c;
tac_value = 0b10000000;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//now change to page 17
tac_register = 0x00;
tac_value = 0b00010001;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//using word program (4 bytes) we need to setup outputs.
//channel 1 goes to LDAC and LADC2
tac_register = 0x08;
tac_value_word = 0x00400040;
hope_codec_ctl_port_program_tac5112_word(tac_register, tac_value_word, tac_verify);
//channel 2 goes to rdac and rdac2
tac_register = 0x10;
tac_value_word = 0x40004000;
hope_codec_ctl_port_program_tac5112_word(tac_register, tac_value_word, tac_verify);
//now change to page 0
tac_register = 0x00;
tac_value = 0b00000000;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//DSP_CFG0
//no biquads adc
tac_register = 0x72;
tac_value = 0b00000000;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//DSP_CFG1
//no biquads dac
tac_register = 0x73;
tac_value = 0b00000000;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//VREF_MICBIAS_CFG
//sets vref_fscale to 2.75V
tac_register = 0x4d;
tac_value = 0b00010000;
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//ADC_CH1_CFG0
//setup adc channel 1
//differential input
//5k input impedance
//ac coupled
//2vrrms fullscale
//audio band
tac_register = 0x50;
tac_value = 0b00000000; //differential mode
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//ADC_CH2_CFG0
//setup adc channel 2
//differential input
//5k input impedance
//ac coupled
//2vrrms fullscale
//audio band
tac_register = 0x55; //ADC_CH2_CFG0
tac_value = 0b00000000; //differential mode
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//OUT1x_CFG0
//setup DAC
//out1 is the headphone output
//input from dac signal chain
//dac1a -> out1p
//dac1b -> out1m
//vcom = .6*vref
tac_register = 0x64;
tac_value = 0b00100100; //
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//OUT1x_CFG1
//hp driver with min 16 ohm
//out_1p configuration for headphone driver se
tac_register = 0x65;
tac_value = 0b01100010; // //headphone driver
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//OUT1x_CFG2
//out_1m configuration for headphone driver
tac_register = 0x66; //OUT1x_CFG2
tac_value = 0b01100000; //headphone driver
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//OUT2x_CFG0
//out2, the line out/effect out
tac_register = 0x6B;
tac_value = 0b00100100; //
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//OUT2x_CFG1
tac_register = 0x6C;
tac_value = 0b00100010; // line out driver
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//OUT2x_CFG2
tac_register = 0x6D;
tac_value = 0b00100000; // line out driver
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
//PWR_CFG
tac_register = 0x78; //PWR_CFG
tac_value = 0b11000000; //
hope_codec_ctl_port_program_tac5112_byte( tac_register, tac_value, tac_verify);
}
