cancel
Showing results for 
Search instead for 
Did you mean: 

HAL library error for I2C mode EEPROM

JChoi.6
Associate II

After updating the i2c library to the latest version, I got a write error. After reverting the library to the previous version, the error went away and the location where the error was returned is:

stm32f3xx_hal_i2c.c / I2C_IsErrorOccurred()

Line 7255

It looks like there's probably something wrong with the acknowledge polling process to know when the write cycle is finished.

 

CubeMX V6.13.0

MCU Package STM32F3 Series V1.11.5

STM32F334K6Tx

I2C EEPROM: AT24C16D

 

 

5 REPLIES 5

@JChoi.6 wrote:

After updating the i2c library to the latest version, I got a write error.


What error, exactly, did you get?

Did you check the I2C lines with a logic analyser to see if the hardware is behaving correctly?

The error was returned when calling the HAL_I2C_Mem_Write function consecutively.
I don't think it's a hardware issue because the problem disappeared when I reverted the library to a previous version.
If I use a debugger to insert a breakpoint at the beginning of the HAL_I2C_Mem_Write function, the error does not occur.
Also, the custom I2C EEPROM read/write function is widely used in other products of our company, so it has been sufficiently verified.

 

Relevant source code is attached.

 

Thank you for your interest.


@JChoi.6 wrote:

The error was returned when calling the HAL_I2C_Mem_Write function consecutively..


Again, what error was it?

Data is not written to EEPROM.

To explain in detail, if you call the HAL_I2C_Mem_Write function repeatedly within a single user function, an error value will be returned in all calls except the first call, and only the value written in the first function call will be valid as actual data.

But what error code did the function return?

 


@JChoi.6 wrote:

an error value will be returned


So what is that error value?