Skip to main content
Visitor II
July 28, 2020
Solved

I am getting only empty result while using MotionMC_GetCalParams function

  • July 28, 2020
  • 1 reply
  • 928 views

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.

    This topic has been closed for replies.
    Best answer by Miroslav BATEK

    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.

    1 reply

    ST Employee
    July 29, 2020

    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.

    Jmong.1Author
    Visitor II
    July 29, 2020

    Hello,

    It seems to work well.

    Thank you for your answer.

    Have a nice day,

    Julien