# HG changeset patch # User Mychaela Falconia # Date 1622775738 0 # Node ID 5f9dd4056420c9c5790139fcb538bc434d35159c # Parent 72eac15f0917c2a33e728b7b7e200ddb25c83921 vbat-adc/crude-cal-test: an experiment to prove VBAT MADC linearity diff -r 72eac15f0917 -r 5f9dd4056420 vbat-adc/crude-cal-test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vbat-adc/crude-cal-test Fri Jun 04 03:02:18 2021 +0000 @@ -0,0 +1,81 @@ +The data table that follows captures the results of this experiment: + +* An FCDEV3B modem board was powered from a bench PSU whose output voltage + is controlled by an analog rotary knob; + +* The PSU voltage knob was turned up and down to produce 0.1 V steps + from 3.2 V to 4.2 V; + +* At each PSU voltage step, VBAT MADC reading was captured with an + mpr 30 command in fc-tmsh, and the actual voltage was measured with a + digital multimeter. + +PSU voltage MADC reading Voltmeter reading +------------------------------------------------- +3.2 V 473 3207 mV +3.3 V 488 3306 mV +3.4 V 502 3403 mV +3.5 V 517 3500 mV +3.6 V 532 3597 mV +3.7 V 546 3696 mV +3.8 V 562 3804 mV +3.9 V 576 3897 mV +4.0 V 592-593 [1] 4003 mV +4.1 V 606 4.08-4.09 V [2] +4.2 V 621 4.18-4.19 V [2] + +[1] on the cusp of MADC step, got alternating readings + +[2] My cheap multimeter's 4 V range was exceeded at this point, and I had +to switch to the next higher range in which only two digits after the +decimal point were displayed. + +If we apply the firmware's default VBAT calibration values of A=7000 B=0, +we see that VBAT numbers computed from MADC readings are higher than the +true VBAT by 24 mV at the low 3.2 V end and by 45 mV at the high 4.2 V end. + +Calibration math attempt from 3207 to 4003 mV, using MADC=592 at high end +========================================================================= + +A=(4003-3207)/(592-473)*1024 = 6849 + +B parameter computed from each calibration point: + +MADC reading Voltmeter reading Computed VBAT w/o B B parameter +--------------------------------------------------------------------------- +473 3207 mV 3163 44 +488 3306 mV 3263 43 +502 3403 mV 3357 46 +517 3500 mV 3457 43 +532 3597 mV 3558 39 +546 3696 mV 3651 45 +562 3804 mV 3758 46 +576 3897 mV 3852 45 +592 4003 mV 3959 44 + +B values range from 39 to 46, a very small variation - thus the behaviour of +VBAT MADC really does fit the linear model, and linear calibration really does +work well. + +Calibration math attempt from 3207 to 4003 mV, using MADC=593 at high end +========================================================================= + +A=(4003-3207)/(593-473)*1024 = 6792 + +B parameter computed from each calibration point: + +MADC reading Voltmeter reading Computed VBAT w/o B B parameter +--------------------------------------------------------------------------- +473 3207 mV 3137 70 +488 3306 mV 3236 70 +502 3403 mV 3329 74 +517 3500 mV 3429 71 +532 3597 mV 3528 69 +546 3696 mV 3621 75 +562 3804 mV 3727 77 +576 3897 mV 3820 77 +593 4003 mV 3933 70 + +B values range from 69 to 77, still a very small variation - thus we are not +too terribly sensitive to errors in the A parameter resulting from MADC values +being on the cusp.