Hi,
I'm a little bit lost setting up my AIC3256 from my MCU. Any help would be greatly appreciated. I'm loading the program over I2C. I'm not sure if I'm loading my application the wrong way, or if I'm missing out on some other things that I need to do.
To simplify things, I have made an extremely simple application in PPS containing a Tone generator, a splitter and a stereo output. This program generates a tone to J4 jack on the AIC3254EVM-U . I'm now having problems getting this to work on my board.
I have generated register tables from PPS, base_main_Rate44_pps_driver.h. If I have understood it correctly, this file contains all initialization settings for the AIC3256 and my PPS-application.
I found an example posted by J Arbona, in this forum, how to write the driver file with SPI, and modified it for I2C. Changed the register addresses to 8-bit addresses, otherwise basically the same. It felt quite straight forward.
I have tested my I2C with an E2PROM and both writing and reading works fine. I don't get any errors, timeout or NAKS while I'm writing my application to the AIC3256 on my board.
After I have written all the data from the three registers (REG_Section_program, miniDSP_A_reg_values and miniDSP_D_reg_values), I here a low click-sound in my headphones which are connected to my board. But no tone like on the EVM.
Am I missing out on some steps here? Do I need to configure anything else except for the base_main_Rate44_pps_driver to get the tone to work?
I'm loading the application with the function below. The DSP_A and DSP_D regs are loaded with the same function but without the switch. I call the function with the total length of each Register.
//Johnny
/**
* @brief Writes the complete application register setup
* to the AIC3256 module.
*
* @param none
* @retval none
*/
static int ifcAIC3256_WriteApp(const reg_value *data,
const reg_value *DSP_A_data,
const reg_value *DSP_D_data,
unsigned int length_data,
unsigned int length_DSP_A,
unsigned int length_DSP_D)
{
int tx_length = 0;
int bytes_written = 0;
int match = 0;
int z = 0;
for (int i = 0; i < length_data; i++)
{
switch (data[i].reg_off)
{
case 254: // Delay case
DebugPrintLine("Delay: ");
DebugPrintU32(data[i].reg_val);
modSysTick_Delay(data[i].reg_val);
break;
case 255: // miniDSP code case
if (data[i].reg_val == 0x00)
{
DebugPrintLine("DSP_A");
dsp_a_bytes = ifcAIC3256_WriteDSPReg(DSP_A_data, length_DSP_A);
DebugPrintLine("End_DSP_A");
}
else
{
if (data[i].reg_val == 0x01)
{
DebugPrintLine("DSP_D");
dsp_d_bytes = ifcAIC3256_WriteDSPReg(DSP_D_data, length_DSP_D);
DebugPrintLine("End_DSP_D");
}
}
break;
default:
rx_reg_buf[0] = (data[i].reg_off);
tx_reg_buf[tx_length++] = (data[i].reg_off);
tx_reg_buf[tx_length++] = (data[i].reg_val);
bytes_written++;
// Determine if register is contiguous
while ((data[i].reg_off + 1 == data[i + 1].reg_off) && ((i + 1) < length_data))
{
tx_reg_buf[tx_length++] = (data[++i].reg_val);
bytes_written++;
}
modI2C_WriteI2C2(tx_reg_buf, tx_length);
tx_length = 0;
}
}
return bytes_written;
}