cancel
Showing results for 
Search instead for 
Did you mean: 

I am working on a design in STM32CubeIDE that uses the STM32L053 connecting to four sensors connected over I2C. I am trying to use the examples from the https://github.com/STMicroelectronics/STMems_Standard_C_drivers repo.

JSans.1
Associate

For example, the HTS221 sensor responds correctly to the "WhoAmI" query. It then responds with a NAN when trying to read the temperature or the humidity. Some of the other drivers do not even respond to the "WhoAmI" command correctly. Would using these drivers be the correct approach, or is there some other preferred method?

3 REPLIES 3
Eleon BORLINI
ST Employee

Hi @JSans.1​ ,

some hardware and firmware question to try to narrow down the issue: on the hardware side, are the 4 sensors (humidity and..?) using separated I2C lines? And which Vdd / VddIO and pull-up resistors are you using? I see that most of the STM32L053 MCUs have only two I2C lines...

From a firmware side, please note that you have to initialize properly the I2C lines from the master STM32L053 side, since the Github drivers are platform independent or embed examples only for the NUCLEO_F411RE.

Did you check the I2C patterns being sent and coming from the sensors, with an oscilloscope?

-Eleon

JSans.1
Associate

Hello Eleon,

The four drivers that we are using are the HTS221, LPS25HB, LSM6DSM, and BH1750. They are all attached to the same I2C lines. These are configured on PB8 and PB9 as I have seen in a few places. Each of the INT pins for each sensor are tied to GPIOs with their respective pull-up or pull-down resistors. I want to say the HTS221 was giving me temp and humidity readings before, but now returns NaN. I recently updated the IDE, but it did not appear to change anything I can see.

I am currently working on getting my oscilloscope set up and connected to my hardware.

Jason

Hi Jason,

did you find any issue with the oscilloscope?

Are the 3 non-running devices off / in sleep mode while the fourth one is running?

-Eleon