[Rtai] Problems with COMEDI buffered input/output commands from a realtime process under RTAI/LXRT
LAMY Xavier 215881 Thésard
xavier.lamy at cea.fr
Wed May 14 17:34:03 CEST 2008
Hello,
I would like to use COMEDI buffered input/output commands from a
realtime process under RTAI/LXRT. This seems possible thanks to the
porting done by "The Comedi Players" :
<http://cvs.gna.org/cvsweb/vulcano/addons/comedi/?cvsroot=rtai> http://cvs.gna.org/cvsweb/vulcano/addons/comedi/?cvsroot=rtai
I already succeed using buffered input/output commands with classic
COMEDI, and also doing simple input/output through its RTAI/LXRT
porting. But I still fail doing buffered input/output commands through
the RTAI/LXRT porting.
I have tried the example provided in a old RTAI version :
file testa.c
in <http://cvs.gna.org/cvsweb/stromboli/comedi_lxrt/?cvsroot=rtai> http://cvs.gna.org/cvsweb/stromboli/comedi_lxrt/?cvsroot=rtai
I've just adapted the include statements and add some debugging
instructions to track down what is going wrong.
Here is my changes to the original example :
*************
$ diff -u0 testa.c.org testa.c
-- testa.c.org 2008-04-28 13:36:00.000000000 +0200
+++ testa.c 2008-04-28 13:49:18.000000000 +0200
@@ -28,3 +28 @@
-#include <rtai_lxrt_user.h>
-#include <rtai_lxrt.h>
-#include <rtai_comedi_lxrt.h>
+#include <rtai_comedi.h>
@@ -105,0 +104,12 @@
+
+ printf("data: @%d\n",
+ cmd->data);
+
+ printf("data_len: %d\n",
+ cmd->data_len);
+
+ printf("chanlist: @%d\n",
+ cmd->chanlist);
+
+ printf("chanlist_len:%d\n",
+ cmd->chanlist_len);
@@ -209,0 +220,4 @@
+ for (n = 0; n < BUFSZ/2; n++) {
+ buf[n] = n;
+ }
+
@@ -212 +226 @@
-// rt_make_hard_real_time();
+ rt_make_hard_real_time();
******************
And here is the output of the new testa program :
******************
$ sudo ./testa
OVERALL INFO:
Version code : 0x00074c
Board name : pci-6259
Driver name : ni_pcimio
Number of subdevices : 14
Subdevice : 0
Type : 1 (analog input)
Number of channels : 32
Maxdata : 65535
Number of ranges : 7
Subdevice : 1
Type : 2 (analog output)
Number of channels : 4
Maxdata : 65535
Number of ranges : 3
Subdevice : 2
Type : 5 (digital I/O)
Number of channels : 32
Maxdata : 1
Number of ranges : 1
Asynchronous test (with comedi commands).
command before testing :
start: now 0
scan_begin: timer 100000
convert: timer 1
scan_end: count 1
stop: count 10
data: @-1209081772
data_len: 40
chanlist: @-1209081776
chanlist_len:1
First test returned 3 (invalid argument)
start: now 0
scan_begin: timer 100000
convert: timer 800
scan_end: count 1
stop: count 10
data: @-826179500
data_len: 40
chanlist: @-826179504
chanlist_len:1
Second test returned 0 (success)
#: 0, #SMPV: 0, MASK: 5, SEMCNT: 0 (TRUE COUNT)
#: 1, #SMPV: 1, MASK: 5, SEMCNT: 2 (TRUE COUNT)
#: 2, #SMPV: 2, MASK: 5, SEMCNT: 2 (TRUE COUNT)
#: 3, #SMPV: 3, MASK: 5, SEMCNT: 3 (TRUE COUNT)
#: 4, #SMPV: 4, MASK: 5, SEMCNT: 3 (TRUE COUNT)
#: 5, #SMPV: 5, MASK: 5, SEMCNT: 3 (TRUE COUNT)
#: 6, #SMPV: 6, MASK: 5, SEMCNT: 3 (TRUE COUNT)
#: 7, #SMPV: 7, MASK: 7, SEMCNT: 3 (TRUE COUNT)
#: 8, #SMPV: 8, MASK: 7, SEMCNT: 2 (TRUE COUNT)
#: 9, #SMPV: 9, MASK: 7, SEMCNT: 1 (TRUE COUNT)
*****************
What we can see is that :
1) the buffer is not updated at all after executing the COMEDI command
(field #SMPV should be updated with the samples values)
2) the comedi_command_test change the data buffer and chanlist address
(this is not expected!)
Here is a message posted 2 years ago by someone having similar
problems :
<http://marc.info/?l=comedi&m=116291668731840&w=2> http://marc.info/?l=comedi&m=116291668731840&w=2
I am using : comedi-0.7.76
comedilib-0.8.1
linux kernel 2.6.17.9 (patched with RTAI 3.5)
Any advices on this problem will be very helpfull, thanks in advance
for your help!
--
Xavier LAMY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.rtai.org/pipermail/rtai/attachments/20080514/af5a0624/attachment.htm
More information about the Rtai
mailing list