cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for Examples. B-L475E-IOT01 or 02. Unable to init Temp Sensor on board

LSmit.7
Associate

I'm looking for any examples that use the functions/methods/drivers found in the PDF: UM2298 User manual STM32Cube BSP drivers development guidelines .

I've installed the Board Support Package in my project and it specifically includes the files:

stm32l475e_iot01_env_sensors.c and .h

What I'm really looking for is an example that shows the proper usage of the

BSP_ENV_SENSOR_Enable() method. I've read the comments and to initialize the sensor I need to pass two args: Instance and Function. Both are uint32_t.

From the docs:

Instance 0 corresponds to HTS221 (temperature and humidity capabilities).

Instance 1 corresponds to LPS22HB (temperature and pressure capabilities). 

#define ENV_SENSOR_INSTANCES_NBR  2U

#define ENV_SENSOR_FUNCTIONS_NBR  3U

#define ENV_TEMPERATURE   1U

#define ENV_PRESSURE     2U

#define ENV_HUMIDITY     4U

So If I want to init the HTS221 sensor for Temperature readings, the call would look like:

BSP_ENV_SENSOR_Enable(0, ENV_TEMPERATURE);

But this call returns the error code of -1

So I went looking for examples. I've tried every kind of search I can think of and all I get back are examples showing the older Board Support Package that uses different methods. I found the ST github repo for examples at:

https://github.com/STMicroelectronics/STM32CubeL4/tree/master/Projects/B-L475E-IOT01A/Examples/BSP

This was updated last month, so I figured it would be up to date. But it uses methods such as:

BSP_TSENSOR_ReadTemp();

This method is not in the PDF mentioned above.

So, anyone have any ideas?

Thanks,

Lance

1 REPLY 1
Imen.D
ST Employee

Hello @LSmit.7​ and welcome to the Community :)

I advise you to follow the step by step on wiki page Sensors usage with B-L475E-IOT01A, to configure and perform measurements with sensors available in the STM32L4 IoT Discovery kit.

Hope my answer helped you!

When your question is answered, please close this topic by choosing Select as Best.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen