This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem with communication with HTS221 sensor

Hello Nordic community,

I have a nrf52-DK with SDK15.2.0 and I'm trying to communicate with ST HTS221 sensor. I have the original  STEVAL-MKI141V2 evaluation board.

I use the twi_sensor example, provided in the SDK. I added the hts221 driver from the SDK and used the default functions for initialization:

When I try to read the whoami register, I get value 0. When I try to read the temperature and humidity data, always get the same value.

I tried to communicate with ST LIS2DH12 accelerometer the same way with the same example and everything is normal. Is it possible the problem to be in the hts221 libraries?

  • It could be. What I did was to write a new library, based on the arduino one for this sensor. Thank you for the support!

  • I'm also interested in the HTS221 sensor.  I used the above code as a starting point to interface to the STEVAL-MKI141V2 board and used the driver included in SDK 15.2.  I wired the HTS221 to a nRF52840 DK (see picture below).  I used SES to add the code to a BLE peripheral template.

    ilkobg didn't reply as to ever getting this working, but after some trial and error, it worked for me.  I used a callback to report the humidity and temperature readings.  There's really no documentation on how to use this driver nor an example.  Apparently the HTS221 is used in the Thingy, but I'm not familiar with that environment and didn't find any useful code example.   A code snippet included below and a screenshot of the SES debug terminal displaying results.

     

  • Hi, I've been recently trying to establish a communication between the HTS221 sensor that I have in a STEVAL-IDI003V2 board. For now I've used the code ilkobg has posted. After linking correctly the hts221 library and adding some lines of code to the skd_config.h file, the code compiles and I get the exact same results that ilkobg explains.
    Right now I'm quite stuck with this problem and I don't know what else can I do in order to establish a sucessful communication, as I think the hardware is fine.


    maxx44, could you share your whole code if you don't mind? Or do you know any possible reason behind my problem?

    Thank you in advance.

  • Hi,

    Sorry for the delayed response.  I've moved on to another project and had to set the one above aside, but I was able to establish readings from the HTS221 as mentioned above.  Beyond the snippet I showed, what I have is specific to the PCA10056 board shown and development with SES and a SDK ble_peripheral template to which I've added code.  I doubt this would all do you much good unless you're in the same environment.  Plus it's a lot to wallow through.

    What I did find is that the driver in the SDK requires you to also configure the TWI manager and enable this in your sdk_config.h file.  I found this complicated things more than I needed, but I went along with it rather than have to dive in and modify the driver or come up with my own.  Look carefully through the configuration settings at the beginning of the code I showed above and see if it helps get the driver set up.

    Regards,  Max

  • hi, can you please provide the source file .

1 2 3