RTnet:Installation & Testing

From Xenomai
Jump to: navigation, search



This page describes the general installation procedures to follow for installing RTnet with both RTAI and Xenomai. This is intended as a guide to the beginner, multiple deviations to these instructions can be implemented for custom installations.


  • The basic installation of Xenomai or RTAI should be completed first, see the Xenomai or RTAI documentation regarding this.
  • The newest RTnet source files (*.tar.bz2) need to be downloaded from the RTnet site and extracted to the /usr/src folder on your local machine.
  • A symbolic link (shortcut) is created to the extracted RTnet source in /usr/src, it should be named rtnet, this is for quick access to the RTnet folder.
  • The permission and ownership flags of the RTnet folder should be set to root.
  • Change the working folder to RTnet and call the gconfig utility as follows:
cd rtnet
make gconfig
  • Select the following options in the gconfig menu:
  1. Variant->Xenomai 2.1 or RTAI 3.3 respectively
  2. Add-ons->Real-time Capturing Support->ON
  3. Examples->RTnet Application Examples->ON
  • Save the setup and exit.
  • Run the make and make install in the RTnet folder as follows:
make install

The RTnet installation folder will be created under /usr/local/rtnet

  • Create the RTnet management device node
mknod /dev/rtnet c 10 240

Testing with a single node (local loopback)

The testing procedure is as follows:

  • Disconnect the RTnet node's network cable from your normal non real-time ehternet network
  • Restart the systems into the patched kernel mode.
  • Display the Network setup with the command

This will show you have the eth0 running (which is your network card) and the lo running (which is the local loop-back)

  • You need to disable the non-realtime network operation of the network card. You do this by using the command
ifconfig eth0 down
  • You then remove the network card's device drivers or modules by calling e.g.
rmmod 8139too
  • Load the required modules of your real-time Linux extension needed for RTnet operations. If you have built the RTDM support of Xenomai into the kernel, nothing has to be done. Otherwise issue
modprobe xeno_rtdm

For RTAI, run the following command:

insmod rtai_hal.ko
insmod rtai_lxrt.ko
insmod rtai_sem.ko
insmod rtai_rtdm.ko

TODO: simplify the following steps.

  • Then you need to edit the file rtnet.conf under the /usr/local/rtnet/etc folder for the correct setup to run RTnet. Edit the following parameters:
  1. Set the host up as master or slave depending on how you are going to use it.
  2. The RT_DRIVER should be the realtime equivalent of the module you removed nl. rt_8139too.
  3. RT_DRIVER_OPTIONS should just have empty quotes because there is only one card on the Host.
  4. IPADDR = because you setup yourself as the master with this address and you want to talk to the local loopback which will be setup as a slave at
  5. NETMASK =
  6. RT_LOOPBACK = yes
  7. RTCAP = yes if you want to run real time capturing of packets like Ethereal.
  8. Setup TDMA_SLAVES = for loopback as the slave.
  • Save the file and run "./rtnet start" under the sbin/ directory.
  • It will wait for slaves. press cntl C to go out of its waiting for slaves. You can see that RTnet is running by calling "lsmod" and finding the realtime driver of the network card in the loaded module list. If it is not listed then RTnet is not actively running.
  • Run "./rtping" to ping the local loopback.
  • To stop RTnet transmitting on the card, run
./rtnet stop 

Testing with multiple nodes

The testing procedure is as follows:

  • Disconnect the RTnet nodes from the normal non real-time ehternet network
  • Connect the RTnet nodes to each other using a switch (or hub).
  • Restart the systems into the patched kernel mode.
  • Modify the rtnet config file: /usr/local/rtnet/etc/rtnet.conf. You should check the following:
  1. RT_DRIVER must be set to the correct real-time Ethernet NIC driver
  2. Set IPADDR to the station's (network-unique) IP address
  3. Set TDMA_MODE to "master" or "slave", depending on the node's role
  4. Place the slaves' IP addresses in TDMA_SLAVES, separated by spaces (only required by master)
  • Shut down the non-real time Ethernet device
  • Unload the non-real time Ethernet device driver modules
  • Load the required Xenomai or RTAI modules
  • Change to directory /usr/local/rtnet/sbin
  • Run "./rtnet start" on all nodes. The nodes should see each other, and then return to the command prompt.
  • Check the communication between the nodes - run "./rtping <IP_ADDR>", where <IP_ADDR> is the IP address of the other station(s). rtping should successfully ping the specified node.
  • Stop rtping by pressing Ctrl-C
  • Unload the RTnet modules by running the following command: "./rtnet stop"

Debugging RTnet

If RTnet doesn't work, or only works intermittedly, it is probably due to one of the following problems:

  • /dev/rtnet device node is missing.
  • The Xenomai or RTAI is not working as expected on your hardware.
  • The Linux driver for the real-time network device was built into the kernel and blocks the hardware.
  • IRQ clash. Recent Xenomai and RTAI versions are able to detect conflicts and report them to the kernel console. Older ones may lock up the system.
  • you are using rt_e1000 driver and RTnet 0.9.9 or older. See RTnet:rt_e1000 for a workaround.

Steps to resolve problems:

  • Check the kernel console or the system log for suspicious messages.
  • Validate that the basic tests of your real-time extension are working correctly. Xenomai, e.g., comes with an elemantary test called latency.
  • Collect informations about your setup (versions, configuration, output messages) and post a support request on rtnet-users.

Using realtime (RTnet) and non-realtime network together

If you have two (or more) ethernet lines available on your system, you can configure one to use RTnet (realtime) and the other one to use non-realtime network:

  • rmmod the non-realtime driver.
  • Load and start rtnet on one card using cards parameter (e.g. 'insmod rt_e1000.ko cards=1,0').
  • Load the non-realtime module and bring it up (the standard way using insmod and ifup). It will take whatever cards are left.

The parameter cards accepts an array of zeros and ones. For instance 'insmod rt_e1000.ko cards=0,1,0' will use the "middle" card of 3.

See script fragment below for an example:

insmod /usr/local/rtnet/modules/rt_e1000.ko  cards=1,0
insmod e1000
ifup eth1
Personal tools
Hardware Support