Hi. i am user of K64F, sensor fusion.
after some test, i knew that the magnetometer has a slight error to point a north. ( about 8 degree (yaw))
so i want to fix a direction receiving from magnetometer , not real north
(For example, I want to designate the power up direction is north.)
Question 1 : it is right way to use magnetometer offset compensation? like FXOS8700CQ_Mag_Calibration function in FXOS8700CQ - Bare metal example project
i tried to test a FXOS8700CQ_Mag_Calibration function
when i push button, OnNMI works and FXOS8700CQ_Mag_Calibration function execute.
but it didn't work. mag raw data was stopped.
Question 2 : i is problem about timing or I have to redesign a code?
Thank you.
Solved! Go to Solution.
Tim,
I'll have to let Tomas comment on your project-specific questions, as I haven't looked at his code. But with regard to Question 1: Magnetic calibration works by mapping a 3D ellipsoid of magnetic measurements into a 3D sphere. Freescale's routines do this by performing something called a total least squares fit. This attempts to minimize radial error in the mapping. But at the end of the day, it can leave uncorrected some amount of pure rotation in the magnetic distortion. That's why you still see some error even after correction. The error results from fundamental assumptions in the mag cal routines, and there is nothing you can do in those routines to account for it. The fix is to simply apply a fixed, final 3D rotation to the computed device orientation to account for the error.
Mike
Tim,
I'll have to let Tomas comment on your project-specific questions, as I haven't looked at his code. But with regard to Question 1: Magnetic calibration works by mapping a 3D ellipsoid of magnetic measurements into a 3D sphere. Freescale's routines do this by performing something called a total least squares fit. This attempts to minimize radial error in the mapping. But at the end of the day, it can leave uncorrected some amount of pure rotation in the magnetic distortion. That's why you still see some error even after correction. The error results from fundamental assumptions in the mag cal routines, and there is nothing you can do in those routines to account for it. The fix is to simply apply a fixed, final 3D rotation to the computed device orientation to account for the error.
Mike