Programming Xenomai+analogy
Hi,
I am trying to use xenomai to accomplish a, I think, simple task, but I have never used real time programs before so I have some problems.
What I need is to use a National Instruments PCI-MIO-16E-4 AD/DA to read data from the AD, do some simple operations on it, and output the result on the DA at the fastest possible frequency, with as little jitter as possible.
I set up a machine for this with Xenomai3 (cobalt) and everything seems to work. I can run "latency" with max latency around 3-4 us. the analogy libraries are installed, the board is recognized and the test programs are able to read and write to it.
The problem is how to write a realtime program for this task. Is there
documentation at the basic level on howto do that or some place where I
can find examples for similar programs?
Thanks,
GianPiero
Signature · 3 lines
GianPiero Puccioni |Istituto dei Sistemi Complessi-CNR [email protected] |Via Madonna del Piano, 10 T:+39 0555226682 F:+39 0555226683|50019 Sesto F. (Firenze) ITALY
Quoted 10 lines · GianPiero Puccioni
Hi,
I am trying to use xenomai to accomplish a, I think, simple task, but I have never used real time programs before so I have some problems.
What I need is to use a National Instruments PCI-MIO-16E-4 AD/DA to read data from the AD, do some simple operations on it, and output the result on the DA at the fastest possible frequency, with as little jitter as possible.
Quoted 8 lines
I set up a machine for this with Xenomai3 (cobalt) and everything seems to work. I can run "latency" with max latency around 3-4 us. the analogy libraries are installed, the board is recognized and the test programs are able to read and write to it.
The problem is how to write a realtime program for this task. Is there
documentation at the basic level on howto do that or some place where I
can find examples for similar programs?
have you tried reading the Xenomai demo code or the analogy utilities?
http://git.xenomai.org/xenomai-3.git/tree/utils/analogy
Quoted 4 lines · Jorge Ramirez Ortiz
have you tried reading the Xenomai demo code or the analogy utilities?
http://git.xenomai.org/xenomai-3.git/tree/utils/analogy
Yes, of course, but the analogy utils are not written for realtime (and there are some bits missing, for example insn_read does not set the range properly), and the realtime examples are quite obscure for a beginner: only sparse comments and no explanation on what's going on.
GianPiero
Signature · 3 lines
GianPiero Puccioni |Istituto dei Sistemi Complessi-CNR [email protected] |Via Madonna del Piano, 10 T:+39 0555226682 F:+39 0555226683|50019 Sesto F. (Firenze) ITALY
Quoted 8 lines · GianPiero Puccioni
Quoted 4 lines · Jorge Ramirez Ortiz
have you tried reading the Xenomai demo code or the analogy utilities?
http://git.xenomai.org/xenomai-3.git/tree/utils/analogyYes, of course, but the analogy utils are not written for realtime
what do you mean? do you see mode switches when you run them?
I havent executed them in a while but as far as I remember some of them were.
Quoted 2 lines
(and there
are some bits missing, for exampleinsn_readdoes not set the range properly),
could you point me where?
Quoted 3 lines
and the realtime examples are quite obscure for a beginner: only sparse comments and no explanation on what's going on.
if you want a 101 example have a look at this control program
http://git.xenomai.org/xenomai-jro.git/tree/demo/posix/cobalt/gpiopwm.c?h=410c
it opens an rtdm driver that generates a PWM signal using a GPIO
http://git.xenomai.org/xenomai-jro.git/tree/kernel/drivers/gpiopwm/gpiopwm.c?h=410c
The control program spawns two threads one to set the PWM signal base configuration and another one to change the duty cycle (either automatically or via user control, optional vi command line)
The driver presents a rt path to change the duty cycle and start/stop the PWM signal (so no mode switches, always running in primary mode) and a non-rt path to set the config.
The config has to be in a non-rt path since the kernel framework to configure the GPIO requires some non-rt linux services.
It doesnt get any simpler than that I believe.
Quoted 1 line
GianPiero
Signature · 1 line
jro
Sorry for the delay, but I was away for a few days ... and then got the flu...
Quoted 10 lines · Jorge Ramirez Ortiz
Quoted 8 lines · GianPiero Puccioni
Quoted 4 lines · Jorge Ramirez Ortiz
have you tried reading the Xenomai demo code or the analogy utilities?
http://git.xenomai.org/xenomai-3.git/tree/utils/analogyYes, of course, but the analogy utils are not written for realtime
Quoted 8 lines
what do you mean? do you see mode switches when you run them?
I havent executed them in a while but as far as I remember some of them were.Quoted 2 lines
(and there
are some bits missing, for exampleinsn_readdoes not set the range properly),could you point me where?
I think it's where it calls a4l_sync_read and passes CHAN, that is only the channel info but not the range. While the range is used when printing the output, resulting in wrong values.
Quoted 14 lines
Quoted 3 lines
and the realtime examples are quite obscure for a beginner: only sparse comments and no explanation on what's going on.
if you want a 101 example have a look at this control program
http://git.xenomai.org/xenomai-jro.git/tree/demo/posix/cobalt/gpiopwm.c?h=410cit opens an rtdm driver that generates a PWM signal using a GPIO
http://git.xenomai.org/xenomai-jro.git/tree/kernel/drivers/gpiopwm/gpiopwm.c?h=410cThe control program spawns two threads one to set the PWM signal base configuration and another one to change the duty cycle (either automatically or via user control, optional vi command line)
Quoted 9 lines
The driver presents a rt path to change the duty cycle and start/stop the PWM signal (so no mode switches, always running in primary mode) and a non-rt path to set the config.
The config has to be in a non-rt path since the kernel framework to configure the GPIO requires some non-rt linux services.It doesnt get any simpler than that I believe.
Thanks, I'll check that.
GianPiero
Signature · 3 lines
GianPiero Puccioni |Istituto dei Sistemi Complessi-CNR [email protected] |Via Madonna del Piano, 10 T:+39 0555226682 F:+39 0555226683|50019 Sesto F. (Firenze) ITALY
If you know some french, you may have useful the book "Solutions temps réel sous Linux" [1]. The book itself is not free, but examples are available on its web site (I've no relation with its author).
It covers Xenomai at a basic level, among other basic realtime programming concepts.
[1] http://www.blaess.fr/christophe/livres/solutions-temps-reel-sous-linux/
Regards,
Orestes.
Quoted 33 lines · GianPiero Puccioni
Hi,
I am trying to use xenomai to accomplish a, I think, simple task, but I have never used real time programs before so I have some problems.
What I need is to use a National Instruments PCI-MIO-16E-4 AD/DA to read data from the AD, do some simple operations on it, and output the result on the DA at the fastest possible frequency, with as little jitter as possible.
I set up a machine for this with Xenomai3 (cobalt) and everything seems to work.
I can run "latency" with max latency around 3-4 us. the analogy libraries are installed, the board is recognized and the test programs are able to read and write to it.The problem is how to write a realtime program for this task. Is there
documentation at the basic level on howto do that or some place where I
can find examples for similar programs?Thanks,
GianPiero
--GianPiero Puccioni |Istituto dei Sistemi Complessi-CNR [email protected] |Via Madonna del Piano, 10 T:+39 0555226682 F:+39 0555226683|50019 Sesto F. (Firenze) ITALY_______________________________________________
Xenomai mailing list
[email protected]
http://xenomai.org/mailman/listinfo/xenomai
Quoted 8 lines · Orestes Mas
If you know some french, you may have useful the book "Solutions temps réel sous Linux" [1]. The book itself is not free, but examples are available on its web site (I've no relation with its author).
It covers Xenomai at a basic level, among other basic realtime programming concepts.
[1] http://www.blaess.fr/christophe/livres/solutions-temps-reel-sous-linux/
An english language book talking about Xenomai is "Building Embedded Linux Systems":
http://shop.oreilly.com/product/9780596529680.do
But it does not talk about analogy.
Signature · 2 lines
Gilles. https://click-hack.org