Add README. Add a few boards. Fix: CONFIG_GUESS boards output dump
information.
This commit is contained in:
parent
52a2615b4c
commit
861f57900f
7 changed files with 281 additions and 15 deletions
146
comedi_calibrate/README
Normal file
146
comedi_calibrate/README
Normal file
|
@ -0,0 +1,146 @@
|
|||
|
||||
I always seem to forget how to convert the calibration
|
||||
dump information into code for doing a calibration, so
|
||||
I'm writing this mostly for myself.
|
||||
|
||||
Boards may have one of 4 calibrations statuses, depending
|
||||
on how well the calibration code is trusted. These are:
|
||||
STATUS_NONE, the default for no information; STATUS_SOME,
|
||||
meaning that a dump has been converted to initial code,
|
||||
but not tested; STATUS_DONE means that the output of a
|
||||
STATUS_SOME dump has been checked, and is correct;
|
||||
STATUS_GUESS is a marker that code has been converted
|
||||
from a previous version of the code, but not checked.
|
||||
|
||||
The NI E series boards have several internal voltages that
|
||||
can be measured, and also several calibration DACs that function
|
||||
similar to adjustable resistors on old data acquisition boards.
|
||||
The information we need is which DACs affect which measurable
|
||||
voltages; then we can write calibration code that adjusts those
|
||||
DACs until the voltages are within spec.
|
||||
|
||||
Usually, there are DACs (or multiple DACs) that are added to
|
||||
an analog input signal: 1) before the variable gain amplifier
|
||||
("pre-gain"), 2) after the variable gain amplifier ("post-gain"),
|
||||
3) between the board's stable voltage reference and the
|
||||
reference input to the ADC ("gain offset"), and 4) before a
|
||||
unipolar-to-bipolar adjuster ("unipolar offset"), or other
|
||||
equivalent circuit.
|
||||
|
||||
In addition there are DACs that adjust the output voltages and/or
|
||||
reference voltage inputs to a D/A converter. These are pretty
|
||||
intuitive once analog input is understood, and is dependent on
|
||||
correct analog input calibration.
|
||||
|
||||
The measurable quantities are 0 volts and an internal voltage
|
||||
reference near 5 volts, and can be measured at any gain. The
|
||||
interesting combinations are:
|
||||
|
||||
ai, bipolar zero offset, low gain
|
||||
ai, bipolar zero offset, high gain
|
||||
ai, bipolar voltage reference, low gain
|
||||
ai, unipolar zero offset, low gain
|
||||
|
||||
The unipolar zero offset may not be available on some boards.
|
||||
|
||||
In a STATUS_NONE dump, for each measurable quantity and each
|
||||
calibration DAC, the DAC is varied throughout its entire range
|
||||
and the quantity measured. The data is linearly fit, and if
|
||||
the slope is statistically non-zero, a line is printed:
|
||||
|
||||
caldac[0] gain=1.26(11)e-7 V/bit S_min=235.659 dof=254
|
||||
|
||||
The information given is caldac index, slope (gain) and slope
|
||||
error (in parenthesis, modifying the last two digits of the
|
||||
slope), and two statistical parameters S_min and degrees
|
||||
of freedom. S_min and dof will be roughly similar for a
|
||||
good fit. If S_min is more than a factor of 4 greater than
|
||||
dof, this is probably not a good fit. Typically this means
|
||||
that the DAC doesn't affect the measureable strictly linearly,
|
||||
or there is systematic noise. The latter seems to common in
|
||||
E series boards, so I'm not too worried about the following
|
||||
dump where there are S_min/dof ratios above 4.
|
||||
|
||||
Here's an example dump, generated by a STATUS_NONE dump for
|
||||
a pci-mio-16xe-10, with the analog output section removed:
|
||||
|
||||
Warning: device not fully calibrated due to insufficient information
|
||||
Please send this output to <ds@schleef.org>
|
||||
Id: comedi_calibrate.c,v 1.21 2001/10/10 22:07:53 ds Exp
|
||||
Driver name: ni_pcimio
|
||||
Device name: pci-mio-16xe-10
|
||||
Comedi version: 0.7.61
|
||||
ai, bipolar zero offset, low gain
|
||||
offset -6.795(14)e-3, target 0
|
||||
caldac[0] gain=1.26(11)e-7 V/bit S_min=235.659 dof=254
|
||||
caldac[2] gain=3.96840(14)e-4 V/bit S_min=1390.18 dof=254
|
||||
caldac[3] gain=4.348(11)e-6 V/bit S_min=258.75 dof=254
|
||||
caldac[8] gain=5.4659(69)e-7 V/bit S_min=386.361 dof=254
|
||||
ai, bipolar zero offset, high gain
|
||||
offset -2.4224(55)e-4, target 0
|
||||
caldac[0] gain=3.61(45)e-9 V/bit S_min=247.26 dof=254
|
||||
caldac[2] gain=3.96644(48)e-6 V/bit S_min=351.927 dof=254
|
||||
caldac[3] gain=4.063(46)e-8 V/bit S_min=272.024 dof=254
|
||||
caldac[8] gain=5.46305(30)e-7 V/bit S_min=314.035 dof=254
|
||||
ai, bipolar voltage reference, low gain
|
||||
offset 4.992959(13), target 5
|
||||
caldac[0] gain=-4.4928(11)e-5 V/bit S_min=1111.4 dof=254
|
||||
caldac[1] gain=-2.792(11)e-6 V/bit S_min=248.971 dof=254
|
||||
caldac[2] gain=3.96488(14)e-4 V/bit S_min=1059.18 dof=254
|
||||
caldac[3] gain=4.318(11)e-6 V/bit S_min=437.441 dof=254
|
||||
caldac[8] gain=5.4810(70)e-7 V/bit S_min=404.213 dof=254
|
||||
ai, unipolar zero offset, low gain
|
||||
offset nan, target 0
|
||||
caldac[2] gain=3.96773(39)e-4 V/bit S_min=158.236 dof=107
|
||||
|
||||
[The explanation gets a little fuzzy here]
|
||||
|
||||
The resulting function for calibration will look something like:
|
||||
|
||||
void cal_ni_pci_mio_16xe_10(void)
|
||||
{
|
||||
postgain_cal(ni_zero_offset_low, ni_zero_offset_high, XXX);
|
||||
cal1(ni_zero_offset_high, XXX);
|
||||
cal1(ni_reference_low, XXX);
|
||||
cal1(ni_unip_offset_low, XXX);
|
||||
}
|
||||
|
||||
You get to fill in the XXX's. The post-gain calibration DAC will
|
||||
be the one for which the ratio of caldac slopes for the low and
|
||||
high gain measurables is similar to the ratio of input ranges for
|
||||
low and high gain. This ratio is typically 100 or 200, and really
|
||||
should be printed by the program. Thus, for this dump, we choose
|
||||
caldac[2], since the ratio is very nearly 100. We don't choose
|
||||
caldac[0] or caldac[3], because the gains are smaller, and the
|
||||
ratio isn't exactly 100 or 200.
|
||||
|
||||
Next is the pre-gain calibration. Adding a voltage before the
|
||||
amplifier will affect every input range selection equally, so the
|
||||
pre-gain cadac slope will be nearly equal for both bipolar zero
|
||||
offset at low and high gain. In this example, it would be caldac[8].
|
||||
|
||||
Next is the voltage reference calibration. The caldac controlling
|
||||
the voltage reference adjustment is proportional to the offset,
|
||||
so the correct caldac will typically be the one that has a large
|
||||
slope for the bipolar voltage reference measurement, but a small
|
||||
slope (by a factor of 2e4, here) for the zero offset measurements.
|
||||
It could be any of caldac[0], caldac[1], or caldac[3], or possibly
|
||||
all of them. We'll choose the caldac with the largest slope for
|
||||
rough calibration, then use the one with the smallest slope for
|
||||
fine calibration, namely caldac[0] and caldac[1].
|
||||
|
||||
This is one way that STATUS_SOME is useful, because you can calibrate
|
||||
the zero offset, then get a much better idea which other channels
|
||||
are likely to be for the voltage reference.
|
||||
|
||||
In this example, there doesn't appear to be a caldac that affects
|
||||
unipolar zero offset, so it will not be used in the final function:
|
||||
|
||||
void cal_ni_pci_mio_16xe_10(void)
|
||||
{
|
||||
postgain_cal(ni_zero_offset_low, ni_zero_offset_high, 2);
|
||||
cal1(ni_zero_offset_high, 8);
|
||||
cal1(ni_reference_low, 0);
|
||||
cal1(ni_reference_low, 1);
|
||||
}
|
||||
|
|
@ -177,6 +177,12 @@ ok:
|
|||
do_calibrate=1;
|
||||
do_results=1;
|
||||
}
|
||||
if(device_status==STATUS_GUESS){
|
||||
do_reset=1;
|
||||
do_dump=1;
|
||||
do_calibrate=1;
|
||||
do_results=1;
|
||||
}
|
||||
}
|
||||
if(verbose>=0){
|
||||
printf("$Id$\n");
|
||||
|
|
|
@ -49,6 +49,7 @@ void cal_ni_at_mio_16e_2(void);
|
|||
void cal_ni_daqcard_ai_16xe_50(void);
|
||||
void cal_ni_at_mio_16e_1(void);
|
||||
void cal_ni_pci_mio_16e_1(void);
|
||||
void cal_ni_pci_6025e(void);
|
||||
void cal_ni_pci_6035e(void);
|
||||
void cal_ni_pci_6071e(void);
|
||||
void cal_ni_pxi_6071e(void);
|
||||
|
@ -56,6 +57,7 @@ void cal_ni_at_mio_16e_10(void);
|
|||
void cal_ni_pci_mio_16xe_50(void);
|
||||
void cal_ni_pci_6023e(void);
|
||||
void cal_ni_at_mio_16xe_50(void);
|
||||
void cal_ni_pci_mio_16xe_10(void);
|
||||
|
||||
struct board_struct boards[]={
|
||||
{ "at-mio-16e-2", STATUS_DONE, cal_ni_at_mio_16e_2 },
|
||||
|
@ -63,19 +65,20 @@ struct board_struct boards[]={
|
|||
{ "at-mio-16xe-50", STATUS_SOME, cal_ni_at_mio_16xe_50 },
|
||||
{ "at-mio-16e-1", STATUS_SOME, cal_ni_at_mio_16e_1 },
|
||||
{ "pci-mio-16e-1", STATUS_SOME, cal_ni_pci_mio_16e_1 },
|
||||
{ "pci-6025e", STATUS_GUESS, cal_ni_pci_6025e },
|
||||
{ "pci-6035e", STATUS_GUESS, cal_ni_pci_6035e },
|
||||
{ "pci-6071e", STATUS_GUESS, cal_ni_pci_6071e },
|
||||
{ "pxi-6071e", STATUS_GUESS, cal_ni_pxi_6071e },
|
||||
{ "at-mio-16e-10", STATUS_GUESS, cal_ni_at_mio_16e_10 },
|
||||
{ "pci-mio-16xe-50", STATUS_GUESS, cal_ni_pci_mio_16xe_50 },
|
||||
{ "pci-6023e", STATUS_GUESS, cal_ni_pci_6023e },
|
||||
{ "pci-mio-16xe-10", STATUS_SOME, cal_ni_pci_mio_16xe_10 },
|
||||
#if 0
|
||||
// { "at-mio-16de-10", cal_ni_unknown },
|
||||
{ "at-mio-64e-3", cal_ni_16e_1 },
|
||||
// { "at-mio-16xe-50", cal_ni_unknown },
|
||||
// { "at-mio-16xe-10", cal_ni_unknown },
|
||||
// { "at-ai-16xe-10", cal_ni_unknown },
|
||||
{ "pci-mio-16xe-10", cal_ni_16xe_10 },
|
||||
// { "pxi-6030e", cal_ni_unknown },
|
||||
// { "pci-mio-16e-4", cal_ni_unknown },
|
||||
// { "pxi-6040e", cal_ni_unknown },
|
||||
|
@ -84,10 +87,8 @@ struct board_struct boards[]={
|
|||
// { "pci-6033e", cal_ni_unknown },
|
||||
// { "pci-6071e", cal_ni_unknown },
|
||||
{ "pci-6024e", cal_ni_6023e }, // guess
|
||||
{ "pci-6025e", cal_ni_6023e }, // guess
|
||||
{ "pxi-6025e", cal_ni_6023e }, // guess
|
||||
{ "pci-6034e", cal_ni_6023e }, // guess
|
||||
{ "pci-6035e", cal_ni_6023e },
|
||||
// { "pci-6052e", cal_ni_unknown },
|
||||
// { "pci-6110e", cal_ni_unknown },
|
||||
// { "pci-6111e", cal_ni_unknown },
|
||||
|
@ -131,7 +132,8 @@ void ni_setup_board(void)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//device_status = STATUS_UNKNOWN;
|
||||
//do_cal = cal_ni_unknown;
|
||||
}
|
||||
|
||||
void ni_setup_observables(void)
|
||||
|
@ -302,14 +304,15 @@ void cal_ni_daqcard_ai_16xe_50(void)
|
|||
postgain_cal(ni_zero_offset_low,ni_zero_offset_high,2);
|
||||
cal1(ni_zero_offset_high,8);
|
||||
cal1(ni_reference_low,0);
|
||||
cal1(ni_reference_low,1);
|
||||
}
|
||||
|
||||
void cal_ni_at_mio_16xe_50(void)
|
||||
{
|
||||
postgain_cal(ni_zero_offset_low,ni_zero_offset_high,2);
|
||||
cal1(ni_zero_offset_high,8);
|
||||
cal1(ni_reference_low,0);
|
||||
cal1(ni_reference_low,1);
|
||||
//cal1(ni_reference_low,0); /* also might be useful */
|
||||
|
||||
if(do_output){
|
||||
cal1(ni_ao0_zero_offset,6);
|
||||
|
@ -319,6 +322,21 @@ void cal_ni_at_mio_16xe_50(void)
|
|||
}
|
||||
}
|
||||
|
||||
void cal_ni_pci_mio_16xe_10(void)
|
||||
{
|
||||
postgain_cal(ni_zero_offset_low, ni_zero_offset_high, 2);
|
||||
cal1(ni_zero_offset_high, 8);
|
||||
cal1(ni_reference_low, 0);
|
||||
cal1(ni_reference_low, 1);
|
||||
|
||||
if(do_output){
|
||||
cal1(ni_ao0_zero_offset,6);
|
||||
cal1(ni_ao0_reference,4);
|
||||
cal1(ni_ao1_zero_offset,7);
|
||||
cal1(ni_ao1_reference,5);
|
||||
}
|
||||
}
|
||||
|
||||
void cal_ni_at_mio_16e_1(void)
|
||||
{
|
||||
cal_ni_at_mio_16e_2();
|
||||
|
@ -394,6 +412,19 @@ void cal_ni_pci_6023e(void)
|
|||
cal_ni_pci_6035e();
|
||||
}
|
||||
|
||||
void cal_ni_pci_6025e(void)
|
||||
{
|
||||
postgain_cal(ni_zero_offset_low,ni_zero_offset_high,1);
|
||||
cal1(ni_zero_offset_high,0);
|
||||
cal1(ni_reference_low,3);
|
||||
if(do_output){
|
||||
cal1(ni_ao0_zero_offset,4); // guess
|
||||
cal1(ni_ao0_reference,5); // guess
|
||||
cal1(ni_ao1_zero_offset,8); // guess
|
||||
cal1(ni_ao1_reference,9); // guess
|
||||
}
|
||||
}
|
||||
|
||||
double ni_get_reference(int lsb_loc,int msb_loc)
|
||||
{
|
||||
int lsb,msb;
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
|
||||
Hello Dave,
|
||||
|
||||
I took it from CVS and here is the output:
|
||||
|
||||
|
||||
Warning: device not fully calibrated due to insufficient information
|
||||
Please send this output to <ds@schleef.org>
|
||||
$Id$
|
||||
|
@ -56,7 +50,3 @@ caldac[2] gain=1.5662(11)e-5 V/bit S_min=332.322 dof=254
|
|||
caldac[5] gain=-1.91787(12)e-4 V/bit S_min=1112.43 dof=254
|
||||
caldac[7] gain=-3.87472(13)e-4 V/bit S_min=1465.5 dof=254
|
||||
caldac[8] gain=1.7720(72)e-7 V/bit S_min=304.338 dof=254
|
||||
|
||||
thanks
|
||||
norbert
|
||||
|
||||
|
|
16
comedi_calibrate/results/pci-6071e
Normal file
16
comedi_calibrate/results/pci-6071e
Normal file
|
@ -0,0 +1,16 @@
|
|||
Warning: device not fully calibrated due to insufficient information
|
||||
Please send this output to <ds@schleef.org>
|
||||
$Id$
|
||||
Driver name: ni_pcimio
|
||||
Device name: pci-6071e
|
||||
Comedi version: 0.7.61
|
||||
postgain: ai, bipolar zero offset, low gain; ai, bipolar zero offset, high gain
|
||||
caldac[1] gain=-7.8199(21)e-4 V/bit S_min=499.462 dof=254
|
||||
caldac[1] gain=-3.9085(14)e-6 V/bit S_min=480.297 dof=254
|
||||
caldac[1] set to 113.476
|
||||
linear: ai, bipolar zero offset, high gain
|
||||
caldac[0] gain=-8.6007(14)e-6 V/bit S_min=369.586 dof=254
|
||||
caldac[0] set to 143.069
|
||||
linear: ai, bipolar voltage reference, low gain
|
||||
caldac[3] gain=-4.7227(21)e-4 V/bit S_min=522.886 dof=254
|
||||
caldac[3] set to 149.506
|
16
comedi_calibrate/results/pci-6713
Normal file
16
comedi_calibrate/results/pci-6713
Normal file
|
@ -0,0 +1,16 @@
|
|||
Warning: device not fully calibrated due to insufficient information
|
||||
Please send this output to <ds@schleef.org>
|
||||
$Id$
|
||||
Driver name: ni_pcimio
|
||||
Device name: pci-6713
|
||||
Comedi version: 0.7.61
|
||||
ai, bipolar zero offset, low gain
|
||||
insn barfed: subdev=0, chan=0, range=255, aref=3, n=128, ret=-1, Invalid argument
|
||||
barf
|
||||
offset 0.0( 0)e-2147483648, target 0
|
||||
insn barfed: subdev=0, chan=0, range=255, aref=3, n=128, ret=-1, Invalid argument
|
||||
barf
|
||||
insn barfed: subdev=0, chan=0, range=255, aref=3, n=128, ret=-1, Invalid argument
|
||||
barf
|
||||
insn barfed: subdev=0, chan=0, range=255, aref=3, n=128, ret=-1, Invalid argument
|
||||
barf
|
61
comedi_calibrate/results/pci-mio-16xe-10
Normal file
61
comedi_calibrate/results/pci-mio-16xe-10
Normal file
|
@ -0,0 +1,61 @@
|
|||
Warning: device not fully calibrated due to insufficient information
|
||||
Please send this output to <ds@schleef.org>
|
||||
$Id$
|
||||
Driver name: ni_pcimio
|
||||
Device name: pci-mio-16xe-10
|
||||
Comedi version: 0.7.61
|
||||
ai, bipolar zero offset, low gain
|
||||
offset -6.795(14)e-3, target 0
|
||||
caldac[0] gain=1.26(11)e-7 V/bit S_min=235.659 dof=254
|
||||
caldac[2] gain=3.96840(14)e-4 V/bit S_min=1390.18 dof=254
|
||||
caldac[3] gain=4.348(11)e-6 V/bit S_min=258.75 dof=254
|
||||
caldac[8] gain=5.4659(69)e-7 V/bit S_min=386.361 dof=254
|
||||
ai, bipolar zero offset, high gain
|
||||
offset -2.4224(55)e-4, target 0
|
||||
caldac[0] gain=3.61(45)e-9 V/bit S_min=247.26 dof=254
|
||||
caldac[2] gain=3.96644(48)e-6 V/bit S_min=351.927 dof=254
|
||||
caldac[3] gain=4.063(46)e-8 V/bit S_min=272.024 dof=254
|
||||
caldac[8] gain=5.46305(30)e-7 V/bit S_min=314.035 dof=254
|
||||
ai, bipolar voltage reference, low gain
|
||||
offset 4.992959(13), target 5
|
||||
caldac[0] gain=-4.4928(11)e-5 V/bit S_min=1111.4 dof=254
|
||||
caldac[1] gain=-2.792(11)e-6 V/bit S_min=248.971 dof=254
|
||||
caldac[2] gain=3.96488(14)e-4 V/bit S_min=1059.18 dof=254
|
||||
caldac[3] gain=4.318(11)e-6 V/bit S_min=437.441 dof=254
|
||||
caldac[8] gain=5.4810(70)e-7 V/bit S_min=404.213 dof=254
|
||||
ai, unipolar zero offset, low gain
|
||||
offset nan, target 0
|
||||
caldac[2] gain=3.96773(39)e-4 V/bit S_min=158.236 dof=107
|
||||
ao 0, zero offset, low gain
|
||||
offset -8.946(13)e-3, target 0.00015259
|
||||
caldac[0] gain=1.28(12)e-7 V/bit S_min=309.214 dof=254
|
||||
caldac[2] gain=3.96806(14)e-4 V/bit S_min=1051.91 dof=254
|
||||
caldac[3] gain=4.258(12)e-6 V/bit S_min=237.016 dof=254
|
||||
caldac[4] gain=-6.2(12)e-8 V/bit S_min=256.812 dof=254
|
||||
caldac[6] gain=-7.6740(12)e-5 V/bit S_min=754.459 dof=254
|
||||
caldac[7] gain=5.3(12)e-8 V/bit S_min=283.48 dof=254
|
||||
caldac[8] gain=5.4530(71)e-7 V/bit S_min=431.616 dof=254
|
||||
ao 0, reference voltage, low gain
|
||||
offset -0.011399(15), target -7.62951e-05
|
||||
caldac[0] gain=1.09(12)e-7 V/bit S_min=302.48 dof=254
|
||||
caldac[2] gain=3.96841(15)e-4 V/bit S_min=1104.72 dof=254
|
||||
caldac[3] gain=4.296(12)e-6 V/bit S_min=287.18 dof=254
|
||||
caldac[4] gain=3.8964(12)e-5 V/bit S_min=588.472 dof=254
|
||||
caldac[6] gain=-7.6724(12)e-5 V/bit S_min=689.86 dof=254
|
||||
caldac[8] gain=5.4979(76)e-7 V/bit S_min=280.029 dof=254
|
||||
ao 1, zero offset, low gain
|
||||
offset -7.100(12)e-3, target 0.00015259
|
||||
caldac[0] gain=1.25(12)e-7 V/bit S_min=290.836 dof=254
|
||||
caldac[2] gain=3.96846(14)e-4 V/bit S_min=1387.23 dof=254
|
||||
caldac[3] gain=4.291(11)e-6 V/bit S_min=368.089 dof=254
|
||||
caldac[7] gain=-7.7009(11)e-5 V/bit S_min=1231.29 dof=254
|
||||
caldac[8] gain=5.4827(70)e-7 V/bit S_min=410.106 dof=254
|
||||
ao 1, reference voltage, low gain
|
||||
offset -2.508609(14), target -7.62951e-05
|
||||
caldac[0] gain=2.2683(12)e-5 V/bit S_min=548.448 dof=254
|
||||
caldac[1] gain=1.339(12)e-6 V/bit S_min=286.665 dof=254
|
||||
caldac[2] gain=3.97015(14)e-4 V/bit S_min=1538.98 dof=254
|
||||
caldac[3] gain=4.319(12)e-6 V/bit S_min=333.242 dof=254
|
||||
caldac[5] gain=1.9542(12)e-5 V/bit S_min=453.123 dof=254
|
||||
caldac[7] gain=-7.6990(12)e-5 V/bit S_min=1390.82 dof=254
|
||||
caldac[8] gain=5.5079(73)e-7 V/bit S_min=297.996 dof=254
|
Loading…
Add table
Reference in a new issue