Getting magnetometer calibration status

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting magnetometer calibration status

1,713 Views
scottm
Senior Contributor II

How do you determine when the sensor fusion system's magnetometer calibration is complete?  I don't see an obvious 'complete' flag in the globals - there's iValidMagCal, which indicates the solver used.  Is that the best place to check?

It'd be nice to have a few more API methods to easily check the status of the sensor fusion system.  The status module doesn't seem to get a lot of information passed to it - just a few generic statuses like 'off', 'normal', 'hard_fault', and 'soft_fault'.  It's a little frustrating that the Windows application source isn't available so it's not always clear where it's getting its information.

Thanks,

Scott

Labels (1)
0 Kudos
3 Replies

1,481 Views
BjarneHansen
Contributor I

Hi Scott,

Did you ever get an answer to your question about magnetic calibration? I ran across it while researching my own question about magnetic interference.  I've been developing a marine compass application, and find that monitoring the Fit Error Percentage and Solver Used are the best indicators of calibration success. The Magnetic Error Covariance is also useful.

I can explain more about what I've learned if you are still interested in this admittedly rather old question!

Cheers,

Bjarne

0 Kudos

1,569 Views
lisettelozano
NXP Employee
NXP Employee

Hello Scott,

First of all, I want to apologize for the lack of response from my side; this will not happen again. I apologize if the information is not complete neither clear. By quick reviewing the Sensor Fusion user manual, the sections 4.2.3.2, 4.6.3, 4.6.5 and 5.4.5 might be interesting. Either way, I’m working to get more details about if there is a specific parameter that can confirm fully calibrated the magnetometer.

Again, I apologize for the inconvenience caused and will work on this closely.

Have a great day,

Paulina

0 Kudos

1,569 Views
scottm
Senior Contributor II

Hi Paulina,

I've read all of those and I don't think any of them answer my question.  Your last reference, the one on storing and retrieving calibration parameters, does touch on a topic I'm still puzzled by.

I think it'd help if there was a description of what is envisioned as a typical end product configuration.  How did the designers anticipate these functions being used in production?  What's provided, as far as I can tell, is a Windows utility for development purposes only that has some calibration functions and can load and store settings using NVM_SetBlockFlash().

Obviously this needs to be done on a per-board basis if the calibration is to be useful.  Is it intended that the Windows app be used to perform calibration in production?  The internal functioning of the app is not really documented publicly.

Mag calibration data is saved using SaveMagCalibrationToNVM(), which is only ever called by the serial command decoder.  The first thing I'd have to do to use it is to implement NVM_SetBlockFlash() and make it work with my own configuration storage, which on this device is in external SPI flash.  That means I also have to change CALIBRATION_NVM_ADDR to something meaningful, but there's no documentation given on how large the required block of flash is.

I can deduce that from the code - and in fact it looks like every calibration write function uses the same call to write 256 bytes to the same address - but any time I run into an oversight like that it tells me that I might not be on the same page as the designers.  This is what I mean when I say it looks more like a reference implementation than a library. The API isn't operating at the level of abstraction I would expect for a library.

To take this back to something more concrete, say the sensor fusion user has a thousand devices to ship.  For fast startup, they need stored calibration data (5.4.3).  Is it expected that they will run the Windows app for each one, manually saving the calibration data using the menu options?  Is it expected that the calibration would be done only once with a development board and then that data would be replicated with the firmware?

Is magnetic pre-calibration even useful when the product is being shipped around the world to be used in another locale?  If the magnetometer calibration data IS loaded from NVM, does that prevent it from running the background calibration?

If it's not pre-calibrated and the device completes calibration, is it expected that the application firmware will somehow detect this and trigger a NVM write to save it?  I don't see any mechanism provided for that.  If stored data is important for fast startup, and calibration runs continuously during operation, then I would want some kind of notification that it's time to update the saved data, or at least that an update is ready.

Thanks,

Scott

0 Kudos