analogy calibration issue(s)
Hi -
I am migrating a xenomai 2.5.4 application to the cobalt core. I have xenomai 3.0-rc5 installed with 3.18.12.
I have a NI PCI 6250 card that is attached via analogy_config. I can successfully run the insn_read command that is installed with the user space support by running:
sudo ./insn_read -d analogy0 -c 3 -R 0 --verbose
This prints out a set of values close to what I am expecting (5V)
I then attempt to use the analogy calibration feature added to Xenomai 3 by running:
sudo ./analogy_calibrate --device=analogy0 --output=calvals.bin
This prints out the following:
0"000.079| calibration output: calvals.binls 0"004.427| calibrating device: analogy_ni_pcimio 0"255.934| Polynomial : 0"255.972| order = 3 0"255.995| expansion origin = 32767.000000 0"256.026| order 0 coefficient = 32867.5 0"256.051| order 1 coefficient = 0.949174 0"256.075| order 2 coefficient = -1.45506e-07 0"256.099| order 3 coefficient = -6.56837e-12 0"283.024| volt_ref = 6.9204 0"283.060| measured_gnd_cde = 32770.9, linearized_gnd_cde = 32871.3 0"283.082| measured_ref_cde = 54247.1, linearized_ref_cde = 53123.6 0"283.099| full_correction(measured_gnd_cde) = 8.88619e-16 0"283.113| full_correction(measured_ref_cde) = 6.9204 0"283.126| Polynomial : 0"283.139| order = 3 0"283.154| expansion origin = 32767.000000 0"283.171| order 0 coefficient = -0.0012794 0"283.188| order 1 coefficient = 0.000324341 0"283.204| order 2 coefficient = -4.97205e-11 0"283.221| order 3 coefficient = -2.24447e-15 0"283.294| Calibrating AI: �m 0"283.329| upTicks=32 code=60408.4 pwm_cal=9.01368
adrange_cal=8.87857 lsb_error=-421.704
0"283.348| upTicks=64 code=57672.3 pwm_cal=8.01405
adrange_cal=8.01103 lsb_error=-9.45353
0"283.364| upTicks=96 code=54576.5 pwm_cal=7.01443
adrange_cal=7.02551 lsb_error=34.5815
0"283.380| upTicks=128 code=51476.6 pwm_cal=6.01481
adrange_cal=6.0349 lsb_error=62.7115
0"283.396| upTicks=160 code=48378.7 pwm_cal=5.01519
adrange_cal=5.04158 lsb_error=82.3696
0"283.412| upTicks=192 code=45280.8 pwm_cal=4.01557
adrange_cal=4.04528 lsb_error=92.7275
0"283.428| upTicks=224 code=42183.3 pwm_cal=3.01595
adrange_cal=3.04652 lsb_error=95.4243
0"283.444| upTicks=256 code=39086.4 pwm_cal=2.01633
adrange_cal=2.0458 lsb_error=91.9984
0"283.463| upTicks=288 code=35987.9 pwm_cal=1.01671
adrange_cal=1.04281 lsb_error=81.4655
0"283.479| upTicks=320 code=32889.6 pwm_cal=0.0170864
adrange_cal=0.0384727 lsb_error=66.7551
0"283.495| upTicks=352 code=29792.5 pwm_cal=-0.982535
adrange_cal=-0.966418 lsb_error=50.3061
0"283.512| upTicks=384 code=26694.2 pwm_cal=-1.98216
adrange_cal=-1.97227 lsb_error=30.8585
0"283.528| upTicks=416 code=23595.5 pwm_cal=-2.98178
adrange_cal=-2.97842 lsb_error=10.4653
0"283.544| upTicks=448 code=20497.8 pwm_cal=-3.9814
adrange_cal=-3.98403 lsb_error=-8.22739
0"283.560| upTicks=480 code=17399.5 pwm_cal=-4.98102
adrange_cal=-4.98919 lsb_error=-25.515
0"283.576| upTicks=512 code=14302.1 pwm_cal=-5.98064
adrange_cal=-5.99302 lsb_error=-38.6486
0"283.592| upTicks=544 code=11205.1 pwm_cal=-6.98026
adrange_cal=-6.99529 lsb_error=-46.9177
0"283.608| upTicks=576 code=8106.3 pwm_cal=-7.97988
adrange_cal=-7.99633 lsb_error=-51.3279
0"283.624| upTicks=608 code=5007.67 pwm_cal=-8.9795
adrange_cal=-8.99506 lsb_error=-48.5709
0"283.640| upTicks=640 code=1897.36 pwm_cal=-9.97912
adrange_cal=-9.99492 lsb_error=-49.2985
0"283.657| calibrating range 1 0"283.671| adjusted rng_max: 4.5 0"308.777| volt_ref = 4.51538 0"308.799| measured_gnd_cde = 32770.8, linearized_gnd_cde = 32871.1 0"308.818| measured_ref_cde = 60800.9, linearized_ref_cde = 59217.5 0"308.837| full_correction(measured_gnd_cde) = 1.45201e-16 0"308.853| full_correction(measured_ref_cde) = 4.51538 0"308.867| Polynomial : 0"308.883| order = 3 0"308.902| expansion origin = 32767.000000 0"308.923| order 0 coefficient = -0.000613011 0"308.947| order 1 coefficient = 0.000162674 0"308.971| order 2 coefficient = -2.49375e-11 0"308.995| order 3 coefficient = -1.12572e-15 0"309.050| done 0"309.071| calibrating range 2 0"309.085| adjusted rng_max: 1.8 0"334.173| volt_ref = 1.79766 0"334.198| measured_gnd_cde = 32770.2, linearized_gnd_cde = 32870.6 0"334.221| measured_ref_cde = 60734.4, linearized_ref_cde = 59155.9 0"334.241| full_correction(measured_gnd_cde) = 2.63117e-16 0"334.257| full_correction(measured_ref_cde) = 1.79766 0"334.271| Polynomial : 0"334.286| order = 3 0"334.310| expansion origin = 32767.000000 0"334.334| order 0 coefficient = -0.000210829 0"334.358| order 1 coefficient = 6.49143e-05 0"334.381| order 2 coefficient = -9.95116e-12 0"334.405| order 3 coefficient = -4.49212e-16 0"334.429| done
NOTE: there appears to be a print bug above (0"283.294| Calibrating AI: �m)
I then run the following command to utilize those calibration values:
sudo ./insn_read -d analogy0 -c 0 -R 0 -y calvals.bin
This does not print out anything. Watching top shows that lt-insn_read consumes 100% of a processor and its memory consumption increases over time until causing the system to halt.
After some unorganized debugging, I've found:
+ That the output file (calvals.bin) has size of 0 bytes.
+ When running the insn_read command with "--verbose", nothing is printed out.
+ dmesg shows " lt-analogy_cali[21843]: segfault at 7 ip 00007fc68943aa03 sp 00007fff415993d0 error 4 in libc-2.19.so[7fc6893ef000+1bb000]"
+ there appears to never be a call to fclose on FILE p, which most likely explains the fact that the file size is 0, HOWEVER - adding random printf statements in calibration_ni_m.c eventually leads to a calibration file being created with a non-zero size
+ running insn_read with the non-zero calibration file still leads to a infinite process time with nothing ever printed out and continued consumption of memory and processor until either the system halts or the process it killed
Has anyone successfully used the calibration feature?
Yogi
Quoted 27 lines · Yogi A. Patel
Hi -
I am migrating a xenomai 2.5.4 application to the cobalt core. I have xenomai 3.0-rc5 installed with 3.18.12.
I have a NI PCI 6250 card that is attached via
analogy_config. I can successfully run theinsn_readcommand that is installed with the user space support by running:sudo ./insn_read -d analogy0 -c 3 -R 0 --verbose
This prints out a set of values close to what I am expecting (5V)
I then attempt to use the analogy calibration feature added to Xenomai 3 by running:
sudo ./analogy_calibrate --device=analogy0 --output=calvals.bin
This prints out the following:
0"000.079| calibration output: calvals.binls 0"004.427| calibrating device: analogy_ni_pcimio 0"255.934| Polynomial : 0"255.972| order = 3 0"255.995| expansion origin = 32767.000000 0"256.026| order 0 coefficient = 32867.5 0"256.051| order 1 coefficient = 0.949174
...
Quoted 2 lines
NOTE: there appears to be a print bug above (0"283.294| Calibrating AI: �m)
apply the following:
[jramirez@calypso ~ (master *)]$ git diff calibration_ni_m.c
utils/analogy/calibration_ni_m.c +1 -1
@@ -973,7 +973,7 @@ static int ni_m_calibrate_ai(void)* calibrate low, medium and high gain ranges */ for (i =0 ; i <ARRAY_LEN (cal_info); i++) { -__debug ("Calibrating AI: %s \n" , cal_info[i]); +__debug ("Calibrating AI: %s \n" , cal_info[i].message);if (cal_info[i].range >=0 ) goto calibrate;
Quoted 1 line
Quoted 1 line
Has anyone successfully used the calibration feature?
it seemed to work ok when I wrote the code some time ago on the 6220 I think it was. Please could you post the contents of the calibration file?
Quoted 49 lines · Jorge Ramirez Ortiz
Quoted 27 lines · Yogi A. Patel
Hi -
I am migrating a xenomai 2.5.4 application to the cobalt core. I have xenomai 3.0-rc5 installed with 3.18.12.
I have a NI PCI 6250 card that is attached via
analogy_config. I can successfully run theinsn_readcommand that is installed with the user space support by running:sudo ./insn_read -d analogy0 -c 3 -R 0 --verbose
This prints out a set of values close to what I am expecting (5V)
I then attempt to use the analogy calibration feature added to Xenomai 3 by running:
sudo ./analogy_calibrate --device=analogy0 --output=calvals.bin
This prints out the following:
0"000.079| calibration output: calvals.binls 0"004.427| calibrating device: analogy_ni_pcimio 0"255.934| Polynomial : 0"255.972| order = 3 0"255.995| expansion origin = 32767.000000 0"256.026| order 0 coefficient = 32867.5 0"256.051| order 1 coefficient = 0.949174...
Quoted 1 line
NOTE: there appears to be a print bug above (0"283.294| Calibrating AI: �m)
apply the following:
[jramirez@calypso ~ (master *)]$ git diff
calibration_ni_m.cutils/analogy/calibration_ni_m.c +1
-1@@ -973,7 +973,7 @@ static int ni_m_calibrate_ai(void)* calibrate low, medium and high gain ranges */ for (i =0 ; i <ARRAY_LEN (cal_info); i++) { -__debug ("Calibrating AI: %s \n" , cal_info[i]); +__debug ("Calibrating AI: %s \n" , cal_info[i].message);if (cal_info[i].range >=0 ) goto calibrate;
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Has anyone successfully used the calibration feature?
it seemed to work ok when I wrote the code some time ago on the 6220 I think it was. Please could you post the contents of the calibration file?
The calibration file output is:
[platform]driver_name = analogy_ni_pcimio;board_name = pci-6250;
[analog_input]
index = 0;
elements = 7;
[analog_input_0]
channel = -1;
range = 0;expansion_origin = 6.95327e-310;
nbcoeff= 4;coeff_0 = 6.36599e-314;coeff_1 = 6.95327e-310;coeff_2 = 4.94066e-324;coeff_3 = 6.95187e-310;
[analog_input_1]
channel = -1;
range = 1;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = -0.000597716;coeff_1 = 0.000162699;coeff_2 = -2.5516e-11;coeff_3 = -1.15365e-15;
[analog_input_2]
channel = -1;
range = 2;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = -0.000204136;coeff_1 = 6.4913e-05;coeff_2 = -1.01803e-11;coeff_3 = -4.60278e-16;
[analog_input_3]
channel = -1;
range = 3;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = -7.99442e-05;coeff_1 = 3.25526e-05;coeff_2 = -5.10522e-12;coeff_3 = -2.3082e-16;
[analog_input_4]
channel = -1;
range = 4;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = -1.47307e-05;coeff_1 = 1.62562e-05;coeff_2 = -2.54945e-12;coeff_3 = -1.15267e-16;
[analog_input_5]
channel = -1;
range = 5;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = 2.13154e-05;coeff_1 = 6.51906e-06;coeff_2 = -1.02238e-12;coeff_3 = -4.62246e-17;
[analog_input_6]
channel = -1;
range = 6;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = 3.44007e-05;coeff_1 = 3.253e-06;coeff_2 = -5.10168e-13;coeff_3 = -2.3066e-17;
Quoted 118 lines · Yogi A. Patel
Quoted 49 lines · Jorge Ramirez Ortiz
Quoted 27 lines · Yogi A. Patel
Hi -
I am migrating a xenomai 2.5.4 application to the cobalt core. I have xenomai 3.0-rc5 installed with 3.18.12.
I have a NI PCI 6250 card that is attached via
analogy_config. I can successfully run theinsn_readcommand that is installed with the user space support by running:sudo ./insn_read -d analogy0 -c 3 -R 0 --verbose
This prints out a set of values close to what I am expecting (5V)
I then attempt to use the analogy calibration feature added to Xenomai 3 by running:
sudo ./analogy_calibrate --device=analogy0 --output=calvals.bin
This prints out the following:
0"000.079| calibration output: calvals.binls 0"004.427| calibrating device: analogy_ni_pcimio 0"255.934| Polynomial : 0"255.972| order = 3 0"255.995| expansion origin = 32767.000000 0"256.026| order 0 coefficient = 32867.5 0"256.051| order 1 coefficient = 0.949174...
Quoted 1 line
NOTE: there appears to be a print bug above (0"283.294| Calibrating AI: �m)
apply the following:
[jramirez@calypso ~ (master *)]$ git diff
calibration_ni_m.cutils/analogy/calibration_ni_m.c +1
-1@@ -973,7 +973,7 @@ static int ni_m_calibrate_ai(void)* calibrate low, medium and high gain ranges */ for (i =0 ; i <ARRAY_LEN (cal_info); i++) { -__debug ("Calibrating AI: %s \n" , cal_info[i]); +__debug ("Calibrating AI: %s \n" , cal_info[i].message);if (cal_info[i].range >=0 ) goto calibrate;Quoted 4 lines
Quoted 1 line
Quoted 1 line
Has anyone successfully used the calibration feature?
it seemed to work ok when I wrote the code some time ago on the 6220 I think it was.
Please could you post the contents of the calibration file?The calibration file output is:
[platform]
driver_name=analogy_ni_pcimio;board_name= pci-6250;[
analog_input]
index = 0;
elements = 7;
[analog_input_0]
channel = -1;
range = 0;expansion_origin= 6.95327e-310;
nbcoeff= 4;coeff_0= 6.36599e-314;coeff_1= 6.95327e-310;coeff_2= 4.94066e-324;coeff_3= 6.95187e-310;
[analog_input_1]
channel = -1;
range = 1;expansion_origin= 32767;
nbcoeff= 4;coeff_0= -0.000597716;coeff_1= 0.000162699;coeff_2= -2.5516e-11;coeff_3= -1.15365e-15;
[analog_input_2]
channel = -1;
range = 2;expansion_origin= 32767;
nbcoeff= 4;coeff_0= -0.000204136;coeff_1= 6.4913e-05;coeff_2= -1.01803e-11;coeff_3= -4.60278e-16;
[analog_input_3]
channel = -1;
range = 3;expansion_origin= 32767;
nbcoeff= 4;coeff_0= -7.99442e-05;coeff_1= 3.25526e-05;coeff_2= -5.10522e-12;coeff_3= -2.3082e-16;
[analog_input_4]
channel = -1;
range = 4;expansion_origin= 32767;
nbcoeff= 4;coeff_0= -1.47307e-05;coeff_1= 1.62562e-05;coeff_2= -2.54945e-12;coeff_3= -1.15267e-16;
[analog_input_5]
channel = -1;
range = 5;expansion_origin= 32767;
nbcoeff= 4;coeff_0= 2.13154e-05;coeff_1= 6.51906e-06;coeff_2= -1.02238e-12;coeff_3= -4.62246e-17;
[analog_input_6]
Quoted 9 lines
channel = -1;
range = 6;expansion_origin= 32767;
nbcoeff= 4;coeff_0= 3.44007e-05;coeff_1= 3.253e-06;coeff_2= -5.10168e-13;coeff_3= -2.3066e-17;
This file doesn't seem to correspond to the trace you previously sent. please could you share:
1. a complete trace
2. the corresponding calibration file
Also you should be able to use insn_read without applying any calibration (does this work on your setup?)
I'll try to replicate on my side but there is no reason why you cant gdb those programs as well.
What kernel are you using and what Xenomai commit?
Signature · 1 line
jro
Quoted 4 lines
Has anyone successfully used the calibration feature?
Seems to be working on my end (the calibration file is always generated).
# analogy_config analogy0 analogy_ni_pcimio # analogy_calibrate --device=analogy0 --output=file # insn_read -d analogy0 -c 0 -R 0 -y /root/file Calibrated values: 9.116142 9.115817 9.115817 9.116142 9.115817 9.115817 9.116142 9.115817 9.115817 9.115817
~ # cat /proc/analogy/devices
-- Analogy devices --
| idx | status | driver | 00 | Linked | pci-6221 | 01 | Unused | No driver | 02 | Unused | No driver | 03 | Unused | No driver | 04 | Unused | No driver | 05 | Unused | No driver | 06 | Unused | No driver | 07 | Unused | No driver | 08 | Unused | No driver | 09 | Unused | No driver
~ # cat /proc/analogy/drivers
-- Analogy drivers --
| idx | board name | 00 | analogy_ni_pcimio | 01 | analogy_8255
~ #
# uname -a Linux nestor 3.14.44+ #4 PREEMPT Thu Aug 6 19:09:08 CEST 2015 i686 GNU/Linux
# cat /proc/xenomai/version 3.0-rc6
# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 8 model name : Pentium III (Coppermine) [...]
Signature · 1 line
jro
When I run
sudo ./analogy_calibrate --device=analogy0 --output=file
I see
[ 1124.191097] analogy_calibra[2822]: segfault at 7 ip 00007f10b88c6a03 sp 00007fffaee2bb40 error 4 in libc-2.19.so[7f10b887b000+1bb000]
on two computers running Xenomai RC5 with Linux 3.18.12 both with NI DAQs installed (M-Series).
Quoted 56 lines · Jorge Ramirez Ortiz
Quoted 2 lines
Has anyone successfully used the calibration feature?
Seems to be working on my end (the calibration file is always generated).
# analogy_config analogy0 analogy_ni_pcimio # analogy_calibrate --device=analogy0 --output=file # insn_read -d analogy0 -c 0 -R 0 -y /root/file Calibrated values: 9.116142 9.115817 9.115817 9.116142 9.115817 9.115817 9.116142 9.115817 9.115817 9.115817~ # cat
/proc/analogy/devices
-- Analogy devices --| idx | status | driver | 00 | Linked | pci-6221 | 01 | Unused | No driver | 02 | Unused | No driver | 03 | Unused | No driver | 04 | Unused | No driver | 05 | Unused | No driver | 06 | Unused | No driver | 07 | Unused | No driver | 08 | Unused | No driver | 09 | Unused | No driver~ # cat
/proc/analogy/drivers
-- Analogy drivers --| idx | board name | 00 | analogy_ni_pcimio | 01 | analogy_8255~ #
# uname -a Linux nestor 3.14.44+ #4 PREEMPT Thu Aug 6 19:09:08 CEST 2015 i686 GNU/Linux# cat /proc/xenomai/version 3.0-rc6# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 8 model name : Pentium III (Coppermine) [...]
Signature · 1 line
Yogi
Quoted 11 lines · Yogi A. Patel
When I run
sudo ./analogy_calibrate --device=analogy0 --output=file
I see
[ 1124.191097] analogy_calibra[2822]: segfault at 7 ip 00007f10b88c6a03 sp
00007fffaee2bb40error 4 in libc-2.19.so[7f10b887b000+1bb000]on two computers running Xenomai RC5 with Linux 3.18.12 both with NI DAQs installed (M-Series).
please send the procs /proc/analogy/*
can you run analogy_calibrate under gdb?
Quoted 11 lines · Yogi A. Patel
When I run
sudo ./analogy_calibrate --device=analogy0 --output=file
I see
[ 1124.191097] analogy_calibra[2822]: segfault at 7 ip 00007f10b88c6a03 sp
00007fffaee2bb40error 4 in libc-2.19.so[7f10b887b000+1bb000]on two computers running Xenomai RC5 with Linux 3.18.12 both with NI DAQs installed (M-Series).
Please upgrade to rc6, so that you and Jorge actually talk about the same version.
Signature · 2 lines
Gilles. https://click-hack.org
Quoted 10 lines · Jorge Ramirez Ortiz
Quoted 6 lines · Yogi A. Patel
When I run
sudo ./analogy_calibrate --device=analogy0 --output=file
I see
Quoted 7 lines
Quoted 5 lines
[ 1124.191097] analogy_calibra[2822]: segfault at 7 ip 00007f10b88c6a03 sp
00007fffaee2bb40error 4 in libc-2.19.so[7f10b887b000+1bb000]on two computers running Xenomai RC5 with Linux 3.18.12 both with NI DAQs installed (M-Series).
please send the procs
/proc/analogy/*
rtxi@synch:~$ cat /proc/analogy/* -- Subdevices --
| idx | type | 00 | Analog input subdevice | 01 | Analog output subdevice | 02 | Digital input/output subdevice | 03 | Unused subdevice | 04 | Unused subdevice | 05 | Calibration subdevice | 06 | Memory subdevice | 07 | Digital input/output subdevice | 08 | Unused subdevice | 09 | Serial subdevice | 10 | Unused subdevice | 11 | Counter subdevice | 12 | Counter subdevice | 13 | Counter subdevice -- Analogy devices --
| idx | status | driver | 00 | Linked | pci-6259 | 01 | Unused | No driver | 02 | Unused | No driver | 03 | Unused | No driver | 04 | Unused | No driver | 05 | Unused | No driver | 06 | Unused | No driver | 07 | Unused | No driver | 08 | Unused | No driver | 09 | Unused | No driver -- Analogy drivers --
| idx | board name | 00 | analogy_ni_pcimio | 01 | analogy_8255
Quoted 1 line
can you run
analogy_calibrateunder gdb?
I did - and it turns out the error was due to this line:
__debug("Calibrating AI: %s \n", cal_info[i]);
changing this to:
__debug("Calibrating AI: %s \n", cal_info[i].message);
resolves this error.
Now, I get a file output from analogy_calibrate.
# uname -a
Linux synch 3.18.12-xenomai-3.0-rc6 #1 SMP Thu Aug 6 18:30:02 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
# cat /proc/xenomai/version
3.0-rc6
# cat /proc/cpuinfo
processor : 0vendor_id : GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Pentium(R) 4 CPU 3.40GHz
# sudo ./../../usr/xenomai/bin/insn_read -c 0 -R 0
Non Calibrated values:
1.178149
1.178149
1.177844
1.178454
1.178454
1.178454
1.178149
1.178454
1.178149
1.178149
# sudo ./../../usr/xenomai/bin/insn_read -c 0 -R 0 -y file
Never prints anything, top shows continuous running and increased consumption of memory
Yogi
Quoted 57 lines · Yogi A. Patel
Quoted 10 lines · Jorge Ramirez Ortiz
Quoted 6 lines · Yogi A. Patel
When I run
sudo ./analogy_calibrate --device=analogy0 --output=file
I see
Quoted 7 lines
Quoted 5 lines
[ 1124.191097] analogy_calibra[2822]: segfault at 7 ip 00007f10b88c6a03 sp
00007fffaee2bb40error 4 in libc-2.19.so[7f10b887b000+1bb000]on two computers running Xenomai RC5 with Linux 3.18.12 both with NI DAQs installed (M-Series).
please send the procs
/proc/analogy/*rtxi@synch:~$ cat /proc/analogy/* -- Subdevices --| idx | type | 00 | Analog input subdevice | 01 | Analog output subdevice | 02 | Digital input/output subdevice | 03 | Unused subdevice | 04 | Unused subdevice | 05 | Calibration subdevice | 06 | Memory subdevice | 07 | Digital input/output subdevice | 08 | Unused subdevice | 09 | Serial subdevice | 10 | Unused subdevice | 11 | Counter subdevice | 12 | Counter subdevice | 13 | Counter subdevice -- Analogy devices --| idx | status | driver | 00 | Linked | pci-6259 | 01 | Unused | No driver | 02 | Unused | No driver | 03 | Unused | No driver | 04 | Unused | No driver | 05 | Unused | No driver | 06 | Unused | No driver | 07 | Unused | No driver | 08 | Unused | No driver | 09 | Unused | No driver -- Analogy drivers --| idx | board name | 00 | analogy_ni_pcimio | 01 | analogy_8255Quoted 1 line
can you run
analogy_calibrateunder gdb?
Quoted 7 lines
I did - and it turns out the error was due to this line:
__debug("Calibrating AI: %s \n", cal_info[i]);changing this to:
__debug("Calibrating AI: %s \n", cal_info[i].message);
I already sent you a patch for this
Quoted 35 lines
resolves this error.
Now, I get a file output from
analogy_calibrate.# uname -aLinux synch 3.18.12-xenomai-3.0-rc6 #1 SMP Thu Aug 6 18:30:02 EDT 2015
x86_64x86_64x86_64GNU/Linux# cat /proc/xenomai/version3.0-rc6
# cat /proc/cpuinfoprocessor : 0
vendor_id: GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Pentium(R) 4 CPU 3.40GHz# sudo ./../../usr/xenomai/bin/insn_read -c 0 -R 0Non Calibrated values:
1.178149
1.178149
1.177844
1.178454
1.178454
1.178454
1.178149
1.178454
1.178149
1.178149
Quoted 3 lines
# sudo ./../../usr/xenomai/bin/insn_read -c 0 -R 0 -y fileNever prints anything, top shows continuous running and increased consumption of memory
can you send the calibration file please?
also can you gdb insn_read?
Quoted 4 lines
Yogi
Signature · 1 line
jro
Quoted 9 lines
Quoted 7 lines
I did - and it turns out the error was due to this line:
__debug("Calibrating AI: %s \n", cal_info[i]);changing this to:
__debug("Calibrating AI: %s \n", cal_info[i].message);I already sent you a patch for this
This patch needs to be applied to 3.0-rc6.
Quoted 1 line
can you send the calibration file please?
attached.
I spent some more time digging at the code. The insn_read process hangs at a4l_read_calibration_file because when the for loop (line 214) runs the second time, it does not find the string “elements”, and thus sets nb_elements to 65535 - causing it to run forever.
This is because it is looking for the elements string under “analog_output” in the calibration file, however there is no such section in the calibration file.
The calibration file also doesn’t include all the analog inputs (it only shows 7, whereas the board has 16 AIs. So does the PCI 6220). What am I missing/not understanding?
Quoted 7 lines
Quoted 4 lines
Yogi
Signature · 1 line
jro
Yogi
Quoted 10 lines · Jorge Ramirez Ortiz
Quoted 3 lines
Quoted 3 lines
# sudo ./../../usr/xenomai/bin/insn_read -c 0 -R 0 -y fileNever prints anything, top shows continuous running and increased consumption of memory
can you send the calibration file please?
also can you gdbinsn_read?Quoted 4 lines
Quoted 4 lines
Yogi
also as Gilles suggested, please do upgrade your Xenomai version to rc6 (it is a trivial action on your side)
Signature · 1 line
jro
Quoted 19 lines · Yogi A. Patel
Quoted 19 lines
Quoted 19 lines
I did - and it turns out the error was due to this line:
Quoted 8 lines
Quoted 6 lines
__debug("Calibrating AI: %s \n", cal_info[i]);changing this to:
__debug("Calibrating AI: %s \n", cal_info[i].message);I already sent you a patch for this
This patch needs to be applied to 3.0-rc6.
Quoted 1 line
can you send the calibration file please?
attached.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
I spent some more time digging at the code. The
insn_readprocess hangs ata4l_read_calibration_filebecause when the for loop (line 214) runs the second time, it does not find the string “elements”, and thus setsnb_elementsto 65535
- causing it to run forever.
you didnt get any errors while calibrating?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
This is because it is looking for the elements string under “analog_output” in the calibration file, however there is no such section in the calibration file.
yes, read_int should be checking for errors.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The calibration file also doesn’t include all the analog inputs (it only shows 7, whereas the board has 16 AIs. So does the PCI 6220). What am I missing/not understanding?
yes I was looking into this as well; the soft calibration feature replicates the Comedi version behaviour so this is very likely a bug.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
This is because it is looking for the elements string under “analog_output” in the calibration file, however there is no such section in the calibration file.
please pull from here for updates:
http://git.xenomai.org/xenomai-jro.git/log/?h=devel
Quoted 9 lines · Jorge Ramirez Ortiz
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This is because it is looking for the elements string under “analog_output” in the calibration file, however there is no such section in the calibration file.
please pull from here for updates:
http://git.xenomai.org/xenomai-jro.git/log/?h=devel <http://git.xenomai.org/xenomai-jro.git/log/?h=devel>
I’ve moved to your development branch. I just compiled and ran insn_read - and get:
error reading the calibration file: -1
Yogi
Quoted 7 lines · Yogi A. Patel
Quoted 7 lines · Jorge Ramirez Ortiz
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This is because it is looking for the elements string under “analog_output” in the calibration file, however there is no such section in the calibration file.
Quoted 8 lines
Quoted 2 lines
please pull from here for updates:
http://git.xenomai.org/xenomai-jro.git/log/?h=devel <http://git.xenomai.org/xenomai-jro.git/log/?h=devel>I’ve moved to your development branch. I just compiled and ran
insn_read- and get:error reading the calibration file: -1
Yogi
it means your calibration file is not correct.
any errors while generating it?
post the file please and I can have a look.
Signature · 1 line
jro
Quoted 1 line
any errors while generating it?
no.
Quoted 1 line
post the file please and I can have a look.
attached. just generated it again.
Quoted 2 lines
Signature · 1 line
jro
Yogi
Quoted 7 lines · Yogi A. Patel
Quoted 7 lines
any errors while generating it?
no.
Quoted 1 line
post the file please and I can have a look.
attached. just generated it again.
sorry, I am not sure what you mean.
is this the file that is failing? have you tried it?
Yes. I've tried it. I get the error I previously sent
Yogi A. Patel
@yapatel525
Quoted 13 lines · Jorge Ramirez Ortiz
Quoted 7 lines · Yogi A. Patel
Quoted 7 lines
any errors while generating it?
no.
Quoted 1 line
post the file please and I can have a look.
attached. just generated it again.
sorry, I am not sure what you mean.
is this the file that is failing? have you tried it?
Quoted 1 line · Yogi A. Patel
Yes. I've tried it. I get the error I previously sent
you dont have an AO? it seems to be missing from the calibration file. having said that, AO calibration should be optional.
please pull again from http://git.xenomai.org/xenomai-jro.git/log/?h=devel
Quoted 18 lines
Yogi A. Patel
@yapatel525Quoted 13 lines · Jorge Ramirez Ortiz
Quoted 7 lines · Yogi A. Patel
Quoted 7 lines
any errors while generating it?
no.
Quoted 1 line
post the file please and I can have a look.
attached. just generated it again.
sorry, I am not sure what you mean.
is this the file that is failing? have you tried it?
Signature · 1 line
jro
Quoted 7 lines · Yogi A. Patel
Quoted 1 line
any errors while generating it?
no.
Quoted 1 line
post the file please and I can have a look.
attached. just generated it again.
The attachment did not reach the mailing list. What was its mime type?
Signature · 2 lines
Gilles. https://click-hack.org
Quoted 1 line
The attachment did not reach the mailing list. What was its mime type?
$ mimetype file file: text/plain
Signature · 1 line
Yogi
Quoted 4 lines · Jorge Ramirez Ortiz
Quoted 1 line · Yogi A. Patel
Yes. I've tried it. I get the error I previously sent
you dont have an AO? it seems to be missing from the calibration file. having said that, AO calibration should be optional.
Yes, all of my cards have an AO. I asked about this a while back - the calibration file does not look complete.
Quoted 1 line
please pull again from http://git.xenomai.org/xenomai-jro.git/log/?h=devel
I did, however from the logs, I don't expect to see anything different. My new calibration file is attached again.
Quoted 14 lines
Quoted 14 lines
Yogi A. Patel
@yapatel525Quoted 11 lines · Jorge Ramirez Ortiz
Quoted 6 lines · Yogi A. Patel
Quoted 6 lines
any errors while generating it?
no.
Quoted 1 line
post the file please and I can have a look.
attached. just generated it again.
sorry, I am not sure what you mean.
is this the file that is failing? have you tried it?
Signature · 64 lines
Yogi -------------- next part -------------- [platform] driver_name = analogy_ni_pcimio; board_name = pci-6259; [analog_input] index = 0; elements = 7; [analog_input_0] channel = -1; range = 0; expansion_origin = 6.95281e-310; nbcoeff= 4; coeff_0 = 6.36599e-314; coeff_1 = 6.95281e-310; coeff_2 = 4.94066e-324; coeff_3 = 6.91826e-310; [analog_input_1] channel = -1; range = 1; expansion_origin = 32767; nbcoeff= 4; coeff_0 = -0.00132024; coeff_1 = 0.000161979; coeff_2 = -1.337e-11; coeff_3 = -5.67614e-16; [analog_input_2] channel = -1; range = 2; expansion_origin = 32767; nbcoeff= 4; coeff_0 = -0.000530804; coeff_1 = 6.47847e-05; coeff_2 = -5.34741e-12; coeff_3 = -2.27022e-16; [analog_input_3] channel = -1; range = 3; expansion_origin = 32767; nbcoeff= 4; coeff_0 = -0.00026958; coeff_1 = 3.24586e-05; coeff_2 = -2.67917e-12; coeff_3 = -1.13743e-16; [analog_input_4] channel = -1; range = 4; expansion_origin = 32767; nbcoeff= 4; coeff_0 = -0.000138844; coeff_1 = 1.6272e-05; coeff_2 = -1.34311e-12; coeff_3 = -5.7021e-17; [analog_input_5] channel = -1; range = 5; expansion_origin = 32767; nbcoeff= 4; coeff_0 = -6.26157e-05; coeff_1 = 6.5212e-06; coeff_2 = -5.38268e-13; coeff_3 = -2.28519e-17; [analog_input_6] channel = -1; range = 6; expansion_origin = 32767; nbcoeff= 4; coeff_0 = -3.71476e-05; coeff_1 = 3.25953e-06; coeff_2 = -2.69045e-13; coeff_3 = -1.14222e-17;
Quoted 3 lines · Yogi A. Patel
Quoted 1 line
The attachment did not reach the mailing list. What was its mime type?
$ mimetype file file: text/plain
That is not really what I was asking: I was asking you the mime type your mailer had used. Anyway, Jorge transmitted the mail, your mailer used application/octet-stream. I do not see anything in the configuration that would filter such attachments, but anyway, for text attachments, your mailer should have used text/plain too.
Signature · 2 lines
Gilles. https://click-hack.org
Quoted 2 lines
Quoted 2 lines
please pull again from http://git.xenomai.org/xenomai-jro.git/log/?h=devel
It took some time, but I was able to get the process to *run* - but not work.
I had to make the following modifications to the calibration.c file to get this to work on 3 different machines:
lib/analogy/calibration.c +3 -0
@@ -105,7 +105,10 @@ static inline int read_int(int *val, struct _dictionary_ *f, const char *subd, *val =iniparser_getint (f, str,0xFFFF );if (*val ==0xFFFF ) + { + *val =-1 ; ret = -ENOENT ; + }free (str);return ret;
@@ -226,7 +229,7 @@ int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data) if (nb_elements < 0 ) { /* AO is optional */ if (!strncmp(subdevice[k], AO_SUBD_STR,
sizeof(AO_SUBD_STR)))
- break;
+ return 0;
return -1;
}I get why these modifications are necessary and why it works now. I don't understand how it worked for you before.
Now the problem is that when I run:
$ ./insn_read -R 0 -c 3 -d analogy0 -y /home/yapatel/file Calibrated values: 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
without calibration, it works fine:
$ ./insn_read -R 0 -c 3 -d analogy0 Non Calibrated values: 4.837873 4.838788 4.839094 4.838788 4.839094 4.838483 4.838483 4.838178 4.836957 4.836652
Also, the calibration file output has another error. The channel values are all "-1". I've attached my newest calibration file from a machine with an NI-6250 card (no AO).
Can you send me a file that has worked for you?
-------------- next part --------------
[platform] driver_name = analogy_ni_pcimio;board_name = pci-6250;
[analog_input] index = 0;
elements = 7;
[analog_input_0] channel = -1;
range = 0;expansion_origin = 6.95294e-310;
nbcoeff= 4;coeff_0 = 6.36599e-314;coeff_1 = 6.95294e-310;coeff_2 = 4.94066e-324;coeff_3 = 6.91753e-310;
[analog_input_1] channel = -1;
range = 1;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = -0.000646698;coeff_1 = 0.000162018;coeff_2 = -1.50544e-11;coeff_3 = -6.47918e-16;
[analog_input_2] channel = -1;
range = 2;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = -0.000225658;coeff_1 = 6.46977e-05;coeff_2 = -6.01158e-12;coeff_3 = -2.58729e-16;
[analog_input_3] channel = -1;
range = 3;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = -8.87597e-05;coeff_1 = 3.24157e-05;coeff_2 = -3.012e-12;coeff_3 = -1.29632e-16;
[analog_input_4] channel = -1;
range = 4;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = -1.8853e-05;coeff_1 = 1.61998e-05;coeff_2 = -1.50525e-12;coeff_3 = -6.47836e-17;
[analog_input_5] channel = -1;
range = 5;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = 2.17638e-05;coeff_1 = 6.49031e-06;coeff_2 = -6.03067e-13;coeff_3 = -2.59551e-17;
[analog_input_6] channel = -1;
range = 6;expansion_origin = 32767;
nbcoeff= 4;coeff_0 = 3.60315e-05;coeff_1 = 3.24112e-06;coeff_2 = -3.01158e-13;coeff_3 = -1.29614e-17;
Quoted 6 lines · Yogi A. Patel
Quoted 2 lines
Quoted 2 lines
please pull again from http://git.xenomai.org/xenomai-jro.git/log/?h=devel
It took some time, but I was able to get the process to *run* - but not work.
I had to make the following modifications to the
calibration.cfile to get this to work on 3 different machines:
none of these modifications are really valid.
you are probably forcing analogy to swallow an invalid calibration file.
lib/analogy/calibration.c static inline int read_int(int *val, struct _dictionary_ · line 111
Quoted 13 lines
lib/analogy/calibration.c +2
-0@@ -105,7 +105,10 @@ static inline int read_int(int *val, struct _dictionary_ *f, const char *subd, *val =iniparser_getint (f, str,0xFFFF );if (*val ==0xFFFF ) + { + *val =-1 ; ret = -ENOENT ;
this is not correct.
the coefficient was not found and so an error must be return.
lib/analogy/calibration.c int a4l_read_calibration_file(char *name, struct · line 234
Quoted 8 lines
lib/analogy/calibration.c +1
-1@@ -226,7 +229,7 @@ int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data)if (nb_elements <0 ) {/* AO is optional */ if (!strncmp (subdevice[k],AO_SUBD_STR ,sizeof (AO_SUBD_STR ))) -break ; +return 0 ;
this change makes no difference:
breaking the loop is like returning 0.
Quoted 2 lines
I get why these modifications are necessary and why it works now. I don't understand how it worked for you before.
your modifications not necessary.
Quoted 31 lines
Now the problem is that when I run:
$ ./insn_read -R 0 -c 3 -d analogy0 -y /home/yapatel/file Calibrated values: 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000without calibration, it works fine:
$ ./insn_read -R 0 -c 3 -d analogy0 Non Calibrated values: 4.837873 4.838788 4.839094 4.838788 4.839094 4.838483 4.838483 4.838178 4.836957 4.836652
Quoted 3 lines
Also, the calibration file output has another error. The channel values are all "-1". I've attached my newest calibration file from a machine with an NI-6250 card (no AO).
that is expected. The coefficients are not calculated per channel. The algorithm mimics what Comedi's soft-calibration does.
Quoted 1 line
Can you send me a file that has worked for you?
attached
Signature · 63 lines
jro -------------- next part -------------- [platform] driver_name = analogy_ni_pcimio; board_name = pci-6221; [analog_input] index = 0; elements = 4; [analog_input_0] channel = -1; range = 0; expansion_origin = 32767; nbcoeff= 4; coeff_0 = -0.00564502; coeff_1 = 0.000324267; coeff_2 = -1.10805e-12; coeff_3 = 8.53657e-17; [analog_input_1] channel = -1; range = 1; expansion_origin = 32767; nbcoeff= 4; coeff_0 = -0.00271666; coeff_1 = 0.000161912; coeff_2 = -5.53267e-13; coeff_3 = 4.26245e-17; [analog_input_2] channel = -1; range = 2; expansion_origin = 32767; nbcoeff= 4; coeff_0 = -0.000402363; coeff_1 = 3.24385e-05; coeff_2 = -1.10845e-13; coeff_3 = 8.53966e-18; [analog_input_3] channel = -1; range = 3; expansion_origin = 32767; nbcoeff= 4; coeff_0 = 0.00470683; coeff_1 = 0.000582658; coeff_2 = -1.991e-12; coeff_3 = 1.53389e-16; [analog_output] index = 1; elements = 2; [analog_output_0] channel = 0; range = 0; expansion_origin = 0; nbcoeff= 2; coeff_0 = 32768.6; coeff_1 = 3234.65; [analog_output_1] channel = 1; range = 0; expansion_origin = 0; nbcoeff= 2; coeff_0 = 32768.6; coeff_1 = 3234.65;
Quoted 14 lines · Jorge Ramirez Ortiz
Quoted 6 lines · Yogi A. Patel
Quoted 2 lines
Quoted 2 lines
please pull again from http://git.xenomai.org/xenomai-jro.git/log/?h=devel
It took some time, but I was able to get the process to *run* - but not work.
I had to make the following modifications to the
calibration.cfile to get this to work on 3 different machines:none of these modifications are really valid.
you are probably forcing analogy to swallow an invalid calibration file.Quoted 1 line
Quoted 9 lines
Review int a4l_read_calibration_file(char *name, struct · line 234
Quoted 8 lines
(quoted diff) +1
-1@@ -226,7 +229,7 @@ int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data) if (nb_elements < 0 ) { /* AO is optional */ if (!strncmp(subdevice[k], AO_SUBD_STR, sizeof(AO_SUBD_STR))) - break; + return 0;
actually I am obviously wrong here. this is needed.
it went unnoticed on my tests (it is unusual not to have an A0 subdevice) will pick it.
Quoted 8 lines
Quoted 8 lines
lib/analogy/calibration.c +0
-0@@ -105,7 +105,10 @@ static inline int read_int(int *val, struct _dictionary_ *f, const char *subd,
Quoted 7 lines
lib/analogy/calibration.c static inline int read_int(int *val, struct _dictionary_ *f, const char *subd, · line 110
Quoted 5 lines
lib/analogy/calibration.c +2
-0*val =iniparser_getint (f, str,0xFFFF );if (*val ==0xFFFF ) + { + *val =-1 ; ret = -ENOENT ;this is not correct.
the coefficient was not found and so an error must be return.
Yes, I agree that an error must be returned. The problem is that *val is pointing to 0XFFFF - which is nb_elements. So when you check if(nb_elements < 0), it still proceeds, rather than returning an error as it should.
Thanks for sending your file. I am absurdly confused as to why I don't get an output section..have you tried this with any other cards?
Quoted 25 lines · Jorge Ramirez Ortiz
Quoted 14 lines · Jorge Ramirez Ortiz
Quoted 6 lines · Yogi A. Patel
Quoted 2 lines
Quoted 2 lines
please pull again from http://git.xenomai.org/xenomai-jro.git/log/?h=devel
It took some time, but I was able to get the process to *run* - but not work.
I had to make the following modifications to the
calibration.cfile to get this to work on 3 different machines:none of these modifications are really valid.
you are probably forcing analogy to swallow an invalid calibration file.Quoted 1 line
Quoted 9 lines
Review int a4l_read_calibration_file(char *name, struct · line 234
Quoted 8 lines
(quoted diff) +1
-1@@ -226,7 +229,7 @@ int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data) if (nb_elements < 0 ) { /* AO is optional */ if (!strncmp(subdevice[k], AO_SUBD_STR, sizeof(AO_SUBD_STR))) - break; + return 0;
Quoted 4 lines
actually I am obviously wrong here. this is needed.
it went unnoticed on my tests (it is unusual not to have an A0 subdevice) will pick it.
ok, so finally I had a look at the code in mainline and yes, this is not needed either (I was looking at some changes I am working on so this code might change) in any case this can not have caused you any problems (after it breaks the loop, it returns 0 which is just what your patch does).
Signature · 1 line
jro
Quoted 15 lines · Yogi A. Patel
Quoted 8 lines
Quoted 8 lines
lib/analogy/calibration.c +0
-0@@ -105,7 +105,10 @@ static inline int read_int(int *val, struct _dictionary_ *f, const char *subd,Quoted 7 lines
lib/analogy/calibration.c static inline int read_int(int *val, struct _dictionary_ *f, const char *subd, · line 110
Quoted 5 lines
lib/analogy/calibration.c +2
-0*val =iniparser_getint (f, str,0xFFFF );if (*val ==0xFFFF ) + { + *val =-1 ; ret = -ENOENT ;this is not correct.
the coefficient was not found and so an error must be return.
Quoted 4 lines
Yes, I agree that an error must be returned. The problem is that *val is pointing to
0XFFFF- which isnb_elements. So when you checkif(nb_elements < 0), it still proceeds, rather than returning an error as it should.
ACKd. Not sure what I was thinking.
Quoted 3 lines
Thanks for sending your file. I am absurdly confused as to why I don't get an output section..have you tried this with any other cards?
No, I only have access to the 6221.
Just enable the debugging information in the kernel config. you can also use ftrace (supported by analogy)
Signature · 1 line
jro