Save MAG CALibration Data

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

Save MAG CALibration Data

Jump to solution
1,035 Views
a8Chcx
Contributor V

Hi,

 

I am trying to save the following MAG calibration data:

thisMagCal.fV[0]=8.80, thisMagCal.fV[1]=61.10, thisMagCal.fV[2]=3.20, thisMagCal.fB = 45.2

 

thisMagCal.finvW[0][0] = 0.990,  thisMagCal.finvW[0][1] = -0.022, thisMagCal.finvW[0][2] = -0.018

thisMagCal.finvW[1][0] = -0.022, thisMagCal.finvW[1][1] = 0.996,  thisMagCal.finvW[1][2]) = -0.032

thisMagCal.finvW[2][0] = -0.018, thisMagCal.finvW[2][1] = -0.032, thisMagCal.finvW[2][2] = 1.046

 

 

See attached file for the calibration data.

 

After RESET/POWER ON, I copied these data to thisMagCal structure and set fFitErrorpc = 10.0F;

 

I checked the heading and there is the big difference between original one.

Could you tell me where I did wrong? How long it will wait for the right data?

 

Thanks,

 

Christie

Original Attachment has been moved to: magnetics.txt.zip

Labels (1)
0 Kudos
1 Solution
629 Views
markpedley
NXP Employee
NXP Employee

iValidMagCal acts as both a flag and to identify the level of calibration model used.

4, 7, 10 mean the calibration was computed using the 4, 7 and 10 element models and in C these non-zero values are also interpreted a logical 'true' meaning there is a good calibration.

The calibration that you stored was computed with the 10 element calibration (since it has off diagonal matrix elements) so why not store iValidMagCal along with the calibration data and then read it in along with the calibration.

What you've done works but is slightly imprecise in that you've read in a 10 element calibration but told the software that it has a calibration (iValidMagCal = 4 is true) from the 4 element model.

Setting a value of 10% for the saved calibration probably about right. On power up, the old calibration may not be valid because of temperature changes so we want to replace it fairly quickly. As soon as new data is in the magnetic buffer, the new calibration will be computed and will almost certainly have a fit error below 10% and will therefore over-ride the stored value. The software replaces any calibration in use once it finds a solution with a lower fit error.

View solution in original post

0 Kudos
4 Replies
629 Views
markpedley
NXP Employee
NXP Employee

Make sure you have set the magnetic calibration flag iValidMagCal to true after reading in your stored calibration coefficients. Otherwise the software does not know it has a calibration and will not apply it.

0 Kudos
629 Views
a8Chcx
Contributor V

Hi Mark,

I tried to set iValidMagCal==4 and works fine. I have the following questions:

1) Which number should I use, 4, 7, 10?

2) I set FitError=10.0F, is it OK? Or there is better number?

3) What is FitError value to allow me to override the old saved data?

Thanks,

Christie

0 Kudos
630 Views
markpedley
NXP Employee
NXP Employee

iValidMagCal acts as both a flag and to identify the level of calibration model used.

4, 7, 10 mean the calibration was computed using the 4, 7 and 10 element models and in C these non-zero values are also interpreted a logical 'true' meaning there is a good calibration.

The calibration that you stored was computed with the 10 element calibration (since it has off diagonal matrix elements) so why not store iValidMagCal along with the calibration data and then read it in along with the calibration.

What you've done works but is slightly imprecise in that you've read in a 10 element calibration but told the software that it has a calibration (iValidMagCal = 4 is true) from the 4 element model.

Setting a value of 10% for the saved calibration probably about right. On power up, the old calibration may not be valid because of temperature changes so we want to replace it fairly quickly. As soon as new data is in the magnetic buffer, the new calibration will be computed and will almost certainly have a fit error below 10% and will therefore over-ride the stored value. The software replaces any calibration in use once it finds a solution with a lower fit error.

0 Kudos
629 Views
a8Chcx
Contributor V

Thanks, Mark.

0 Kudos