AN4594
Reading data from sensor expansion board
The BSP provides the API and the functionality for taking the data from sensors. Once the
sensors are initialized we can get data from them using these functions:
•
BSP_HUM_TEMP_GetTemperature(float * Temp)
This API gives the access to temperature sensor data.
•
BSP_HUM_TEMP_GetHumidity (float * Humid)
This API gives the access to humidity sensor data.
•
BSP_PRESSURE_GetPressure((float *)&Press)
This API gives the access to pressure sensor data.
•
BSP_IMU_6AXES_X_GetAxesRaw ((AxesRaw_TypeDef *)&ACC_Value)
This API gives the access to accelerometer sensor data.
•
BSP_IMU_6AXES_G_GetAxesRaw((AxesRaw_TypeDef *)&GYR_Value)
This API gives the access to gyroscope sensor data.
•
BSP_MAGNETO_M_GetAxesRaw((AxesRaw_TypeDef *)&MAG_Value)
This API gives the access to magnetometer sensor data.
4.2
Application description
An example application using the sensor expansion board with the Nucleo F4 board can be
downloaded from [$BASE_DIR\Projects\STM32F4xx-
Nucleo\Examples\EWARM\project.eww]. In this application, real-time sensor data is
transmitted to PC via a serial port using system call HAL_UART_Transmit(). Transmitted
sensor data can be viewed using Sensors_Datalog, a PC-based application developed by
STMicroelectronics (refer to
read and visualize data from the sensor expansion board connected to the PC via the
Nucleo board. The firmware provided formats the sensor data that can be read by the
Sensors_Datalog utility. For example, sending temperature data through UART is typically
handled by the following steps:
•
BSP_HUM_TEMP_isInitialized();
•
BSP_HUM_TEMP_GetTemperature();
•
Serialize();
•
HAL_UART_Transmit();
The Serialize() function formats the temperature data readable by the Sensors_Datalog
utility. Similarly, data from other sensors is also formatted and communicated to the utility.
When connected via Teraterm, the user can press the blue button on the Nucleo board to
start and stop the data log.
Section 5
for further details). Sensors_Datalog can be used to
DocID026958 Rev 1
Guide for writing applications
11/16
16
Need help?
Do you have a question about the STM32 Nucleo and is the answer not in the manual?
Questions and answers