Does MotionFX support multiple simultaneous 9X/6X instances?
Our application is an intelligent antenna pointing system that uses two identical sets of IIS2MDC magnetometer + ISM330DHCX accelerometer/gyroscope — one pair on our base board, and one pair attached to the moving gimbal. Our overall hardware design was based on the IOT02A board: we got the DataLogFusion running flawlessly on the ST IOT02A first, then subsequently ported that code-base to our own STM32U5-based system.
Our code currently runs MotionFX sensor fusion with two instance memory pointers, with each pair of MEMS sensors feeding into the MotionFX library at a 100 Hz interval — as recommended, and as we saw done in the DataLogFusion example for a single set of magnetometer, accelerometer and gyroscope sensors. Our firmware design used the DataLogFusion example application and setup as a starting point and then adapted it with multiple instances as we have two sets of sensors in our hardware controlled by a single STM32U575ZIT MCU.
Most of the MotionFX API takes an explicit instance/context data pointer per call — the fusion state itself, the knobs structure, the output structure, etc. all appear to be designed around multiple independent instances coexisting. Based on that pattern, we assumed running two 9-axis contexts side by side was a supported configuration.
However, now that we have added and have been attempting to use magnetometer calibration, we've noticed that the magnetometer calibration API (MotionFX_MagCal_init() / _start() / _stop() / _getParams(), per UM2220) does not take any instance/context parameter — it appears to operate on internal state that isn't per-instance the way the rest of the library is. In practice, this means we assume at minimum, we can only run a calibration session against one of our two sensor pairs at a time; starting a session on the second pair while the first is active doesn't behave as two independent calibrations
Questions:
1. Is MotionFX's 9-axis (accel+gyro+mag) fusion mode officially validated/supported for two simultaneous, independent instances on one MCU — or is that an unsupported configuration that happens to run because most of the state is instance-scoped, but MagCal specifically is a global singleton?
2. If MagCal is intentionally a single global instance regardless of how many fusion contexts are running, is that documented anywhere we've missed? We haven't found this called out explicitly in UM2220.
3. Is there a recommended pattern for our situation — e.g., time-multiplexing magnetometer calibration between sensor pairs one at a time, while running 6-axis (accel+gyro only) fusion concurrently on whichever pair isn't actively calibrating?
Any clarification — or a pointer to where this is documented — would be much appreciated. Happy to share more detail about our exact call sequence if that's useful for diagnosing this.
Thanks and best regards,
Alan Bartky
