cancel
Showing results for 
Search instead for 
Did you mean: 

I am getting only empty result while using MotionMC_GetCalParams function

Jmong.1
Associate II

Good afternoon,

I am currenly working with the ECompass feature, and I am facing some issues with the magnetometer compensation library : MotionMC.

I followed the UM2192 user manual instructions to write my code but I am still getting empty/default values (actually 0 everywhere) when calling MotionMC_GetCalParams function.

I had a lok to some other post :

https://community.st.com/s/question/0D50X00009XkWyASAV

https://community.st.com/s/question/0D50X00009XkWf7SAF

According to the second link, the function MotionMC_Update should run during atleast 5 seconds before calling MotionMC_GetCalParams.

But I am not sure to understand, should I run MotionMC_Update for 5 seconds during my initialization step, or should I run MotionMC_Update for 5 seconds each time I want to call MotionMC_GetCalParams ?

Moreover can someone explain why it is necessary (if it is really necessary)?

Thanks,

Have a nice day,

Julien.

1 ACCEPTED SOLUTION

Accepted Solutions
Miroslav BATEK
ST Employee

Hello,

magnetometer calibration is required to compensate hard-iron and soft-iron error. See chapter 2.1. in UM2192.

You should call the MotionMC_Update() function repetitively with frequency defined when you call the MotionMC_Initialize() function.

You have to do "8-shape" movement as described in the User Manual.

You can call the MotionMC_GetCalParams() function also repetitively (after each Update) to monitor the status of the calibration.

You can check MagnetometerCalibration example which is available in X-CUBE-MEMS1 package.

View solution in original post

2 REPLIES 2
Miroslav BATEK
ST Employee

Hello,

magnetometer calibration is required to compensate hard-iron and soft-iron error. See chapter 2.1. in UM2192.

You should call the MotionMC_Update() function repetitively with frequency defined when you call the MotionMC_Initialize() function.

You have to do "8-shape" movement as described in the User Manual.

You can call the MotionMC_GetCalParams() function also repetitively (after each Update) to monitor the status of the calibration.

You can check MagnetometerCalibration example which is available in X-CUBE-MEMS1 package.

Hello,

It seems to work well.

Thank you for your answer.

Have a nice day,

Julien