cancel
Showing results for 
Search instead for 
Did you mean: 

MotionMC does not calibrate my Magnometer in real-time.

ptagh.1
Associate II

Hello everyone,

We have successfully setup MotionMC lib in our project in order to calibrate the magnometer embedded in the MPU9250 IMU chip. When the board is turned on, after 15-45 sec (depending on rotating the board), MotionMC calculates the soft&hard iron coefficients. In fact, it calibrates our sensor perfectly.

The problem is that it is done only once after turning the board on while it should always calculate and update the values. My question is how can we force MotionMC to updates its parameter, espacially when devices is moved to new environment when Electromagnetic field is changed hugely in real-time (without reset/turning the board off) 

/* Current implementation */
 
while(true)
{
if(HAL_GetTick() % 50 == 0)
{
 // Read Magnometerdata
 // MotionMC_Update(&data_in);
 // MotionMC_GetCalParams(&data_out);
 // MotionMC_manager_compensate(&MagValue, &MagComp);
}
}

1 REPLY 1
Miroslav BATEK
ST Employee

If you periodically call the Update function the algorithm will keep calculate the parameters and update calibration coefficients if needed. There is no reason why it should be done only once.

To update the coefficients the boards must be oriented in different position as described in the UM2192.