cancel
Showing results for 
Search instead for 
Did you mean: 

MotionFX magnetometer calibration never finishes

PNewm.1
Associate II

I am using STM32CubeIDE with a STM32L471VET micro. I have included the MotionFX library and have 9DOF orientation output working, but I can't seem to get the magnetometer calibration completed. It continuously shows: MFX_MAGCALUNKNOWN even after 5 to 10 min of rotating my development board around at every conceivable angle even making figures of 8 does not seem to work. I have followed the MotionFX documentation carefully. I hope there is someone out there that has got this to work successfully. If so please help me to get the calibration working.

1 ACCEPTED SOLUTION

Accepted Solutions
PNewm.1
Associate II

Hi Peter. Thank you for your reply. I did exactly what you said even before you replied and I was able to get the calibration done in less then 10 seconds. The problem I had was the the documentation said to move the device in a figure of 8 'slowly'. This is where the problem is. If one moves it slowly then it simply does not calibrate. After struggling for a long time, in fact many days, I got so fed up, I just moved the board vigorously and wildly and voila! It worked. I tried many times to calibrate it afterwards and even got it done in 4.5 seconds while moving it vigorously. To spare many other people the same trouble, I would update the documentation by removing the word 'slowly' as this is misleading in my opinion. Perhaps others have had a different experience, but I certainly struggled for many days because of the word 'slowly'. I hope this helps someone.

View solution in original post

8 REPLIES 8
Petr S
ST Employee

Hello,

Please verify your data feed into library, including units and timing. I recommend to inspire in the DataLogFusion sample application included in X-CUBE-MEMS1 package, especially all initialization sequences and data feed. In mentioned application I usually get MFX_MAGCALGOOD in less then 10 seconds. You can use STM32CubeMX tool to generate this application for HW similar to your one.

Regards,

Petr

PNewm.1
Associate II

Hi Peter. Thank you for your reply. I did exactly what you said even before you replied and I was able to get the calibration done in less then 10 seconds. The problem I had was the the documentation said to move the device in a figure of 8 'slowly'. This is where the problem is. If one moves it slowly then it simply does not calibrate. After struggling for a long time, in fact many days, I got so fed up, I just moved the board vigorously and wildly and voila! It worked. I tried many times to calibrate it afterwards and even got it done in 4.5 seconds while moving it vigorously. To spare many other people the same trouble, I would update the documentation by removing the word 'slowly' as this is misleading in my opinion. Perhaps others have had a different experience, but I certainly struggled for many days because of the word 'slowly'. I hope this helps someone.

Hi @PNewm.1​ ,

thank you for reporting your "vigorous" solution.

-Eleon

I'm trying Firmware\Projects\STM32L476RG-Nucleo\Applications\IKS01A3\DataLogFusion application from the X-CUBE-MEMS1 package (LSM6DSO and LIS2MDL sensors) and even very slow movement leads to MFX_MAGCALGOOD result in less than 10 seconds. I know it's not a good news for you. Anyway at least we can remove the word "slowly" and let every user find his own speed.

Hi Peter. That is good news! I will try and see what the slowest rate of movement is to still get calibration working. I will use the same setup as you did using: Projects\STM32L476RG-Nucleo\Applications\IKS01A3\DataLogFusion application from the X-CUBE-MEMS1 package (LSM6DSO and LIS2MDL sensors). BTW: How many figures of 8 do you do per second or how many seconds does it take for one figure of 8 that you do and what size is the figure of 8 that you make?

We actually have a four wheeled underwater robot and would have like to calibrate the magnetometer on the fly. In our case it seems unlikely that we will ever see MFX_MAGCALGOOD since the robot rides fairly slowly at around 0.2 m/s or about 0.25 m/s at its fastest speed. The robot can climb walls as it has a thrust motor that pushes it against the floor and walls of a swimming pool. My guess is that calibration might never be achieved if it is too slow in turning about on the floor and walls or am I missing something here? Does calibration still continue even at very slow rates of motion? What would have been brilliant is if there was actually a 'progress' readout of some kind to show calibration progress. I know there is a quality readout, but we are very much left in the dark as to how far calibration is. If we could actually see a percentage readout then we can at least get an idea of how quickly calibration might be achieved at the current rate. Also it is hard to move a medium size robot weighing about 12 kg in a figure 8 at a medium to fast rate to get calibration done. Anyway... perhaps there is another library that might be better suited for our type of application. If there is one that you know about, please let me know.

Could you please send me the datalog (including timestamp and sensor data) of the calibration movements that the robot is able to perform? I'll share it with the team developping the MotionMC Magnetometer Calibration libraries to test if some other special library would fit to your needs. Can you please also confirm if the calibration needs to be done for all 3 axis or just horizontal? From the description seems like the robot can move in any orientation and will need 3D calibration. Thanks.

PNewm.1
Associate II

Hi Peter. Thank you for being willing to help us. Unfortunately it's no so easy for me to send any motion data to you presently. I am actually logging the motion data at 20 FPS even though the IMU accel, gyro and mag data as well as the MotionFX methods are run at 100 FPS. We run the IMU at 100 FPS so that we can get better gyro related motion control. At this point in time I cannot get the logged data from the QSPI 1MB flash chip as I have not yet written code to do so. I do believe that providing you with the data log may help you to help us come up with some sort of calibration solution. I'm just tied down with other work related to the same project, so I can't spend any time on this now. It may take a few weeks before I can provide you with the motion data.

Petr S
ST Employee

No problem, just let me know when you have something.