2017-08-02 04:24 AM
stm32f302 Controller interfacing to Temperature sensor Mlx9061. The temperature sensor does not read the data.
Here is my Code , can you help me guys?
I2C Address for Mlx90614 0x054 Memory Address is 0x07
unsigned char buffer[5];
void mlx90614_sensor(void)
{
//HAL_I2C_Master_Transmit(&hi2c2,0x54<<1,buffer,3,100);
HAL_I2C_Mem_Write(&hi2c2, 0x54, 0x07, 8, buffer, 1, 100);
//HAL_Delay(10);
HAL_I2C_Mem_Read(&hi2c2, 0x54, 0x07, 8, buffer, 1, 100);
HAL_Delay(10);
}
2017-08-02 05:17 AM
Hello!
First of all this sensor is SMBus compatible(different voltages)
HAL_I2C_Mem_Write(&hi2c2, 0x54, 0x07, 8, buffer, 1, 100);
By calling this function, you mean that the address 0x07 has 8 bytes long address. not correct.
Device address must be shifted left by one.
So making the function like this is more compliant(but not) to the datasheet
HAL_I2C_Mem_Write(&hi2c2, 0x54<<1, 0x00, 1, buffer, 6, 1000);
Means that at device's address shifted by one left and at memory location 0x00 (which address is one byte long) ,write six bytes contained in buffer with one second timeout!
Thesse six bytes must prepared accordingly to the datasheet
2017-08-02 10:10 AM
.
________________ Attachments : 32f302a.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyUr&d=%2Fa%2F0X0000000b9A%2FGY0LYhOJW4t1rY5dmXS4FhyXF4fGhr.dnMZo5dLXVDM&asPdf=false