i2c Error 4
Hi there !
i work with DS2482 I2c to one wire . After i send the command reset i need the read the status register until i find one bit at 1, so i wrote my routine in this way
static uint8_t DS2482_Status_Register(void)
{
uint8_t register_status=0;
uint8_t data=0;
while(register_status !=0x02 )
{
Master_Recive_Data(DS2482_Addr, &data, 1);
// HAL_Delay(1);
dato= data;
register_status = data;
register_status &= 0x02;
}
if(register_status != 0x02)
{
return HAL_TIMEOUT;
}
return HAL_OK;
}
when i run the program i recive error 4 from i2C form
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c)
{
}
But if in the code below i put one delay of 1ms everything work perfect . So there is one "elegant" way to resolve the problem ? or there are other solution ?
Thanks a lot
Sergio

