cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_I2C_Master_Transmit & HAL_I2C_Master Receive never return with HAL_OK using I2C2 Using cube 5.0 generated init's and using the F4_V1.24.0 library.

SBars
Associate

I2C2 is PB11,PB10 are connected to an AT24CM01 I2C eeprom. I get a few writes to the DR then the hal decided that the device is busy and all other calls fail because the device is busy. My writes and reads are trying to to do 240 bytes, not a very large packet. We are running the device slow, 8mhz crystal, 32 mhz internal bus to conserve power. I have verified that the hal sets up the pins to open drain alternate function i2c.

1 REPLY 1
SBars
Associate

Since I was running the processor so slow, and the i2c packet was large, the routines were timing out. It is unclear in the manual if the timeout is per character or for the transfer. It is for the transfer. I set the timeouts to a much larger value and the I2C receive and Transmit routines now work. I also learned that if the hal driver has a problem it marks the device as busy, so it will never respond to another command unless you do a deint, then an init.