cancel
Showing results for 
Search instead for 
Did you mean: 

I2c HAL_I2C_ERROR_AF error in slave mode

MAbba.2
Associate II

Hello,

I am using I2C on STM32F part STM32F407VG.

I have taken example code from

https://github.com/PaxInstruments/STM32CubeF4/tree/master/Projects/STM32F4-Discovery/Examples/I2C/I2C_TwoBoards_ComIT

The I2C configuration for STM32F as slave are following

uint8_t i2cConfiguration(void)
{
	I2cHandle.Instance             = I2Cx;
 
	I2cHandle.Init.AddressingMode  = I2C_ADDRESSINGMODE_7BIT;
	I2cHandle.Init.ClockSpeed      = 92000;
	I2cHandle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLED;
	I2cHandle.Init.DutyCycle       = I2C_DUTYCYCLE_16_9;
	I2cHandle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLED;
	I2cHandle.Init.NoStretchMode   = I2C_NOSTRETCH_ENABLED;//I2C_NOSTRETCH_DISABLED;
	I2cHandle.Init.OwnAddress1     = I2C_ADDRESS;
	I2cHandle.Init.OwnAddress2     = 0XFE;
 
	HAL_StatusTypeDef initStatus = HAL_I2C_Init(&I2cHandle);
	return initStatus;
}

 I have silicon-lab Mighty gecko as I2C Master.

The write operation from Mighty gecko to STM32F is working fine.

But i case of read i am getting HAL_I2C_ErrorCallback triggered.

I tried to debug and came to know that the I2C driver is returning HAL_I2C_ERROR_AF error.

After that i am able to perform any write/read requests.

I can you please help me How i can fix the problem?

Regards

MAbbas

1 REPLY 1
MAbba.2
Associate II

Any help about the Problem? Anyone has faced the problem and solved?

i need some solution please help me.