cancel
Showing results for 
Search instead for 
Did you mean: 

I am planning to use an HTS221 Temperature and humidity sensor in SPI mode. I wish to use it on a common SPI bus each device on the bus is enabled by bringing its chip select low.

Michael Werson
Associate II

when its chip select input is high, as it is supposed to operating in an I2C mode. Will the HTS221 data bus change into an output state and override the common SPI data?

5 REPLIES 5
Eleon BORLINI
ST Employee

Hi @Michael Werson​ , yes, you are right, if I correctly guess what you are meaning. If the CS is LOW, the SPI is enabled for both temperature and humidity readings, and you can perform a multiple SPI reading of registers from 28h (HUMIDITY_OUT_L) to 2Bh (TEMP_OUT_H). Regards

Michael Werson
Associate II

Eelon,

Thanks for the response, I guess my question is more to do with the fact that when this chip is sharing a common SPI bus then the SPI data will be clocked into the HTS221 when the chip select is low, however when the chips select is high it will be responding to the common SPI signals in an I2C mode. My worry is that in there is a danger when receiving the SPI data it will somehow construe this as I2C data and start trying to output data conflicting with the common spi data.

S.Ma
Principal

I would use I2C for slow sensors such as humidity, temperature, pressure.

If multiple SPI slaves are on the bus, when NSS is high for the humidity sensor might put trouble.

If the pins are power safe, maybe using MCU NSS to control sensor power pin could be interesting alternate implementation.

Further to my previous questions I have now implemented an HT221 device in my project. I have developed software to read this device using i2c and can communicate with it. My question now relates to the values in the calibration registers, particularly related to humidity as these do not look correct and have no correspondance with the values presented in you technical note TN1218.
I have taken a snapshot of the readings in the calibration registers:
T0_degC and T1_degC have been corrected for the msb bits and the corrected temperature is 25C which is probably okay. However the corrected humidity is -475 bits despite limiting the value read to 25600, due I believe to the incorrect H1_T0 parameter.

Hi @Michael Werson​ , are you correctly Interpreting humidity and temperature readings? Please check the technical note TN1218 for this purpose, and the online C drivers on Github repository for a code implementation of the TN. Regards