Hello,
When I try to transmit a buffer to an I2C slave through uart a hard fault is generated (BusFault_Handler B BusFault_Handler
ADI_HAL_STATUS_t I2C_Transmit(uint16_t address,uint8_t *pData, uint8_t size)
{
/* set slave address to ADPD105 default 0x64 without read0/write1 bits */
if (adi_i2c_SetSlaveAddress(i2CDevice, address)) // bottom-end
{
//DEBUG_MESSAGE("couldn't set slave device address");
}
tran.pPrologue=pData; /*!< Prologue pointer. */
tran.nPrologueSize=1; /*!< Prologue byte count. */
tran.pData=pData+1; /*!< Data pointer. */
tran.nDataSize=size-1; /*!< Data byte count. */
/* false to write*/
tran.bReadNotWrite=false; /*!< Read/write flag. */
tran.bRepeatStart=false; /*!< Repeat start flag. */
ADI_HAL_STATUS_t ret;
adi_i2c_ReadWrite(i2CDevice,&tran,&hwErrors) //bug
return ret;
}
Executing the code step by step shows that the hard fault is generated when waiting I2C_BUSY in the adi_i2c.c module
static void submitTransaction(ADI_I2C_HANDLE const hDevice, ADI_I2C_TRANSACTION* const pTransaction) {
/* reset internal return code */
hDevice->result = ADI_I2C_SUCCESS;
/* reset hardware error code */
hDevice->hwErrors = ADI_I2C_HW_ERROR_NONE;
/* wait for HW to be ready */
while (I2C_BUSY) {
;
}
Could you define what is the cause of the hardfault?