2022-04-05 08:50 AM
I'm trying to set up communication between the codec and the cm4 using the stm32mp157f-dk2 dev board. Debugging in engineering mode.
I've set up the gpio, i2c1 and sai2 ports for the CM4 using cubemx, but the code fails when trying to send the required startup bytes to the codec via i2c.
As per the codec's data sheet I pull the Reset pin high, this seems to be working and confirmed by scoping the board. Then I call the hal i2c transmit function
HAL_I2C_Master_Transmit(hi2c1, 0x94, data, 2, 500)
using a logic analyser on the i2c pins I can see the address and write flag are succesfully sent, but no data.
Stepping through the code it gets to the function
I2C_WaitOnTXISFlagUntilTimeout(hi2c, Timeout, tickstart) != HAL_OK)
and returns an error as the TXIS flag never gets set. I'm not sure if this is a problem in how i've configured the I2c ...
hi2c1.Instance = I2C1;
hi2c1.Init.Timing = 0x10707DBC;
hi2c1.Init.OwnAddress1 = 0;
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
hi2c1.Init.OwnAddress2 = 0;
hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
I've attached the project for reference, any help or pointer would be hugely appreciated.
Thank you!