All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] analogy calibration issue(s)
@ 2015-08-05  3:01 Yogi A. Patel
  2015-08-05  5:00 ` Jorge Ramirez Ortiz
  2015-08-06 19:00 ` Jorge Ramirez Ortiz
  0 siblings, 2 replies; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-05  3:01 UTC (permalink / raw)
  To: xenomai@xenomai.org, Jorge Ramirez Ortiz

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: \x10�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: \x10�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


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-05  3:01 [Xenomai] analogy calibration issue(s) Yogi A. Patel
@ 2015-08-05  5:00 ` Jorge Ramirez Ortiz
  2015-08-05  5:13   ` Yogi A. Patel
  2015-08-06 19:00 ` Jorge Ramirez Ortiz
  1 sibling, 1 reply; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-05  5:00 UTC (permalink / raw)
  To: Yogi A. Patel, xenomai@xenomai.org

On 08/04/2015 11:01 PM, Yogi A. Patel wrote:
> 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
...
> 
> NOTE: there appears to be a print bug above (0"283.294| Calibrating AI: \x10�m)

apply the following:

[jramirez@calypso ~ (master *)]$ git diff calibration_ni_m.c
diff --git a/utils/analogy/calibration_ni_m.c b/utils/analogy/calibration_ni_m.c
index c72a44d..6f9be6f 100644
--- a/utils/analogy/calibration_ni_m.c
+++ b/utils/analogy/calibration_ni_m.c
@@ -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;



> > 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?



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-05  5:00 ` Jorge Ramirez Ortiz
@ 2015-08-05  5:13   ` Yogi A. Patel
  2015-08-05 12:54     ` Jorge Ramirez Ortiz
  0 siblings, 1 reply; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-05  5:13 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz, xenomai@xenomai.org

