Xenomai for beginners

I’ve seen several related threads on this forum for getting Xenomai up and running. And there are these three excellent posts for installing from source::

https://randomlinuxhacks.wordpress.com/2015/02/22/installing-xenomai-on-beaglebone-using-debian-distribution/
http://brunosmartins.info/xenomai-on-the-beaglebone-black-in-14-easy-steps/
http://elinux.org/EBC_Xenomai

But I wanted to make this a separate, more explicit discussion about Xenomai for beginners, which includes me. I’m running into some challenges getting it installed and tested properly, and hoped some of the RT experts here might provide some guidance. Specifically, I’m interested in how to install and test based on RCN’s available repo options, non-source method referenced at http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Kernel_Options:

$ sudo apt-cache search linux-image | grep 3.8.xx-xenomai
$ sudo apt-get install linux-image-3.8.xx-xenomai-rX

After successfully installing via the apt-get install method above, I see that it still requires installing userspace tools for running tests. Can someone guide me in how to install that toolset (latency, etc.)?

Thanks very much.
Charles Hamilton

sudo apt-get install xenomai-runtime

...is enough to get you going (along with the libxenomai1 dependency
that will get pulled in automatically). You might also want to
install some of the other packages, but they're not needed to run
applications (although -dev is needed if you intend to compile your
own programs).

The packages are in RCN's Debian repo that's enabled by default if
you've got any sort of recent Debian build for the BBB:

http://repos.rcn-ee.net/debian/pool/main/x/xenomai/

Thanks for that very speedy response, Charles.

FWIW, I’m running 3.8.13-xenomai-r72.

I’ve now installed xenomai-runtime and run the following:

  1. latency - test runs fine with sample output:

$ xeno latency

== Sampling period: 1000 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up…
RTT> 00:00:01 (periodic user-mode task, 1000 us period, priority 99)
RTH>----lat min|----lat avg|----lat max|-overrun|—msw|—lat best|–lat worst
RTD> 0.833| 1.958| 10.999| 0| 0| 0.833| 10.999
RTD> -1.167| 2.041| 31.791| 0| 0| -1.167| 31.791
RTD> 0.833| 2.958| 34.874| 0| 0| -1.167| 34.874
RTD> 0.999| 1.999| 14.291| 0| 0| -1.167| 34.874
RTD> -0.125| 2.041| 27.541| 0| 0| -1.167| 34.874
RTD> 0.916| 2.041| 28.499| 0| 0| -1.167| 34.874
RTD> 0.666| 1.999| 12.833| 0| 0| -1.167| 34.874
^C—|-----------|-----------|-----------|--------|------|-------------------------
RTS> -1.167| 2.124| 34.874| 0| 0| 00:00:07/00:00:07

  1. klatency - runs with following error:

$ xeno klatency
open(/proc/xenomai/registry/native/pipes/klat_pipe): No such file or directory
modprobe klat_mod or try the -P option?

Is the reason I can’t run the above due to kernel config issues? If so, it’s not clear to me where/how to change the config settings since I didn’t compile from source.

  1. Motor test - My intention is to run some motor tests with Xenomai and without and compare performance. Do you have any recommended Xenomai-specific tutorials using motors or for any actual use case of the kernel in action on the BBB? Although I recognize that much of your wonderful MachineKit work is about driving motors, I’ve found very little on the subject showing simple usage without capes or without MachineKit.

Thanks again for your great help.

Charles

2) *klatency* - runs with following error:

$ xeno klatency
open(/proc/xenomai/registry/native/pipes/klat_pipe): No such file or
directory
modprobe klat_mod or try the -P option?

Is the reason I can't run the above due to kernel config issues? If so,
it's not clear to me where/how to change the config settings since I didn't
compile from source.

Unknown, I'm not a Xenomai expert...I'd look into the docs at the
Xenomai site. If you need to build from source, just clone:

...and run "./build-deb.sh". You'll get a compiled kernel, *.deb
package, and a full source tree for experimenting.

3) *Motor test* - My intention is to run some motor tests with Xenomai and
without and compare performance. Do you have any recommended
Xenomai-specific tutorials using motors or for any actual use case of the
kernel in action on the BBB? Although I recognize that much of your
wonderful MachineKit work is about driving motors, I've found very little
on the subject showing simple usage without capes or without MachineKit.

"Motor test" is a bit vague. You can drive motors _many_ different
ways, from sending packets via Ethernet or CAN to controlling hardware
PWMs to interacting with the PRU to twiddling GPIO pins.

What exactly are you trying to do?

Right, sorry for the vagueness.

I’m basically trying to duplicate a range of RT tests across the same motor (basic, low cost stepper most likely) using PREEMPT_RT, Xenomai, PRU scenarios in order to better understand pros and cons of each. I didn’t want to overcomplicate this thread, esp. since there’s much related discussion around PRUs, so I was just focusing on the Xenomai part where there seemed to be less guidance.

Thanks much.
Charles

This sounds like an interesting study. Be sure to share your findings and your code.

–Mark