documentation/ethercat_doc.tex
changeset 2647 5a70ffc4644b
parent 2646 0c56c67072a6
equal deleted inserted replaced
2646:0c56c67072a6 2647:5a70ffc4644b
  2064 \item[eoeXaY] for a slave with a non-zero alias address, where X is the master
  2064 \item[eoeXaY] for a slave with a non-zero alias address, where X is the master
  2065 index and Y is the decimal alias address.
  2065 index and Y is the decimal alias address.
  2066 
  2066 
  2067 \end{description}
  2067 \end{description}
  2068 
  2068 
       
  2069 For some hints on how to configure these virtual interfaces, see
       
  2070 \autoref{sec:eoe-config}.
       
  2071 
  2069 Frames sent to these interfaces are forwarded to the associated slaves by the
  2072 Frames sent to these interfaces are forwarded to the associated slaves by the
  2070 master. Frames, that are received by the slaves, are fetched by the master and
  2073 master. Frames, that are received by the slaves, are fetched by the master and
  2071 forwarded to the virtual interfaces.
  2074 forwarded to the virtual interfaces.
  2072 
  2075 
  2073 This bears the following advantages:
  2076 This bears the following advantages:
  2189 execute the EoE state machines. For that, the master owns a kernel timer, that
  2192 execute the EoE state machines. For that, the master owns a kernel timer, that
  2190 is executed each timer interrupt. This guarantees a constant bandwidth, but
  2193 is executed each timer interrupt. This guarantees a constant bandwidth, but
  2191 poses the new problem of concurrent access to the master. The locking
  2194 poses the new problem of concurrent access to the master. The locking
  2192 mechanisms needed for this are introduced in \autoref{sec:concurr}.
  2195 mechanisms needed for this are introduced in \autoref{sec:concurr}.
  2193 
  2196 
       
  2197 \subsection{EoE Interface Configuration}
       
  2198 \label{sec:eoe-config}
       
  2199 
       
  2200 The configuration of the EoE network interfaces is a matter of using standard
       
  2201 Linux networking infrastructure commands like \lstinline+ifconfig+,
       
  2202 \lstinline+ip+ and \lstinline+brctl+. Though this lies not in the scope of
       
  2203 this document, some hints and examples are provided in this section.
       
  2204 
       
  2205 In the below examples it is assumed, that there are two slaves (0 and 1) with
       
  2206 EoE support in the bus. The first decision to make is whether to use a bridged
       
  2207 or routed environment.
       
  2208 
       
  2209 \paragraph{Bridging} A common solution is to create a bridge containing all EoE
       
  2210 interfaces:
       
  2211 
       
  2212 \begin{lstlisting}
       
  2213 $ `\textbf{brctl addbr br0}`
       
  2214 $ `\textbf{ip addr add 192.168.100.1/24 dev br0}`
       
  2215 $ `\textbf{brctl addif br0 eoe0s0}`
       
  2216 $ `\textbf{brctl addif br0 eoe0s1}`
       
  2217 \end{lstlisting}
       
  2218 
       
  2219 The above example allows to access IPv4 nodes using subnet 192.168.100.0/24
       
  2220 connected to the EtherCAT bus via EoE. Please note, that the example only
       
  2221 contains ad-hoc configuration commands: If the bus topology changes, the EoE
       
  2222 interfaces are re-created and have to be added to the bridge again. Therefore
       
  2223 it is highly recommended to use the networking configuration infrastructure of
       
  2224 the used Linux distribution to store this configuration permanently, so that
       
  2225 appearing EoE devices are added automatically.
       
  2226 
       
  2227 \paragraph{Routing} Another possibility is to create an IP subnet for each EoE
       
  2228 interface:
       
  2229 
       
  2230 \begin{lstlisting}
       
  2231 $ `\textbf{ip addr add 192.168.200.1/24 dev eoe0s0}`
       
  2232 $ `\textbf{ip addr add 192.168.201.1/24 dev eoe0s1}`
       
  2233 $ `\textbf{echo 1 > /proc/sys/net/ipv4/ip\_forward}`
       
  2234 \end{lstlisting}
       
  2235 
       
  2236 This example is again only an ad-hoc configuration (see above). Please note,
       
  2237 that it is necessary to set the default gateways properly on the IP nodes
       
  2238 connected to the EoE slaves, if they shall be able to communicate between the
       
  2239 different EoE interfaces / IP networks.
       
  2240 
       
  2241 \paragraph{Setting IP Parameters} If IP address and other parameters of the
       
  2242 EoE remote nodes (not the EoE interfaces on the master side) have to be set,
       
  2243 this can be achieved via the \lstinline+ethercat ip+ command-line tool (see
       
  2244 \autoref{sec:ipparam}).
       
  2245 
  2194 %------------------------------------------------------------------------------
  2246 %------------------------------------------------------------------------------
  2195 
  2247 
  2196 \section{CANopen over EtherCAT (CoE)}
  2248 \section{CANopen over EtherCAT (CoE)}
  2197 \label{sec:coe}
  2249 \label{sec:coe}
  2198 \index{CoE}
  2250 \index{CoE}
  2438 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_graph}
  2490 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_graph}
  2439 
  2491 
  2440 %------------------------------------------------------------------------------
  2492 %------------------------------------------------------------------------------
  2441 
  2493 
  2442 \subsection{Setting Ethernet-over-EtherCAT IP Parameters}
  2494 \subsection{Setting Ethernet-over-EtherCAT IP Parameters}
       
  2495 \label{sec:ipparam}
       
  2496 
       
  2497 Slaves can have own IP stack implementations accessible via EoE. Since some of
       
  2498 them do not provide other mechanisms to set IP parameters (because they only
       
  2499 have an EtherCAT interface), there is a possibility to set the below
       
  2500 parameters via EoE:
       
  2501 
       
  2502 \begin{itemize}
       
  2503 \item Ethernet MAC address\footnote{The MAC address of the virtual EoE remote
       
  2504 interface, not the one of the EtherCAT interface.},
       
  2505 \item IPv4 address,
       
  2506 \item IPv4 subnet mask,
       
  2507 \item IPv4 default gateway,
       
  2508 \item IPv4 DNS server,
       
  2509 \item DNS host name.
       
  2510 \end{itemize}
  2443 
  2511 
  2444 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_ip}
  2512 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_ip}
  2445 
  2513 
  2446 %------------------------------------------------------------------------------
  2514 %------------------------------------------------------------------------------
  2447 
  2515