On 08/05/2015 01:00 AM, Jorge Ramirez Ortiz wrote:
> On 08/04/2015 11:01 PM, Yogi A. Patel wrote:
>> 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
> ...
>> NOTE: there appears to be a print bug above (0"283.294| Calibrating AI: \x10�m)
> apply the following:
>
> [jramirez@calypso ~ (master *)]$ git diff calibration_ni_m.c
> diff --git a/utils/analogy/calibration_ni_m.c b/utils/analogy/calibration_ni_m.c
> index c72a44d..6f9be6f 100644
> --- a/utils/analogy/calibration_ni_m.c
> +++ b/utils/analogy/calibration_ni_m.c
> @@ -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;
>
>
>
>>> 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;


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-05  5:13   ` Yogi A. Patel
@ 2015-08-05 12:54     ` Jorge Ramirez Ortiz
  0 siblings, 0 replies; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-05 12:54 UTC (permalink / raw)
  To: Yogi A. Patel, xenomai@xenomai.org

On 08/05/2015 01:13 AM, Yogi A. Patel wrote:
> On 08/05/2015 01:00 AM, Jorge Ramirez Ortiz wrote:
>> On 08/04/2015 11:01 PM, Yogi A. Patel wrote:
>>> 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
>> ...
>>> NOTE: there appears to be a print bug above (0"283.294| Calibrating AI: \x10�m)
>> apply the following:
>>
>> [jramirez@calypso ~ (master *)]$ git diff calibration_ni_m.c
>> diff --git a/utils/analogy/calibration_ni_m.c b/utils/analogy/calibration_ni_m.c
>> index c72a44d..6f9be6f 100644
>> --- a/utils/analogy/calibration_ni_m.c
>> +++ b/utils/analogy/calibration_ni_m.c
>> @@ -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;
>>
>>
>>
>>>> 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;
> 

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?


-- 
jro


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-05  3:01 [Xenomai] analogy calibration issue(s) Yogi A. Patel
  2015-08-05  5:00 ` Jorge Ramirez Ortiz
@ 2015-08-06 19:00 ` Jorge Ramirez Ortiz
  2015-08-06 20:30   ` Yogi A. Patel
  1 sibling, 1 reply; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-06 19:00 UTC (permalink / raw)
  To: Yogi A. Patel, xenomai@xenomai.org


> 
> 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)
[...]


-- 
jro


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-06 19:00 ` Jorge Ramirez Ortiz
@ 2015-08-06 20:30   ` Yogi A. Patel
  2015-08-06 20:47     ` Jorge Ramirez Ortiz
  2015-08-06 20:56     ` Gilles Chanteperdrix
  0 siblings, 2 replies; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-06 20:30 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz, xenomai@xenomai.org

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).

On 08/06/2015 03:00 PM, Jorge Ramirez Ortiz wrote:
>> 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)
> [...]
>
>

-- 
Yogi



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-06 20:30   ` Yogi A. Patel
@ 2015-08-06 20:47     ` Jorge Ramirez Ortiz
  2015-08-07  1:57       ` Yogi A. Patel
  2015-08-06 20:56     ` Gilles Chanteperdrix
  1 sibling, 1 reply; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-06 20:47 UTC (permalink / raw)
  To: Yogi A. Patel, xenomai@xenomai.org

On 08/06/2015 04:30 PM, Yogi A. Patel wrote:
> 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).

please send the procs /proc/analogy/*
can you run analogy_calibrate under gdb?


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-06 20:30   ` Yogi A. Patel
  2015-08-06 20:47     ` Jorge Ramirez Ortiz
@ 2015-08-06 20:56     ` Gilles Chanteperdrix
  1 sibling, 0 replies; 30+ messages in thread
From: Gilles Chanteperdrix @ 2015-08-06 20:56 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On Thu, Aug 06, 2015 at 04:30:48PM -0400, Yogi A. Patel wrote:
> 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).

Please upgrade to rc6, so that you and Jorge actually talk about the
same version.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-06 20:47     ` Jorge Ramirez Ortiz
@ 2015-08-07  1:57       ` Yogi A. Patel
  2015-08-07 11:26         ` Jorge Ramirez Ortiz
  0 siblings, 1 reply; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-07  1:57 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz; +Cc: xenomai@xenomai.org


> On Aug 6, 2015, at 16:47, Jorge Ramirez Ortiz <jro@xenomai.org> wrote:
> 
> On 08/06/2015 04:30 PM, Yogi A. Patel wrote:
>> 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).
> 
> 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 

> can you run analogy_calibrate under 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	: 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 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


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07  1:57       ` Yogi A. Patel
@ 2015-08-07 11:26         ` Jorge Ramirez Ortiz
  2015-08-07 12:43           ` Yogi A. Patel
  2015-08-07 12:53           ` Jorge Ramirez Ortiz
  0 siblings, 2 replies; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-07 11:26 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On 08/06/2015 09:57 PM, Yogi A. Patel wrote:
> 
>> On Aug 6, 2015, at 16:47, Jorge Ramirez Ortiz <jro@xenomai.org> wrote:
>>
>> On 08/06/2015 04:30 PM, Yogi A. Patel wrote:
>>> 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).
>>
>> 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 
> 
>> can you run analogy_calibrate under 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);

I already sent you a patch for this

> 
> 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	: 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 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

can you send the calibration file please?
also can you gdb insn_read?

> 
> Yogi
> 
> 

-- 
jro


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 11:26         ` Jorge Ramirez Ortiz
@ 2015-08-07 12:43           ` Yogi A. Patel
  2015-08-07 13:00             ` Jorge Ramirez Ortiz
  2015-08-07 14:13             ` Jorge Ramirez Ortiz
  2015-08-07 12:53           ` Jorge Ramirez Ortiz
  1 sibling, 2 replies; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-07 12:43 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz; +Cc: xenomai@xenomai.org

>> 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.

> 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?

>> 
>> Yogi
>> 
>> 
> 
> -- 
> jro

Yogi


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 11:26         ` Jorge Ramirez Ortiz
  2015-08-07 12:43           ` Yogi A. Patel
@ 2015-08-07 12:53           ` Jorge Ramirez Ortiz
  1 sibling, 0 replies; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-07 12:53 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On 08/07/2015 07:26 AM, Jorge Ramirez Ortiz wrote:
>> > # sudo ./../../usr/xenomai/bin/insn_read -c 0 -R 0 -y file
>> > 
>> > Never prints anything, top shows continuous running and increased consumption of memory
> can you send the calibration file please?
> also can you gdb insn_read?
> 
>> > 
>> > Yogi
>> > 
>> > 

also as Gilles suggested, please do upgrade your Xenomai version to rc6 (it is a
trivial action on your side)


-- 
jro


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 12:43           ` Yogi A. Patel
@ 2015-08-07 13:00             ` Jorge Ramirez Ortiz
  2015-08-07 14:13             ` Jorge Ramirez Ortiz
  1 sibling, 0 replies; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-07 13:00 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On 08/07/2015 08:43 AM, Yogi A. Patel wrote:
>>> 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.
>>>
>>> > 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.

you didnt get any errors while calibrating?

>>>
>>> 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.

>>>
>>> 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.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 12:43           ` Yogi A. Patel
  2015-08-07 13:00             ` Jorge Ramirez Ortiz
@ 2015-08-07 14:13             ` Jorge Ramirez Ortiz
  2015-08-07 20:15               ` Yogi A. Patel
  1 sibling, 1 reply; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-07 14:13 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org


>>>
>>> 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




^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 14:13             ` Jorge Ramirez Ortiz
@ 2015-08-07 20:15               ` Yogi A. Patel
  2015-08-07 20:32                 ` Jorge Ramirez Ortiz
  0 siblings, 1 reply; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-07 20:15 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz; +Cc: xenomai@xenomai.org

> On Aug 7, 2015, at 10:13, Jorge Ramirez Ortiz <jro@xenomai.org> wrote:
> 
> 
>>>> 
>>>> 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


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 20:15               ` Yogi A. Patel
@ 2015-08-07 20:32                 ` Jorge Ramirez Ortiz
  2015-08-07 20:35                   ` Yogi A. Patel
  0 siblings, 1 reply; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-07 20:32 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On 08/07/2015 04:15 PM, Yogi A. Patel wrote:
>> On Aug 7, 2015, at 10:13, Jorge Ramirez Ortiz <jro@xenomai.org> wrote:
>>
>>
>>>>>
>>>>> 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

it means your calibration file is not correct.
any errors while generating it?
post the file please and I can have a look.




-- 
jro


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 20:32                 ` Jorge Ramirez Ortiz
@ 2015-08-07 20:35                   ` Yogi A. Patel
  2015-08-07 20:47                     ` Jorge Ramirez Ortiz
  2015-08-07 21:28                     ` Gilles Chanteperdrix
  0 siblings, 2 replies; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-07 20:35 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz; +Cc: xenomai@xenomai.org

> any errors while generating it?

no.

> post the file please and I can have a look.

attached. just generated it again.

> -- 
> jro

Yogi


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 20:35                   ` Yogi A. Patel
@ 2015-08-07 20:47                     ` Jorge Ramirez Ortiz
  2015-08-07 20:48                       ` Yogi A. Patel
  2015-08-07 21:28                     ` Gilles Chanteperdrix
  1 sibling, 1 reply; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-07 20:47 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On 08/07/2015 04:35 PM, Yogi A. Patel wrote:
>> any errors while generating it?
>>
>> no.
>>
>> > 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?


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 20:47                     ` Jorge Ramirez Ortiz
@ 2015-08-07 20:48                       ` Yogi A. Patel
  2015-08-07 21:27                         ` Jorge Ramirez Ortiz
  0 siblings, 1 reply; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-07 20:48 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz; +Cc: xenomai@xenomai.org

Yes. I've tried it. I get the error I previously sent 

Yogi A. Patel
@yapatel525

> On Aug 7, 2015, at 16:47, Jorge Ramirez Ortiz <jro@xenomai.org> wrote:
> 
> On 08/07/2015 04:35 PM, Yogi A. Patel wrote:
>>> any errors while generating it?
>>> 
>>> no.
>>> 
>>>> 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?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 20:48                       ` Yogi A. Patel
@ 2015-08-07 21:27                         ` Jorge Ramirez Ortiz
  2015-08-11 12:29                           ` Yogi A. Patel
  0 siblings, 1 reply; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-07 21:27 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On 08/07/2015 04:48 PM, Yogi A. Patel wrote:
> 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


> 
> Yogi A. Patel
> @yapatel525
> 
>> On Aug 7, 2015, at 16:47, Jorge Ramirez Ortiz <jro@xenomai.org> wrote:
>>
>> On 08/07/2015 04:35 PM, Yogi A. Patel wrote:
>>>> any errors while generating it?
>>>>
>>>> no.
>>>>
>>>>> 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?
> 

-- 
jro


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 20:35                   ` Yogi A. Patel
  2015-08-07 20:47                     ` Jorge Ramirez Ortiz
@ 2015-08-07 21:28                     ` Gilles Chanteperdrix
  2015-08-11 12:22                       ` Yogi A. Patel
  1 sibling, 1 reply; 30+ messages in thread
From: Gilles Chanteperdrix @ 2015-08-07 21:28 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On Fri, Aug 07, 2015 at 04:35:11PM -0400, Yogi A. Patel wrote:
> > any errors while generating it?
> 
> no.
> 
> > 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?

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 21:28                     ` Gilles Chanteperdrix
@ 2015-08-11 12:22                       ` Yogi A. Patel
  2015-08-11 15:49                         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-11 12:22 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai@xenomai.org

> The attachment did not reach the mailing list. What was its mime type?
$ mimetype file
file:  text/plain

-- 
Yogi



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-07 21:27                         ` Jorge Ramirez Ortiz
@ 2015-08-11 12:29                           ` Yogi A. Patel
  2015-08-17  4:11                             ` Yogi A. Patel
  0 siblings, 1 reply; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-11 12:29 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz; +Cc: xenomai@xenomai.org


On 08/07/2015 05:27 PM, Jorge Ramirez Ortiz wrote:
> On 08/07/2015 04:48 PM, Yogi A. Patel wrote:
>> 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.
> 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.
>> Yogi A. Patel
>> @yapatel525
>>
>>> On Aug 7, 2015, at 16:47, Jorge Ramirez Ortiz <jro@xenomai.org> wrote:
>>>
>>> On 08/07/2015 04:35 PM, Yogi A. Patel wrote:
>>>>> any errors while generating it?
>>>>>
>>>>> no.
>>>>>
>>>>>> 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?

-- 
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;

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-11 12:22                       ` Yogi A. Patel
@ 2015-08-11 15:49                         ` Gilles Chanteperdrix
  0 siblings, 0 replies; 30+ messages in thread
From: Gilles Chanteperdrix @ 2015-08-11 15:49 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On Tue, Aug 11, 2015 at 08:22:28AM -0400, Yogi A. Patel wrote:
> >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.

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-11 12:29                           ` Yogi A. Patel
@ 2015-08-17  4:11                             ` Yogi A. Patel
  2015-08-17 13:22                               ` Jorge Ramirez Ortiz
  0 siblings, 1 reply; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-17  4:11 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz; +Cc: xenomai@xenomai.org


>> 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:

diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
index b50cb2f..d062a00 100644
--- a/lib/analogy/calibration.c
+++ b/lib/analogy/calibration.c
@@ -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;

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-17  4:11                             ` Yogi A. Patel
@ 2015-08-17 13:22                               ` Jorge Ramirez Ortiz
  2015-08-17 13:39                                 ` Jorge Ramirez Ortiz
  2015-08-17 14:22                                 ` Yogi A. Patel
  0 siblings, 2 replies; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-17 13:22 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On 08/17/2015 12:11 AM, Yogi A. Patel wrote:
> 
>>> 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:

none of these modifications are really valid.
you are probably forcing analogy to swallow an invalid calibration file.

> 
> diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
> index b50cb2f..d062a00 100644
> --- a/lib/analogy/calibration.c
> +++ b/lib/analogy/calibration.c
> @@ -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.


> @@ -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.


> 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.

> 
> 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).

