HTS221 Stale Data

I’ve posted this question on the STM32 Arduino forum as well (since I am using their HTS221 API), but it should be equally applicable to post it here. I will not duplicate all content to this post, instead I direct the reader to the original post for more details: https://www.stm32duino.com/viewtopic.php?f=7&t=1593.

The issue I am having is that I cannot seem to get the HTS221 to accept the configuration I send it nor will it send me the correct temp/humidity (it is always the same value for temp and the same value for humidity). I can properly query and receive the device ID (0xBC) and I can query (without error) the current configuration. But after I have changed the configuration, I am still only getting back the original config. Is this possibly a faulty HTS221 chip?

Here is the applicable code:

i2c device_hts;
SensorRing_st ring = {0};   
HTS_Data_st hts_data = {0};
...
// initialize the sensor
ring.error |= HTS_Begin(&device_hts,&hts_data);
// collect data
while(1) {
	ring.error |= HTS_Poll(&device_hts,&hts_data);
	dealy_us(4000); // delay 4msec (I've tried 1 second delays, same result)
}

SensorRing_Error_et HTS_Begin(void *handle, HTS_Data_st *hts_data)
{    
    /* Power down the device */
    if ( HTS_DeActivate( (void *)handle ) == HTS_ERROR )
        return HTS_SENSOR_ERROR;

    /* Enable BDU */
    if ( HTS_Set_BduMode( (void *)handle, HTS_ENABLE ) == HTS_ERROR )
    {
    return HTS_SENSOR_ERROR;
    }
    if (HTS_Set_Odr((void *)handle, HTS_ODR_1HZ) == HTS_ERROR)
    {
        return HTS_SENSOR_ERROR;
    }
    // I also tried just using the Set_InitConfig() method, same result
    // HTS_Init_st hts_init = {0};
    // hts_init.avg_h = HTS_AVGH_4;
    // hts_init.avg_t = HTS_AVGT_2;
    // hts_init.odr = HTS_ODR_1HZ;
    // hts_init.bdu_status = HTS_DISABLE;
    // hts_init.heater_status = HTS_DISABLE;
    // hts_init.irq_level = HTS_HIGH_LVL;
    // hts_init.irq_output_type = HTS_PUSHPULL;
    // hts_init.irq_enable = HTS_DISABLE;
    // HTS_Set_InitConfig((void *)handle,&hts_init);
    
    /* Enable sensor */
    HTS_Activate((void *)handle);
    
    /* Tag sensor */
    HTS_Get_DeviceID((void *)handle,&hts_data->id);

    return ALL_SENSOR_OK;
}

Here is the sample output I receive for temp/humidity:

[17:30:46] Humidity: 61.5, Temp_C: 23.9, Temp_F: 75.02, DevId: 0xbc, Error: 0x0
[17:30:47] Humidity: 61.5, Temp_C: 23.9, Temp_F: 75.02, DevId: 0xbc, Error: 0x0
[17:30:48] Humidity: 61.5, Temp_C: 23.9, Temp_F: 75.02, DevId: 0xbc, Error: 0x0
[17:30:49] Humidity: 61.5, Temp_C: 23.9, Temp_F: 75.02, DevId: 0xbc, Error: 0x0
[17:30:50] Humidity: 61.5, Temp_C: 23.9, Temp_F: 75.02, DevId: 0xbc, Error: 0x0
[17:30:51] Humidity: 61.5, Temp_C: 23.9, Temp_F: 75.02, DevId: 0xbc, Error: 0x0
[17:30:52] Humidity: 61.5, Temp_C: 23.9, Temp_F: 75.02, DevId: 0xbc, Error: 0x0
[17:30:53] Humidity: 61.5, Temp_C: 23.9, Temp_F: 75.02, DevId: 0xbc, Error: 0x0
[17:30:54] Humidity: 61.5, Temp_C: 23.9, Temp_F: 75.02, DevId: 0xbc, Error: 0x0
[17:30:55] Humidity: 61.5, Temp_C: 23.9, Temp_F: 75.02, DevId: 0xbc, Error: 0x0

Here is the configuration I send to HTS221 (top) and what I receive when I query the current configuration (bottom):
hts221_configuraiton_issue-min (1)

Does anyone else have this issue? Or any ideas on troubleshooting steps to resolve the issue. (I’ve tried simply toggling various registers to no avail.)

does the devices shows up when you run i2c scan ?

My device is connected to a microcontroller, so I cannot use i2c scan. But, I am able to correctly query the device ID (0xBC), so I know it is connected and communicating. I can also see activity on my logic analyzer.

Any thoughts on how I can troubleshoot this issue?

i have not used this sensor. i will recommends checking with sensor manufacture ST

I will contact the manufacturer. However, this is an NCD-developed module with the HTS221 sensor, is there not any support for it?

we have Arduino and python sample code for it

Understood. I will look at the code and see if I get the same results.