Motion mems and environmental sensor expansion board for stm32 nucleo (23 pages)
Summary of Contents for ST X-CUBE-MEMS1
Page 1
UM2220 User manual Getting started with MotionFX sensor fusion library in X-CUBE-MEMS1 expansion for STM32Cube Introduction The MotionFX is a middleware library component of the X-CUBE-MEMS1 software and runs on STM32. It provides real-time motion-sensor data fusion. It also performs gyroscope bias and magnetometer hard iron calibration.
UM2220 Acronyms and abbreviations Acronyms and abbreviations Table 1. List of acronyms Acronym Description Application programming interface Board support package Graphical user interface Hardware abstraction layer Integrated development environment UM2220 - Rev 9 page 2/24...
MEMS sensors, regardless of environmental conditions, for an optimum performance. The library is designed for ST MEMS only. Functionality and performance when using other MEMS sensors are not analyzed and can be significantly different from what is described in the document.
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube 6-axis sensor fusion is fit for fast movements (e.g., for gaming) and when absolute orientation is not necessary. 2.2.3 MotionFX library operation The MotionFX library integrates 6 and 9-axis sensor fusion algorithms in one library; they can even run simultaneously to provide both rotation vector (9X) and game rotation vector (6X).
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube Figure 1. Example of sensor orientations Cortex-M0+ Only the sensor orientation must be set using MotionFX_CM0P_setOrientation function. The parameters of this function are orientation strings which are composed in the same manner as for Cortex-M3, Cortex-M4 and Cortex-M7 (see above).
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube 2.2.5 MotionFX library output data rate It is important to set up the sensor fusion library output data rate properly; 100 Hz is recommended. The output data rate for: •...
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube Calibration procedure The MotionFX library magnetometer calibration library compensates for hard-iron distortions. The magnetometer calibration can be performed at a slower frequency than the sensor fusion output data rate (e.g., 25 Hz).
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube 2.2.7 MotionFX APIs The MotionFX APIs are: Cortex-M3, Cortex-M4 and Cortex-M7 • size_t MotionFX_GetStateSize(void) – retrieves the size of the memory to be allocated prior to run – every instance of MotionFX library requires the allocation of this size •...
Page 9
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube • void MotionFX_getGbias(MFXState_t mfxstate_pt, float *gbias) – gets the initial gbias – mfxstate_pt is a pointer to the allocated memory for the instance of MotionFX – *gbias parameter is a pointer to a float array containing the gyro bias value for each axis •...
Page 10
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube • char MotionFX_LoadMagCalFromNVM(unsigned short int dataSize, unsigned int *data) – the function is used to retrieve the calibration parameters from storage, the function is called when magnetometer calibration library is enabled –...
Page 11
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube • void MotionFX_CM0P_enable_9X(MFX_CM0P_engine_state_t enable) – enables or disables the 9 axes function (ACC + GYRO+MAG) – enable parameter is 1 to enable, 0 to disable • void MotionFX_CM0P_enable_euler(MFX_CM0P_engine_state_t enable) –...
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube Figure 4. STM32 Nucleo: LEDs, button, jumper The above figure shows the user button B1 and the three LEDs of the NUCLEO-F401RE board. Once the board is powered, LED LD3 (PWR) turns ON.
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube Step 2. Launch the MEMS-Studio application to open the main application window. If an STM32 Nucleo board with supported firmware is connected to the PC, the appropriate COM port is automatically detected. Press the [Connect] button to establish connection to the evaluation board.
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube Step 4. Click on the [Sensor Fusion] to open the dedicated window with a 3D model. To switch between 9-axes and 6-axes sensor fusion mode click on the appropriate button.
UM2220 MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube Step 6. Click on [Save to File] to open the dataloging configuration window. Select the sensor and sensor fusion data to be saved in the file. You can start or stop saving by clicking on the corresponding button.
MotionFX middleware library in X-CUBE-MEMS1 software expansion for STM32Cube References All of the following resources are freely available on www.st.com. 1. UM1859: Getting started with the X-CUBE-MEMS1 motion MEMS and environmental sensor software expansion for STM32Cube 2. UM1724: STM32 Nucleo-64 boards (MB1136) 3.
UM2220 List of figures List of figures Figure 1. Example of sensor orientations ............5 Figure 2.
Page 24
ST’s terms and conditions of sale in place at the time of order acknowledgment. Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of purchasers’...
Need help?
Do you have a question about the X-CUBE-MEMS1 and is the answer not in the manual?
Questions and answers