Skip to contentSkip to conversation

Serial realtime communication

Xenomai Huy Cong Vu 3 participants 4 messages Nov 4, 2014 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello everyone,
I have a Linux thread which read/write to a device connected by usb port & I would like to bring it to Xenomai realtime by using rtdm library. What I wonder is the difference between the functions of rtdm & those of POSIX Xenomai skins, if the goal is only to bring the realtime properties to the process. For example, rt_dev_open() (of rtdm) & open() (of POSIX Xenomai). When I use open() of POSIX Xenomai, it works fine, but with rt_dev_open(), it returns -19 as output, with the same port address:
#define ENODEV 19 /* No such device */
And then, I don't really understand the purpose of making a serial communication become "realtime", which means that making the read() procedure more deterministically?
Best regards,
Huy Cong

#1 lore raw

I have same problem. I create a virtual device using struct rtdm_device. And I communicate it successfully. But I can't use physical device.

2014-11-04 13:59 GMT+02:00 Huy Cong Vu <[email protected]>:

Quoted 20 lines

Hello everyone,
I have a Linux thread which read/write to a device connected by usb port & I would like to bring it to Xenomai realtime by using rtdm library. What I wonder is the difference between the functions of rtdm & those of POSIX Xenomai skins, if the goal is only to bring the realtime properties to the process.
For example, rt_dev_open() (of rtdm) & open() (of POSIX Xenomai). When I use open() of POSIX Xenomai, it works fine, but with rt_dev_open(), it returns -19 as output, with the same port address:
#define ENODEV 19 /* No such device */
And then, I don't really understand the purpose of making a serial communication become "realtime", which means that making the read() procedure more deterministically?
Best regards,
Huy Cong
_______________________________________________
Xenomai mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai

#2 lore raw
In reply to Huy Cong Vu
Quoted 4 lines · Huy Cong Vu

Hello everyone,
I have a Linux thread which read/write to a device connected by usb port & I would like to bring it to Xenomai realtime by using rtdm library.

There is no support for this in Xenomai sources, you will have to use external libraries, but please do not ask support for these libraries on this mailing list: since it is code we do not maintain, it will be hard for us to support it.

Quoted 3 lines

What I wonder is the difference between the functions of rtdm & those of POSIX Xenomai skins, if the goal is only to bring the realtime properties to the process. For example, rt_dev_open() (of rtdm) & open() (of POSIX Xenomai). When I use open() of POSIX Xenomai, it works fine, but with rt_dev_open(), it returns -19 as output, with the same port address:
#define ENODEV 19 /* No such device */

That is simple: the posix skin open calls rt_dev_open, and if that fails with -ENODEV (or -ENOSYS), calls the plain Linux open, as can be seen here:

http://git.xenomai.org/xenomai-2.6.git/tree/src/skins/posix/rtdm.c#n63

The difference is that the POSIX skin is supposed to allow you to work both with Xenomai services and with Linux services. When your program wants to open a non real-time device, it can still use open instead of having to use __real_open. This allows compiling the same program for xenomai or not with minimal changes.

Quoted 1 line

And then, I don't really understand the purpose of making a serial communication become "realtime", which means that making the read() procedure more deterministically?

Well, to make a serial communication become "realtime", you first need an RTDM based driver. And yes, once you have an RTDM driver, when a task is suspended by "read", it is handled by Xenomai real-time scheduler. This way, it can not experience unbounded waits dues to the fact that Linux scheduler does not guarantee bounded latencies.

Signature · 1 line
					    Gilles.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 2 lines · Huy Cong Vu

So in order to use my usb device (which I guess is non real-time, or perhaps there is a ways to check it?)

A device is not real-time or not real-time. A driver is. If your device is using a Linux driver, then the driver is not real-time. If your device is using a Xenomai driver, then the driver is real-time.

Quoted 3 lines

in real-time, I have to instantiate an RTDM driver based on my device, and then after, perhaps it is possible to use functions in RTDM lib with that virtual device to manipulate the communication?

An RTDM device is no more virtual than a Linux device. The difference is the libraries you use to access it. If you use xenomai libraries, then you can access rtdm devices.

Quoted 3 lines

And as far as I know, it seems difficult to find a lib (or a driver) that supports serial connection in real-time...

Where did you get that idea? Xenomai sources contain drivers for several serial ports. People contribute them as they need them.

The most commonly used being the one you find in PCs, documented here:
http://xenomai.org/serial-16550a-driver/

Please do not forget to CC the mailing list.

Signature · 1 line
					    Gilles.