2024-07-15 02:20 PM - edited 2024-07-19 06:22 AM
Hi, I am unable to communicate via i2c with the TLV320AIC3104IRHBR chip, the bus response is always busy. I'm just using the STM's internal pullup, I check it on the oscilloscope and the pins are high but no communication happens. Below is my i2c configuration and my schematic.
i2c configurator:
static void MX_I2C2_Init(void)
{
hi2c2.Instance = I2C2;
hi2c2.Init.ClockSpeed = 100000;
hi2c2.Init.DutyCycle = I2C_DUTYCYCLE_2;
hi2c2.Init.OwnAddress1 = 0;
hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
hi2c2.Init.OwnAddress2 = 0;
hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
if (HAL_I2C_Init(&hi2c2) != HAL_OK)
{
Error_Handler();
}
}
I2C connection attempt:
HAL_StatusTypeDef status = GDSP_Codec_Init( & codec, & hi2c2, CODEC_NRST_GPIO_Port, CODEC_NRST_Pin);
HAL_Delay(1000);
if (status == HAL_OK) {
char * msg = "OK\r\n";
CDC_Transmit_FS((uint8_t * ) msg, strlen(msg));
} else if (status == HAL_ERROR) {
char * msg = "ERRO\r\n";
CDC_Transmit_FS((uint8_t * ) msg, strlen(msg));
} else if (status == HAL_BUSY) {
char * msg = "BUSY\r\n";
CDC_Transmit_FS((uint8_t * ) msg, strlen(msg));
} else if (status == HAL_TIMEOUT) {
char * msg = "TIMEOUT\r\n";
CDC_Transmit_FS((uint8_t * ) msg, strlen(msg));
}
HAL_Delay(100);
Schematic stm:
Schematic codec:
Attached I left the codec driver file, you can see what happens when the chip starts