All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Programming Xenomai+analogy
@ 2015-12-22 14:28 GianPiero Puccioni
  2015-12-22 23:45 ` Jorge Ramirez Ortiz
  2015-12-23 15:45 ` Orestes Mas
  0 siblings, 2 replies; 7+ messages in thread
From: GianPiero Puccioni @ 2015-12-22 14:28 UTC (permalink / raw)
  To: xenomai

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
gianpiero.puccioni@isc.cnr.it    |Via Madonna del Piano, 10
T:+39 0555226682 F:+39 0555226683|50019 Sesto F. (Firenze) ITALY


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

* Re: [Xenomai] Programming Xenomai+analogy
  2015-12-22 14:28 [Xenomai] Programming Xenomai+analogy GianPiero Puccioni
@ 2015-12-22 23:45 ` Jorge Ramirez Ortiz
  2015-12-23  8:44   ` GianPiero Puccioni
  2015-12-23 15:45 ` Orestes Mas
  1 sibling, 1 reply; 7+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-12-22 23:45 UTC (permalink / raw)
  To: xenomai

On 12/22/2015 09:28 AM, GianPiero Puccioni wrote:
> 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?


have you tried reading the Xenomai demo code or the analogy utilities?
http://git.xenomai.org/xenomai-3.git/tree/utils/analogy


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

* Re: [Xenomai] Programming Xenomai+analogy
  2015-12-22 23:45 ` Jorge Ramirez Ortiz
@ 2015-12-23  8:44   ` GianPiero Puccioni
  2015-12-23 13:59     ` Jorge Ramirez Ortiz
  0 siblings, 1 reply; 7+ messages in thread
From: GianPiero Puccioni @ 2015-12-23  8:44 UTC (permalink / raw)
  To: xenomai

On 23/12/15 00:45, Jorge Ramirez Ortiz wrote:

>
> 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
-- 
GianPiero Puccioni               |Istituto dei Sistemi Complessi-CNR
gianpiero.puccioni@isc.cnr.it    |Via Madonna del Piano, 10
T:+39 0555226682 F:+39 0555226683|50019 Sesto F. (Firenze) ITALY


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

* Re: [Xenomai] Programming Xenomai+analogy
  2015-12-23  8:44   ` GianPiero Puccioni
@ 2015-12-23 13:59     ` Jorge Ramirez Ortiz
  2016-01-08 12:37       ` GianPiero Puccioni
  0 siblings, 1 reply; 7+ messages in thread
From: Jorge Ramirez Ortiz @ 2015-12-23 13:59 UTC (permalink / raw)
  To: gianpiero.puccioni; +Cc: xenomai

On 12/23/2015 03:44 AM, GianPiero Puccioni wrote:
> On 23/12/15 00:45, Jorge Ramirez Ortiz wrote:
> 
>>
>> 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

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.

> (and there
> are some bits missing, for example insn_read does not set the range properly),

could you point me where?

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


> GianPiero

-- 
jro


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

* Re: [Xenomai] Programming Xenomai+analogy
  2015-12-22 14:28 [Xenomai] Programming Xenomai+analogy GianPiero Puccioni
  2015-12-22 23:45 ` Jorge Ramirez Ortiz
@ 2015-12-23 15:45 ` Orestes Mas
  2015-12-23 15:58   ` Gilles Chanteperdrix
  1 sibling, 1 reply; 7+ messages in thread
From: Orestes Mas @ 2015-12-23 15:45 UTC (permalink / raw)
  Cc: xenomai

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.

On Tue, Dec 22, 2015 at 3:28 PM, GianPiero Puccioni <
gianpiero.puccioni@isc.cnr.it> wrote:

> 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
> gianpiero.puccioni@isc.cnr.it    |Via Madonna del Piano, 10
> T:+39 0555226682 F:+39 0555226683|50019 Sesto F. (Firenze) ITALY
>
> _______________________________________________
> Xenomai mailing list
> Xenomai@xenomai.org
> http://xenomai.org/mailman/listinfo/xenomai
>

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

* Re: [Xenomai] Programming Xenomai+analogy
  2015-12-23 15:45 ` Orestes Mas
@ 2015-12-23 15:58   ` Gilles Chanteperdrix
  0 siblings, 0 replies; 7+ messages in thread
From: Gilles Chanteperdrix @ 2015-12-23 15:58 UTC (permalink / raw)
  To: Orestes Mas; +Cc: xenomai

On Wed, Dec 23, 2015 at 04:45:00PM +0100, Orestes Mas wrote:
> 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.

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


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

* Re: [Xenomai] Programming Xenomai+analogy
  2015-12-23 13:59     ` Jorge Ramirez Ortiz
@ 2016-01-08 12:37       ` GianPiero Puccioni
  0 siblings, 0 replies; 7+ messages in thread
From: GianPiero Puccioni @ 2016-01-08 12:37 UTC (permalink / raw)
  To: Jorge Ramirez Ortiz; +Cc: xenomai

Sorry for the delay, but I was away for a few days ... and then got the flu...

On 23/12/15 14:59, Jorge Ramirez Ortiz wrote:
> On 12/23/2015 03:44 AM, GianPiero Puccioni wrote:
>> On 23/12/15 00:45, Jorge Ramirez Ortiz wrote:
>>
>>>
>>> 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
>
> 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.
>
>> (and there
>> are some bits missing, for example insn_read does 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.


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

Thanks, I'll check that.

GianPiero
-- 
GianPiero Puccioni               |Istituto dei Sistemi Complessi-CNR
gianpiero.puccioni@isc.cnr.it    |Via Madonna del Piano, 10
T:+39 0555226682 F:+39 0555226683|50019 Sesto F. (Firenze) ITALY


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

end of thread, other threads:[~2016-01-08 12:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-22 14:28 [Xenomai] Programming Xenomai+analogy GianPiero Puccioni
2015-12-22 23:45 ` Jorge Ramirez Ortiz
2015-12-23  8:44   ` GianPiero Puccioni
2015-12-23 13:59     ` Jorge Ramirez Ortiz
2016-01-08 12:37       ` GianPiero Puccioni
2015-12-23 15:45 ` Orestes Mas
2015-12-23 15:58   ` 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.