documentation/ethercat_doc.tex
branchstable-1.4
changeset 1655 7853befa1a83
parent 1654 6b835fae2cab
child 1656 7d3996955804
equal deleted inserted replaced
1654:6b835fae2cab 1655:7853befa1a83
   197   \item It runs well even without realtime extensions.
   197   \item It runs well even without realtime extensions.
   198 
   198 
   199   \end{itemize}
   199   \end{itemize}
   200 
   200 
   201 \item Common ``Application Interface'' for applications, that want to use
   201 \item Common ``Application Interface'' for applications, that want to use
   202 EtherCAT functionality (see section~\ref{sec:ecrt}).
   202 EtherCAT functionality (see chap.~\ref{sec:ecrt}).
   203 
   203 
   204 \item \textit{Domains} are introduced, to allow grouping of process
   204 \item \textit{Domains} are introduced, to allow grouping of process
   205   data transfers with different slave groups and task periods.
   205   data transfers with different slave groups and task periods.
   206 
   206 
   207   \begin{itemize}
   207   \begin{itemize}
   330 \index{Master module}
   330 \index{Master module}
   331 
   331 
   332 Kernel module containing one or more EtherCAT master instances (see
   332 Kernel module containing one or more EtherCAT master instances (see
   333 section~\ref{sec:mastermod}), the ``Device Interface'' (see
   333 section~\ref{sec:mastermod}), the ``Device Interface'' (see
   334 section~\ref{sec:ecdev}) and the ``Application Interface'' (see
   334 section~\ref{sec:ecdev}) and the ``Application Interface'' (see
   335 section~\ref{sec:ecrt}).
   335 chap.~\ref{sec:ecrt}).
   336 
   336 
   337 \paragraph{Device Modules}
   337 \paragraph{Device Modules}
   338 \index{Device modules}
   338 \index{Device modules}
   339 
   339 
   340 EtherCAT-capable Ethernet device driver modules\index{Device modules}, that
   340 EtherCAT-capable Ethernet device driver modules\index{Device modules}, that
   351 Kernel modules, that use the EtherCAT master (usually for cyclic exchange of
   351 Kernel modules, that use the EtherCAT master (usually for cyclic exchange of
   352 process data with EtherCAT slaves). These modules are not part of the EtherCAT
   352 process data with EtherCAT slaves). These modules are not part of the EtherCAT
   353 master code\footnote{Although there are some examples provided in the
   353 master code\footnote{Although there are some examples provided in the
   354 \textit{examples/} directory.}, but have to be generated or written by the
   354 \textit{examples/} directory.}, but have to be generated or written by the
   355 user. An application module can ``request'' a master through the application
   355 user. An application module can ``request'' a master through the application
   356 interface (see section~\ref{sec:ecrt}). If this succeeds, the module has the
   356 interface (see chap.~\ref{sec:ecrt}). If this succeeds, the module has the
   357 control over the master: It can provide a bus configuration and exchange
   357 control over the master: It can provide a bus configuration and exchange
   358 process data.
   358 process data.
   359 
   359 
   360 %------------------------------------------------------------------------------
   360 %------------------------------------------------------------------------------
   361 
   361 
   426 \end{lstlisting}
   426 \end{lstlisting}
   427 
   427 
   428 The two masters can be addressed by their indices 0 and 1 respectively (see
   428 The two masters can be addressed by their indices 0 and 1 respectively (see
   429 figure~\ref{fig:masters}). The master index is needed for the
   429 figure~\ref{fig:masters}). The master index is needed for the
   430 \lstinline+ecrt_master_request()+ function of the application interface (see
   430 \lstinline+ecrt_master_request()+ function of the application interface (see
   431 section~\ref{sec:ecrt}) and the \lstinline+--master+ option of the
   431 chap.~\ref{sec:ecrt}) and the \lstinline+--master+ option of the
   432 \textit{ethercat} command-line tool (see section~\ref{sec:ethercat}), which
   432 \textit{ethercat} command-line tool (see section~\ref{sec:ethercat}), which
   433 defaults to $0$.
   433 defaults to $0$.
   434 
   434 
   435 \begin{figure}[htbp]
   435 \begin{figure}[htbp]
   436   \centering
   436   \centering
   627 \index{Concurrency}
   627 \index{Concurrency}
   628 
   628 
   629 In some cases, one master is used by several instances, for example when an
   629 In some cases, one master is used by several instances, for example when an
   630 application does cyclic process data exchange, and there are EoE-capable slaves
   630 application does cyclic process data exchange, and there are EoE-capable slaves
   631 that require to exchange Ethernet data with the kernel (see
   631 that require to exchange Ethernet data with the kernel (see
   632 section~\ref{sec:eoeimp}). For this reason, the master is a shared resource,
   632 section~\ref{sec:eoe}). For this reason, the master is a shared resource,
   633 and access to it has to be sequentialized. This is usually done by locking with
   633 and access to it has to be sequentialized. This is usually done by locking with
   634 semaphores, or other methods to protect critical sections.
   634 semaphores, or other methods to protect critical sections.
   635 
   635 
   636 The master itself can not provide locking mechanisms, because it has no chance
   636 The master itself can not provide locking mechanisms, because it has no chance
   637 to know the appropriate kind of lock. For example if the application uses RTAI
   637 to know the appropriate kind of lock. For example if the application uses RTAI
   653 Figure~\ref{fig:locks} exemplary shows, how two processes share one master:
   653 Figure~\ref{fig:locks} exemplary shows, how two processes share one master:
   654 The application's cyclic task uses the master for process data exchange, while
   654 The application's cyclic task uses the master for process data exchange, while
   655 the master-internal EoE process uses it to communicate with EoE-capable
   655 the master-internal EoE process uses it to communicate with EoE-capable
   656 slaves.  Both have to acquire the master lock before access: The application
   656 slaves.  Both have to acquire the master lock before access: The application
   657 task can access the lock natively, while the EoE process has to use the
   657 task can access the lock natively, while the EoE process has to use the
   658 callbacks.  See the application interface documentation
   658 callbacks.  See the application interface documentation (chap.~\ref{sec:ecrt}
   659 (section~\ref{sec:ecrt} of how to use the locking callbacks.
   659 of how to use the locking callbacks.
   660 
   660 
   661 %------------------------------------------------------------------------------
   661 %------------------------------------------------------------------------------
   662 
   662 
   663 \chapter{Ethernet Devices}
   663 \chapter{Ethernet Devices}
   664 \label{sec:devices}
   664 \label{sec:devices}
  1005 lines of code. The disadvantage is, that the master is blocked for the
  1005 lines of code. The disadvantage is, that the master is blocked for the
  1006 time it waits for datagram reception. There is no difficulty when only
  1006 time it waits for datagram reception. There is no difficulty when only
  1007 one instance is using the master, but if more instances want to
  1007 one instance is using the master, but if more instances want to
  1008 (synchronously\footnote{At this time, synchronous master access will
  1008 (synchronously\footnote{At this time, synchronous master access will
  1009   be adequate to show the advantages of an FSM. The asynchronous
  1009   be adequate to show the advantages of an FSM. The asynchronous
  1010   approach will be discussed in section~\ref{sec:eoeimp}}) use the
  1010   approach will be discussed in section~\ref{sec:eoe}}) use the
  1011 master, it is inevitable to think about an alternative to the
  1011 master, it is inevitable to think about an alternative to the
  1012 sequential model.
  1012 sequential model.
  1013 
  1013 
  1014 Master access has to be sequentialized for more than one instance
  1014 Master access has to be sequentialized for more than one instance
  1015 wanting to send and receive datagrams synchronously. With the present
  1015 wanting to send and receive datagrams synchronously. With the present
  1575 
  1575 
  1576 The Pdo state machines are a set of state machines that read or write the Pdo
  1576 The Pdo state machines are a set of state machines that read or write the Pdo
  1577 assignment and the Pdo mapping via the ``CoE Communication Area'' described in
  1577 assignment and the Pdo mapping via the ``CoE Communication Area'' described in
  1578 \cite[section 5.6.7.4]{alspec}. For the object access, the
  1578 \cite[section 5.6.7.4]{alspec}. For the object access, the
  1579 CANopen-over-EtherCAT access primitives are used (see
  1579 CANopen-over-EtherCAT access primitives are used (see
  1580 section~\ref{sec:coeimp}), so the slave must support the CoE mailbox protocol.
  1580 section~\ref{sec:coe}), so the slave must support the CoE mailbox protocol.
  1581 
  1581 
  1582 \paragraph{Pdo Reading FSM} This state machine (fig.~\ref{fig:fsm-pdo-read})
  1582 \paragraph{Pdo Reading FSM} This state machine (fig.~\ref{fig:fsm-pdo-read})
  1583 has the purpose to read the complete Pdo configuration of a slave. It reads
  1583 has the purpose to read the complete Pdo configuration of a slave. It reads
  1584 the Pdo assignment for each Sync Manager and uses the Pdo Entry Reading FSM
  1584 the Pdo assignment for each Sync Manager and uses the Pdo Entry Reading FSM
  1585 (fig.~\ref{fig:fsm-pdo-entry-read}) to read the mapping for each assigned Pdo.
  1585 (fig.~\ref{fig:fsm-pdo-entry-read}) to read the mapping for each assigned Pdo.
  1635 protocols. See the below section for details.
  1635 protocols. See the below section for details.
  1636 
  1636 
  1637 %------------------------------------------------------------------------------
  1637 %------------------------------------------------------------------------------
  1638 
  1638 
  1639 \section{Ethernet-over-EtherCAT (EoE)}
  1639 \section{Ethernet-over-EtherCAT (EoE)}
  1640 \label{sec:eoeimp}
  1640 \label{sec:eoe}
  1641 \index{EoE}
  1641 \index{EoE}
  1642 
  1642 
  1643 The EtherCAT master implements the Ethernet-over-EtherCAT mailbox protocol to
  1643 The EtherCAT master implements the Ethernet-over-EtherCAT mailbox protocol to
  1644 enable the tunneling of Ethernet frames to special slaves, that can either
  1644 enable the tunneling of Ethernet frames to special slaves, that can either
  1645 have physical Ethernet ports to forward the frames to, or have an own IP stack
  1645 have physical Ethernet ports to forward the frames to, or have an own IP stack
  1793 application-layer state is automatically set to OP.
  1793 application-layer state is automatically set to OP.
  1794 
  1794 
  1795 %------------------------------------------------------------------------------
  1795 %------------------------------------------------------------------------------
  1796 
  1796 
  1797 \section{CANopen-over-EtherCAT (CoE)}
  1797 \section{CANopen-over-EtherCAT (CoE)}
  1798 \label{sec:coeimp}
  1798 \label{sec:coe}
  1799 \index{CoE}
  1799 \index{CoE}
  1800 
  1800 
  1801 The CANopen-over-EtherCAT protocol \cite[section~5.6]{alspec} is used to
  1801 The CANopen-over-EtherCAT protocol \cite[section~5.6]{alspec} is used to
  1802 configure slaves and exchange data objects on application level.
  1802 configure slaves and exchange data objects on application level.
  1803 
  1803