2020-01-25 09:03 AM
I am using the code provided in the TN1218 sheet, and I've attached a screenshot of my variables.
2020-01-25 09:07 AM
As far as I recall, first you need to read calibration data from the sensor, then read the raw temperature and apply the formulas.
There is a github standard C drivers for most ST sensors, you could start from there.
2020-01-27 07:47 PM
Hello. I am using the code ST provided which includes reading the calibration registers. I'm pretty sure there is something wrong with the way I am transmitting the data. Below is my code fore reference:
int hts_read_reg(I2C_HandleTypeDef *_i2chandle, uint8_t _reg, uint8_t *_buff, uint8_t _size)
{
if(HAL_I2C_Master_Transmit(_i2chandle, HTS_WR_ADDR, &_reg, 1, TIMEOUT) != HAL_OK)
return -1;
if(HAL_I2C_Master_Receive(_i2chandle, HTS_RD_ADDR, _buff, _size, TIMEOUT) != HAL_OK)
return -1;
return 0;
}
2020-01-31 08:36 AM
To add a bit more clarity to my question - Sometimes my T_OUT value doesn't update at all, and other times it updates but produces very sporadic values. Since I am using the code provided in TN1218, I am unsure how to proceed. I've also tried using a couple of people's implementations for retrieving temperature but I still get wild results.
Thanks.