Difference between revisions of "Xenomai RTNet"

From wiki.emacinc.com
Jump to: navigation, search
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{todo| NotStarted (03.03.2016-13:06->MW+)|Michael Welling| project=OE 5.0,MW,NotStarted }}
+
{{todo| Complete (03.03.2016-13:06->MW+)(03.09.2016-09:50->KY+)|Michael Welling| project=OE 5.0,MW,MG,KY,Complete }}
 
{{#seo:
 
{{#seo:
 
|title=Xenomai RTNet
 
|title=Xenomai RTNet
Line 17: Line 17:
 
This document explains how to load a real-time Ethernet driver and perform basic tests. The links below will help augment this information
 
This document explains how to load a real-time Ethernet driver and perform basic tests. The links below will help augment this information
 
as well as discuss programming using the RTnet stack.
 
as well as discuss programming using the RTnet stack.
 
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*****************************************  Using/Working With  ******************************************/ -->
 
<!-- /*****************************************  Using/Working With  ******************************************/ -->
Line 23: Line 22:
 
{{:Templateimpl:using | initials=MW | title=Xenomai RTNet | desc=Xenomai RTNet | project=OE 5.0 }}
 
{{:Templateimpl:using | initials=MW | title=Xenomai RTNet | desc=Xenomai RTNet | project=OE 5.0 }}
 
=== Loading a RTNet driver ===
 
=== Loading a RTNet driver ===
As with the other real-time drivers, the Linux driver must be detached the interface before loading that real-time driver.
+
As with the other real-time drivers, the Linux driver must be detached from the interface before loading the real-time driver.
  
For example on IMX6 target the fec device must be unbound from the Linux driver and attached to the real-time driver.
+
For example on IMX6 target, the <code>fec</code> device must be unbound from the Linux driver and attached to the real-time driver.
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
 
root@somimx6-xenomai:~# echo 2188000.ethernet > /sys/bus/platform/drivers/fec/unbind  
 
root@somimx6-xenomai:~# echo 2188000.ethernet > /sys/bus/platform/drivers/fec/unbind  
Line 35: Line 34:
 
{{mbox | type= | text='''Note:''' The warning posted about the clock when unbinding the Linux fec driver can be ignored. }}
 
{{mbox | type= | text='''Note:''' The warning posted about the clock when unbinding the Linux fec driver can be ignored. }}
  
Xenomai provides a script make launching rtnet easier. This will load the appropriate modules and bring up the interface.
+
Xenomai provides a script to make launching <code>rtnet</code> easier. This will load the appropriate modules and bring up the interface.
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
root@somimx6-xenomai:/# rtnet start[  645.330848] initializing loopback...[  645.334487] RTnet: registered rtlo[  645.355662] RTcfg: init real-time configuration distribution protocol[  645.375986] RTmac: init realtime media access control[  645.400419] RTmac/TDMA: init time division multiple access control mechanism[  645.499423] rteth0: Freescale FEC PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=2188000.ethernet:01, irq=-1)[  645.551954] rteth0: tx link down!.
+
root@somimx6-xenomai:~# rtnet -cf /etc/rtnet.conf start
 +
[  645.330848] initializing loopback...
 +
[  645.334487] RTnet: registered rtlo[  645.355662] RTcfg: init real-time configuration distribution protocol
 +
[  645.375986] RTmac: init realtime media access control[  645.400419] RTmac/TDMA: init time division multiple access control mechanism
 +
[  645.499423] rteth0: Freescale FEC PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=2188000.ethernet:01, irq=-1)
 +
[  645.551954] rteth0: tx link down!.
 
...
 
...
 
[  652.497075] rt_fec 2188000.ethernet (unnamed net_device) (uninitialized): Link is Up - 1Gbps/Full - flow control rx/tx
 
[  652.497075] rt_fec 2188000.ethernet (unnamed net_device) (uninitialized): Link is Up - 1Gbps/Full - flow control rx/tx
Line 44: Line 48:
 
{{mbox | type= | text='''Note:''' The rtnet start will wait for slaves to connect. Press ctrl+c if slaves are not connected. }}
 
{{mbox | type= | text='''Note:''' The rtnet start will wait for slaves to connect. Press ctrl+c if slaves are not connected. }}
  
The rtnet helper script is configured with /etc/rtnet.conf which determines the IP address of the interfaces and the slave devices.
+
The <code>rtnet</code> helper script is configured with <code>/etc/rtnet.conf</code> which determines the IP address of the interface and the slave devices.
 +
The real-time driver is also specified in the configuration file so that it does not need to be loaded before starting the script, but the Linux driver still must be disassociated with the interface.
 +
 
 +
 
 +
=== Accessing RTNet driver ===
 +
 
 +
Xenomai provides real-time versions of the basic networking utilities including <code>rtifconfig</code>, <code>rtping</code>, <code>rtroute</code> and <code>rtiwconfig</code>.
 +
 
 +
<syntaxhighlight lang="console">
 +
root@somimx6-xenomai:~# rtifconfig
 +
rteth0    Medium: Ethernet  Hardware address: 00:00:00:00:00:00
 +
          IP address: 127.0.0.2  Broadcast address: 127.255.255.255
 +
          UP BROADCAST RUNNING  MTU: 1500
 +
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
 +
          TX packets:164476 errors:0 dropped:0 overruns:0 carrier:0
 +
          collisions:0
 +
          RX bytes:896 (896.0 b)  TX bytes:7031954 (6.7 Mb)
  
 +
rtlo      Medium: Local Loopback
 +
          IP address: 127.0.0.1 
 +
          UP LOOPBACK RUNNING  MTU: 1500
 +
</syntaxhighlight>
  
<!-- /*********************************************************************************************************/ -->
+
<syntaxhighlight lang="console">
<!-- /*****************************************       Examples        *****************************************/ -->
+
root@somimx6-xenomai:~# rtroute
<!-- /*********************************************************************************************************/ -->
+
Host Routing Table
{{:Templateimpl:examples | initials=MW | title=Xenomai RTNet | desc=Xenomai RTNet | project=OE 5.0 }}
+
Hash    Destination    HW Address              Device
 +
00      0.0.0.0        00:00:00:00:00:00      rtlo
 +
01      127.0.0.1      00:00:00:00:00:00      rtlo
 +
02      127.0.0.2      00:00:00:00:00:00      rtlo
 +
3F      127.255.255.255 FF:FF:FF:FF:FF:FF       rteth0
 +
 
 +
</syntaxhighlight>
 +
 
 +
<syntaxhighlight lang="console">
 +
root@somimx6-xenomai:~# rtping 127.0.0.1
 +
Real-time PING 127.0.0.1 56(84) bytes of data.
 +
64 bytes from 127.0.0.1: icmp_seq=1 time=25.7 us
 +
64 bytes from 127.0.0.1: icmp_seq=2 time=20.3 us
 +
64 bytes from 127.0.0.1: icmp_seq=3 time=17.3 us
 +
64 bytes from 127.0.0.1: icmp_seq=4 time=17.0 us
 +
64 bytes from 127.0.0.1: icmp_seq=5 time=17.3 us
 +
64 bytes from 127.0.0.1: icmp_seq=6 time=18.7 us
 +
64 bytes from 127.0.0.1: icmp_seq=7 time=17.0 us
 +
^C
 +
--- 127.0.0.1 rtping statistics ---
 +
7 packets transmitted, 7 received, 0% packet loss
 +
worst case rtt = 25.7 us
 +
</syntaxhighlight>
  
 
== External Links ==
 
== External Links ==

Latest revision as of 18:24, 9 March 2016

TODO: {{#todo: Complete (03.03.2016-13:06->MW+)(03.09.2016-09:50->KY+)|Michael Welling|OE 5.0,MW,MG,KY,Complete}}

General Information

Xenomai uses the RTNet stack to provide real-time Ethernet. RTNet provides deterministic versions of various protocols (UDP/IP, IMCP, ARP). Xenomai provides several real-time Ethernet drivers, the stack, and various tools. This document explains how to load a real-time Ethernet driver and perform basic tests. The links below will help augment this information as well as discuss programming using the RTnet stack.

Xenomai RTNet

Loading a RTNet driver

As with the other real-time drivers, the Linux driver must be detached from the interface before loading the real-time driver.

For example on IMX6 target, the fec device must be unbound from the Linux driver and attached to the real-time driver.

root@somimx6-xenomai:~# echo 2188000.ethernet > /sys/bus/platform/drivers/fec/unbind 
root@somimx6-xenomai:~# echo 2188000.ethernet > /sys/bus/platform/drivers/rt_fec/bind
[   86.762295] libphy: fec_enet_mii_bus: probed
[   86.766586] RTnet: registered rteth0

Xenomai provides a script to make launching rtnet easier. This will load the appropriate modules and bring up the interface.

root@somimx6-xenomai:~# rtnet -cf /etc/rtnet.conf start
[  645.330848] initializing loopback...
[  645.334487] RTnet: registered rtlo[  645.355662] RTcfg: init real-time configuration distribution protocol
[  645.375986] RTmac: init realtime media access control[  645.400419] RTmac/TDMA: init time division multiple access control mechanism
[  645.499423] rteth0: Freescale FEC PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=2188000.ethernet:01, irq=-1)
[  645.551954] rteth0: tx link down!.
...
[  652.497075] rt_fec 2188000.ethernet (unnamed net_device) (uninitialized): Link is Up - 1Gbps/Full - flow control rx/tx

The rtnet helper script is configured with /etc/rtnet.conf which determines the IP address of the interface and the slave devices. The real-time driver is also specified in the configuration file so that it does not need to be loaded before starting the script, but the Linux driver still must be disassociated with the interface.


Accessing RTNet driver

Xenomai provides real-time versions of the basic networking utilities including rtifconfig, rtping, rtroute and rtiwconfig.

root@somimx6-xenomai:~# rtifconfig
 rteth0    Medium: Ethernet  Hardware address: 00:00:00:00:00:00
          IP address: 127.0.0.2  Broadcast address: 127.255.255.255
          UP BROADCAST RUNNING  MTU: 1500
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:164476 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 
          RX bytes:896 (896.0 b)  TX bytes:7031954 (6.7 Mb)

rtlo      Medium: Local Loopback
          IP address: 127.0.0.1  
          UP LOOPBACK RUNNING  MTU: 1500
root@somimx6-xenomai:~# rtroute
Host Routing Table
Hash    Destination     HW Address              Device
00      0.0.0.0         00:00:00:00:00:00       rtlo
01      127.0.0.1       00:00:00:00:00:00       rtlo
02      127.0.0.2       00:00:00:00:00:00       rtlo
3F      127.255.255.255 FF:FF:FF:FF:FF:FF       rteth0
root@somimx6-xenomai:~# rtping 127.0.0.1
Real-time PING 127.0.0.1 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 time=25.7 us
64 bytes from 127.0.0.1: icmp_seq=2 time=20.3 us
64 bytes from 127.0.0.1: icmp_seq=3 time=17.3 us
64 bytes from 127.0.0.1: icmp_seq=4 time=17.0 us
64 bytes from 127.0.0.1: icmp_seq=5 time=17.3 us
64 bytes from 127.0.0.1: icmp_seq=6 time=18.7 us
64 bytes from 127.0.0.1: icmp_seq=7 time=17.0 us
^C
--- 127.0.0.1 rtping statistics ---
7 packets transmitted, 7 received, 0% packet loss
worst case rtt = 25.7 us

External Links