2023-02-19 9:04 PM
HAL_I2C_IsDeviceReady is good option to check sensor presence but while i2c sensor working incase of error occurrence will error interrupt will be triggered ?
Solved! Go to Solution.
2023-02-20 1:13 AM
Hello @MMARI.1 ,
Try to get the error in the void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c) :
if (HAL_I2C_GetError(I2cHandle) != HAL_I2C_ERROR_AF)
{
Error_Handler();
}
Error_Handler() function is called when error occurs:
1- When Slave don't acknowledge it's address, Master restarts communication.
2- When Master don't acknowledge the last data transferred, Slave don't care in this example.
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-02-20 1:13 AM
Hello @MMARI.1 ,
Try to get the error in the void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c) :
if (HAL_I2C_GetError(I2cHandle) != HAL_I2C_ERROR_AF)
{
Error_Handler();
}
Error_Handler() function is called when error occurs:
1- When Slave don't acknowledge it's address, Master restarts communication.
2- When Master don't acknowledge the last data transferred, Slave don't care in this example.
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.