However, I am getting 0x3A(NACK) in stop condition of my logic analyser. Can anyone help me how i can convert this NACK to ACK. I am attaching my code snippet and my logic analyser signal as well . Thanks for help and support.
uint8_t I2C_ADDRESS = 0x00;
int main (void)
{
HAL_StatusTypeDef status = HAL_ERROR;
uint8_t buf[3] = {0,};
uint32_t temp_data_a;
uint32_t temp_data_o;
__IO float T;
__IO float To;
status = HAL_I2C_IsDeviceReady(&hi2c1, I2C_ADDRESS, 3, 1000);
while(1)
{
HAL_I2C_Mem_Read(&hi2c1, 0x00, 0x06, 1, buf, 2, 1000); // Read Ambient temperature from Register 0x06
temp_data_a = buf[1]*256 + buf[0];
HAL_I2C_Mem_Read(&hi2c1, 0x00, 0x07, 1, buf, 2, 1000); // Read Object temperature from Register 0x07
temp_data_o = buf[1]*256 + buf[0];
To = temp_data_o*0.02;
if(To >= 273.15)
{
To = To - 273.15;
}
else
{
To = -(273.15 - To);
}
T = temp_data_a*0.02;
if(T >= 273.15)
{
T = T - 273.15;
}
else
{
T = -(273.15 - T);
}
HAL_Delay(500);
}