
/* Run Sensor Fusion algorithm */
MotionFX_propagate(&data_out, &data_in, &dT); MotionFX_update(&data_out, &data_in, &dT, NULL)
;
if (ENABLE_6X)
{
q = &data_out.quaternion_6X[0]; /* Game rotation Vector */
}
else
{
q = &data_out.quaternion_9X[0]; /* Rotation Vector in 9X */
}
}
2.2.10
Algorithm performance
Table 2.
Cortex-M4 and Cortex-M3: elapsed time (µs) algorithm
Cortex-M4 STM32F401RE at 84 MHz
Cortex-M3 STM32L152RE at 32 MHz
STM32CubeIDE
1.2.0
IAR EWARM
8.32.3
Keil µVision 5.27
STM32CubeIDE
1.2.0
IAR EWARM 8.32.3
Keil µVision 5.27
Min
Avg
Max
Min
Avg
Max
Min
Avg
Max
Min
Avg
Max
Min
Avg
Max
Min
Avg
Max
<1
1885 1943
<1
1235 1926
<1
2011 2059
1
6823 24213
3
3893 24109
1
4707 14213
Table 3.
Cortex-M0+ and Cortex-M7: elapsed time (µs) algorithm
Cortex-M0+ STM32L073RZ at 32 MHz
Cortex-M7 STM32F767ZI at 96 MHz
STM32CubeIDE
1.2.0
IAR EWARM
8.32.3
Keil µVision 5.27
STM32CubeIDE
1.2.0
IAR EWARM 8.32.3
Keil µVision 5.27
Min
Avg
Max
Min
Avg
Max
Min
Avg
Max
Min
Avg
Max
Min
Avg
Max
Min
Avg
Max
3
4573 5036
3
1851 4776
3
2042 2117
1
2995
3038
1
1809
1841
1
2840
2881
2.3
Sample application
The MotionFX middleware can be easily manipulated to build user applications. A sample application is provided
in the Application folder.
It is designed to run on a
,
or
development board connected to an
The application provides real-time motion-sensor data fusion and returns rotation, quaternions, gravity, linear
acceleration, heading and heading error.
UM2220
Sample application
UM2220
-
Rev 7
page 14/24