AnsweredAssumed Answered

HTS221 and SPI using HTS221_Driver.c

Question asked by lampret.alexander on May 14, 2016
Latest reply on May 16, 2016 by Licciardello.Antonel
Hello,

i tried to connect my STM32F103 to a HTS221 sensor, but I do not get correct values for temperature and humidity.
HTS221_Driver.c has version 1.0.0 from 07/04/2014

What I did so far:
01....
02.HTS221_Set_PowerDownMode(HTS221_SET); // Tried with HTS221_RESET as well
03.... // Do other stuff for ~10ms
04.uint8_t deviceId;
05.HTS221_Get_DeviceID(&deviceId); // successfully returns 0xbc
06.HTS221_StartOneShotMeasurement();
07.HTS221_BitStatus_et humidityStatus = HTS221_RESET, temperatureStatus = HTS221_RESET;
08.while (temperatureStatus == HTS221_RESET) {
09.    HTS221_Get_DataStatus(&humidityStatus, &temperatureStatus);
10.}
11.HTS221_Get_Temperature(&tempTemperature);
12.while (humidityStatus == HTS221_RESET) {
13.    HTS221_Get_DataStatus(&humidityStatus, &temperatureStatus);
14.}
15.HTS221_Get_Humidity(&tempHumidity);
16.HTS221_DeActivate();
17.humidity = ((float) tempHumidity / 10); // Result is 100%
18.temperature = ((float) tempTemperature / 10); // Result is 127°C

Did I missed anything?
Please help me, I checked a lot of code samples but most of them deal with I2C only.

Thx in advance!
Alexander

Outcomes