AnsweredAssumed Answered

How does HAL_I2C_IsDeviceReady work?

Question asked by Alessio Caligiuri on Oct 19, 2017
Latest reply on Oct 21, 2017 by john doe

Hi all,

I'm dealing with an I2C memory connected to a STM32F401 MCU and I'd like to check at runtime if the device is ready (or if something is wrong, e.g. with wirings).
I'm trying to use the HAL_I2C_IsDeviceReady function but reading the ST documentation I can't understand completely how it works. So, what is the difference between the "trials" and the "timeout" parameters?

In many examples, I found something like this:

while(HAL_I2C_IsDeviceReady(&hi2c1, EEPROM_I2C_ADDRESS,1, HAL_MAX_DELAY));

but this is a blocking statement in the case of the device isn't working properly (e.g., not power supplied) and so I'm not satisfied with this solution.

Can anyone help me?

Many thanks!