that is expected. The coefficients are not calculated per channel.
The algorithm mimics what Comedi's soft-calibration does.

> Can you send me a file that has worked for you?

attached

-- 
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;


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-17 13:22                               ` Jorge Ramirez Ortiz
@ 2015-08-17 13:39                                 ` Jorge Ramirez Ortiz
  2015-08-17 14:29                                   ` Jorge Ramirez Ortiz
  2015-08-17 14:22                                 ` Yogi A. Patel
  1 sibling, 1 reply; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-17 13:39 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On 08/17/2015 09:22 AM, Jorge Ramirez Ortiz wrote:
> On 08/17/2015 12:11 AM, Yogi A. Patel wrote:
>>
>>>> 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:
> 
> none of these modifications are really valid.
> you are probably forcing analogy to swallow an invalid calibration file.
> 
>>

> 
>> @@ -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.



^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-17 13:22                               ` Jorge Ramirez Ortiz
  2015-08-17 13:39                                 ` Jorge Ramirez Ortiz
@ 2015-08-17 14:22                                 ` Yogi A. Patel
  2015-08-20 14:15                                   ` Jorge Ramirez Ortiz
  1 sibling, 1 reply; 30+ messages in thread
From: Yogi A. Patel @ 2015-08-17 14:22 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz; +Cc: xenomai@xenomai.org


>> diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
>> index b50cb2f..d062a00 100644
>> --- a/lib/analogy/calibration.c
>> +++ b/lib/analogy/calibration.c
>> @@ -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.
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?


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-17 13:39                                 ` Jorge Ramirez Ortiz
@ 2015-08-17 14:29                                   ` Jorge Ramirez Ortiz
  0 siblings, 0 replies; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-17 14:29 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On 08/17/2015 09:39 AM, Jorge Ramirez Ortiz wrote:
> On 08/17/2015 09:22 AM, Jorge Ramirez Ortiz wrote:
>> On 08/17/2015 12:11 AM, Yogi A. Patel wrote:
>>>
>>>>> 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:
>>
>> none of these modifications are really valid.
>> you are probably forcing analogy to swallow an invalid calibration file.
>>
>>>
> 
>>
>>> @@ -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.
> 

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).



-- 
jro


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [Xenomai] analogy calibration issue(s)
  2015-08-17 14:22                                 ` Yogi A. Patel
@ 2015-08-20 14:15                                   ` Jorge Ramirez Ortiz
  0 siblings, 0 replies; 30+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-08-20 14:15 UTC (permalink / raw)
  To: Yogi A. Patel; +Cc: xenomai@xenomai.org

On 08/17/2015 07:22 AM, Yogi A. Patel wrote:
> 
>>> diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
>>> index b50cb2f..d062a00 100644
>>> --- a/lib/analogy/calibration.c
>>> +++ b/lib/analogy/calibration.c
>>> @@ -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.
> 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.
> 

ACKd. Not sure what I was thinking.

> 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)


-- 
jro


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2015-08-20 14:15 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-05  3:01 [Xenomai] analogy calibration issue(s) Yogi A. Patel
2015-08-05  5:00 ` Jorge Ramirez Ortiz
2015-08-05  5:13   ` Yogi A. Patel
2015-08-05 12:54     ` Jorge Ramirez Ortiz
2015-08-06 19:00 ` Jorge Ramirez Ortiz
2015-08-06 20:30   ` Yogi A. Patel
2015-08-06 20:47     ` Jorge Ramirez Ortiz
2015-08-07  1:57       ` Yogi A. Patel
2015-08-07 11:26         ` Jorge Ramirez Ortiz
2015-08-07 12:43           ` Yogi A. Patel
2015-08-07 13:00             ` Jorge Ramirez Ortiz
2015-08-07 14:13             ` Jorge Ramirez Ortiz
2015-08-07 20:15               ` Yogi A. Patel
2015-08-07 20:32                 ` Jorge Ramirez Ortiz
2015-08-07 20:35                   ` Yogi A. Patel
2015-08-07 20:47                     ` Jorge Ramirez Ortiz
2015-08-07 20:48                       ` Yogi A. Patel
2015-08-07 21:27                         ` Jorge Ramirez Ortiz
2015-08-11 12:29                           ` Yogi A. Patel
2015-08-17  4:11                             ` Yogi A. Patel
2015-08-17 13:22                               ` Jorge Ramirez Ortiz
2015-08-17 13:39                                 ` Jorge Ramirez Ortiz
2015-08-17 14:29                                   ` Jorge Ramirez Ortiz
2015-08-17 14:22                                 ` Yogi A. Patel
2015-08-20 14:15                                   ` Jorge Ramirez Ortiz
2015-08-07 21:28                     ` Gilles Chanteperdrix
2015-08-11 12:22                       ` Yogi A. Patel
2015-08-11 15:49                         ` Gilles Chanteperdrix
2015-08-07 12:53           ` Jorge Ramirez Ortiz
2015-08-06 20:56     ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.