documentation/ethercat_doc.tex
changeset 1327 4d179b06dd3c
parent 1309 d9f775cbbc1e
child 1364 471cd0e77b55
equal deleted inserted replaced
1326:ef907b0b5125 1327:4d179b06dd3c
   225   \item Automatic reconfiguration of slaves (for example after power failure)
   225   \item Automatic reconfiguration of slaves (for example after power failure)
   226   during operation.
   226   during operation.
   227 
   227 
   228   \end{itemize}
   228   \end{itemize}
   229 
   229 
   230 \item CANopen-over-EtherCAT (CoE)
   230 \item CANopen over EtherCAT (CoE)
   231 
   231 
   232   \begin{itemize}
   232   \begin{itemize}
   233 
   233 
   234   \item Sdo upload, download and information service.
   234   \item SDO upload, download and information service.
   235 
   235 
   236   \item Slave configuration via Sdos.
   236   \item Slave configuration via SDOs.
   237 
   237 
   238   \item Sdo access from userspace and from the application.
   238   \item SDO access from userspace and from the application.
   239 
   239 
   240   \end{itemize}
   240   \end{itemize}
   241 
   241 
   242 \item Ethernet-over-EtherCAT (EoE)
   242 \item Ethernet over EtherCAT (EoE)
   243 
   243 
   244   \begin{itemize}
   244   \begin{itemize}
   245 
   245 
   246   \item Transparent use of EoE slaves via virtual network interfaces.
   246   \item Transparent use of EoE slaves via virtual network interfaces.
   247 
   247 
   252 
   252 
   253 \item Userspace command-line-tool ``ethercat`` (see sec.~\ref{sec:tool})
   253 \item Userspace command-line-tool ``ethercat`` (see sec.~\ref{sec:tool})
   254 
   254 
   255   \begin{itemize}
   255   \begin{itemize}
   256 
   256 
   257   \item Showing the current bus with slaves, Pdos and Sdos.
   257   \item Showing the current bus with slaves, PDOs and SDOs.
   258   \item Showing the bus configuration.
   258   \item Showing the bus configuration.
   259   \item Showing domains and process data.
   259   \item Showing domains and process data.
   260   \item Setting the master's debug level.
   260   \item Setting the master's debug level.
   261   \item Writing alias addresses.
   261   \item Writing alias addresses.
   262   \item Sdo uploading/downloading.
   262   \item SDO uploading/downloading.
   263   \item Reading/writing a slave's SII.
   263   \item Reading/writing a slave's SII.
   264   \item Setting slave states.
   264   \item Setting slave states.
   265   \item Generate slave description XML.
   265   \item Generate slave description XML.
   266 
   266 
   267   \end{itemize}
   267   \end{itemize}
   455 
   455 
   456 \item[Idle phase]\index{Idle phase} takes effect when the master has accepted
   456 \item[Idle phase]\index{Idle phase} takes effect when the master has accepted
   457 an Ethernet device, but is not requested by any application yet. The master
   457 an Ethernet device, but is not requested by any application yet. The master
   458 runs its state machine (see sec.~\ref{sec:fsm-master}), that automatically
   458 runs its state machine (see sec.~\ref{sec:fsm-master}), that automatically
   459 scans the bus for slaves and executes pending operations from the userspace
   459 scans the bus for slaves and executes pending operations from the userspace
   460 interface (for example Sdo access). The command-line tool can be used to
   460 interface (for example SDO access). The command-line tool can be used to
   461 access the bus, but there is no process data exchange because of the missing
   461 access the bus, but there is no process data exchange because of the missing
   462 bus configuration.
   462 bus configuration.
   463 
   463 
   464 \item[Operation phase]\index{Operation phase} The master is requested by an
   464 \item[Operation phase]\index{Operation phase} The master is requested by an
   465 application that can provide a bus configuration and exchange process data.
   465 application that can provide a bus configuration and exchange process data.
   476 
   476 
   477 \paragraph{Process Data Image}
   477 \paragraph{Process Data Image}
   478 \index{Process data}
   478 \index{Process data}
   479 
   479 
   480 Slaves offer their inputs and outputs by presenting the master so-called
   480 Slaves offer their inputs and outputs by presenting the master so-called
   481 ``Process Data Objects'' (Pdos\index{Pdo}). The available Pdos can be either
   481 ``Process Data Objects'' (PDOs\index{PDO}). The available PDOs can be either
   482 determined by reading out the slave's TXPDO and RXPDO SII categories from the
   482 determined by reading out the slave's TXPDO and RXPDO SII categories from the
   483 E$^2$PROM (in case of fixed Pdos) or by reading out the appropriate CoE
   483 E$^2$PROM (in case of fixed PDOs) or by reading out the appropriate CoE
   484 objects (see sec.~\ref{sec:coe}), if available.  The application can register
   484 objects (see sec.~\ref{sec:coe}), if available.  The application can register
   485 the Pdos' entries for exchange during cyclic operation. The sum of all
   485 the PDOs' entries for exchange during cyclic operation. The sum of all
   486 registered Pdo entries defines the ``process data image'', which is exchanged
   486 registered PDO entries defines the ``process data image'', which is exchanged
   487 via datagrams with ``logical'' memory access (like LWR, LRD or LRW) introduced
   487 via datagrams with ``logical'' memory access (like LWR, LRD or LRW) introduced
   488 in~\cite[sec.~5.4]{dlspec}.
   488 in~\cite[sec.~5.4]{dlspec}.
   489 
   489 
   490 \paragraph{Process Data Domains}
   490 \paragraph{Process Data Domains}
   491 \index{Domain}
   491 \index{Domain}
   492 
   492 
   493 The process data image can be easily managed by creating so-called
   493 The process data image can be easily managed by creating so-called
   494 ``domains'', which allow grouped Pdo exchange. They also take care of managing
   494 ``domains'', which allow grouped PDO exchange. They also take care of managing
   495 the datagram structures needed to exchange the Pdos. Domains are mandatory for
   495 the datagram structures needed to exchange the PDOs. Domains are mandatory for
   496 process data exchange, so there has to be at least one. They were introduced
   496 process data exchange, so there has to be at least one. They were introduced
   497 for the following reasons:
   497 for the following reasons:
   498 
   498 
   499 \begin{itemize}
   499 \begin{itemize}
   500 
   500 
   504 footer: $1500 - 2 - 12 - 2 = 1484$ octets. If the size of the process data
   504 footer: $1500 - 2 - 12 - 2 = 1484$ octets. If the size of the process data
   505 image exceeds this limit, multiple frames have to be sent, and the image has
   505 image exceeds this limit, multiple frames have to be sent, and the image has
   506 to be partitioned for the use of multiple datagrams. A domain manages this
   506 to be partitioned for the use of multiple datagrams. A domain manages this
   507 automatically.
   507 automatically.
   508 
   508 
   509 \item Not every Pdo has to be exchanged with the same frequency: The values of
   509 \item Not every PDO has to be exchanged with the same frequency: The values of
   510 Pdos can vary slowly over time (for example temperature values), so exchanging
   510 PDOs can vary slowly over time (for example temperature values), so exchanging
   511 them with a high frequency would just waste bus bandwidth. For this reason,
   511 them with a high frequency would just waste bus bandwidth. For this reason,
   512 multiple domains can be created, to group different Pdos and so allow separate
   512 multiple domains can be created, to group different PDOs and so allow separate
   513 exchange.
   513 exchange.
   514 
   514 
   515 \end{itemize}
   515 \end{itemize}
   516 
   516 
   517 There is no upper limit for the number of domains, but each domain occupies
   517 There is no upper limit for the number of domains, but each domain occupies
   519 limited by the slaves.
   519 limited by the slaves.
   520 
   520 
   521 \paragraph{FMMU Configuration}
   521 \paragraph{FMMU Configuration}
   522 \index{FMMU!Configuration}
   522 \index{FMMU!Configuration}
   523 
   523 
   524 An application can register Pdo entries for exchange. Every Pdo entry and its
   524 An application can register PDO entries for exchange. Every PDO entry and its
   525 parent Pdo is part of a memory area in the slave's physical memory, that is
   525 parent PDO is part of a memory area in the slave's physical memory, that is
   526 protected by a sync manager \cite[sec.~6.7]{dlspec} for synchronized access.
   526 protected by a sync manager \cite[sec.~6.7]{dlspec} for synchronized access.
   527 In order to make a sync manager react on a datagram accessing its memory, it
   527 In order to make a sync manager react on a datagram accessing its memory, it
   528 is necessary to access the last byte covered by the sync manager. Otherwise
   528 is necessary to access the last byte covered by the sync manager. Otherwise
   529 the sync manager will not react on the datagram and no data will be exchanged.
   529 the sync manager will not react on the datagram and no data will be exchanged.
   530 That is why the whole synchronized memory area has to be included into the
   530 That is why the whole synchronized memory area has to be included into the
   531 process data image: For example, if a certain Pdo entry of a slave is
   531 process data image: For example, if a certain PDO entry of a slave is
   532 registered for exchange with a certain domain, one FMMU will be configured to
   532 registered for exchange with a certain domain, one FMMU will be configured to
   533 map the complete sync-manager-protected memory, the Pdo entry resides in. If a
   533 map the complete sync-manager-protected memory, the PDO entry resides in. If a
   534 second Pdo entry of the same slave is registered for process data exchange
   534 second PDO entry of the same slave is registered for process data exchange
   535 within the same domain, and it resides in the same sync-manager-protected
   535 within the same domain, and it resides in the same sync-manager-protected
   536 memory as the first one, the FMMU configuration is not altered, because the
   536 memory as the first one, the FMMU configuration is not altered, because the
   537 desired memory is already part of the domain's process data image. If the
   537 desired memory is already part of the domain's process data image. If the
   538 second Pdo entry would belong to another sync-manager-protected area, this
   538 second PDO entry would belong to another sync-manager-protected area, this
   539 complete area would also be included into the domains process data image.
   539 complete area would also be included into the domains process data image.
   540 
   540 
   541 Figure~\ref{fig:fmmus} gives an overview, how FMMUs are configured to map
   541 Figure~\ref{fig:fmmus} gives an overview, how FMMUs are configured to map
   542 physical memory to logical process data images.
   542 physical memory to logical process data images.
   543 
   543 
   557 % TODO
   557 % TODO
   558 %
   558 %
   559 % Interface version
   559 % Interface version
   560 % Master Requesting and Releasing
   560 % Master Requesting and Releasing
   561 % Master Locking
   561 % Master Locking
   562 % Configuring Pdo assignment and mapping
   562 % Configuring PDO assignment and mapping
   563 % Domains (memory)
   563 % Domains (memory)
   564 % Pdo entry registration
   564 % PDO entry registration
   565 % Sdo configuration
   565 % SDO configuration
   566 % Sdo access
   566 % SDO access
   567 
   567 
   568 The application interface provides functions and data structures for
   568 The application interface provides functions and data structures for
   569 applications to access an EtherCAT master. The complete documentation of the
   569 applications to access an EtherCAT master. The complete documentation of the
   570 interface is included as Doxygen~\cite{doxygen} comments in the header file
   570 interface is included as Doxygen~\cite{doxygen} comments in the header file
   571 \textit{include/ecrt.h}. It can either be read directly from the file
   571 \textit{include/ecrt.h}. It can either be read directly from the file
   578 Every application should use the master in two steps:
   578 Every application should use the master in two steps:
   579 
   579 
   580 \begin{description}
   580 \begin{description}
   581 
   581 
   582 \item[Configuration] The master is requested and the configuration is applied.
   582 \item[Configuration] The master is requested and the configuration is applied.
   583 For example, domains are created, slaves are configured and Pdo entries are
   583 For example, domains are created, slaves are configured and PDO entries are
   584 registered (see sec.~\ref{sec:masterconfig}).
   584 registered (see sec.~\ref{sec:masterconfig}).
   585 
   585 
   586 \item[Operation] Cyclic code is run and process data are exchanged (see
   586 \item[Operation] Cyclic code is run and process data are exchanged (see
   587 sec.~\ref{sec:cyclic}).
   587 sec.~\ref{sec:cyclic}).
   588 
   588 
  1468 monitored. If a slave is not in the state it supposed to be, the slave is
  1468 monitored. If a slave is not in the state it supposed to be, the slave is
  1469 (re-)configured.
  1469 (re-)configured.
  1470 
  1470 
  1471 \item[Request handling] Requests (either originating from the application or
  1471 \item[Request handling] Requests (either originating from the application or
  1472 from external sources) are handled. A request is a job that the master shall
  1472 from external sources) are handled. A request is a job that the master shall
  1473 process asynchronously, for example an SII access, Sdo access, or similar.
  1473 process asynchronously, for example an SII access, SDO access, or similar.
  1474 
  1474 
  1475 \end{description}
  1475 \end{description}
  1476 
  1476 
  1477 %------------------------------------------------------------------------------
  1477 %------------------------------------------------------------------------------
  1478 
  1478 
  1510 
  1510 
  1511 \item[SII Data] The SII contents are read into the master's image.
  1511 \item[SII Data] The SII contents are read into the master's image.
  1512 
  1512 
  1513 \item[PREOP] If the slave supports CoE, it is set to PREOP state using the
  1513 \item[PREOP] If the slave supports CoE, it is set to PREOP state using the
  1514 State change FSM (see sec.~\ref{sec:fsm-change}) to enable mailbox
  1514 State change FSM (see sec.~\ref{sec:fsm-change}) to enable mailbox
  1515 communication and read the Pdo configuration via CoE.
  1515 communication and read the PDO configuration via CoE.
  1516 
  1516 
  1517 \item[Pdos] The Pdos are read via CoE (if supported) using the Pdo Reading FSM
  1517 \item[PDOs] The PDOs are read via CoE (if supported) using the PDO Reading FSM
  1518 (see sec.~\ref{sec:fsm-pdo}). If this is successful, the Pdo information from
  1518 (see sec.~\ref{sec:fsm-pdo}). If this is successful, the PDO information from
  1519 the SII (if any) is overwritten.
  1519 the SII (if any) is overwritten.
  1520 
  1520 
  1521 \end{description}
  1521 \end{description}
  1522 
  1522 
  1523 %------------------------------------------------------------------------------
  1523 %------------------------------------------------------------------------------
  1552 is skipped.
  1552 is skipped.
  1553 
  1553 
  1554 \item[PREOP] The state change FSM is used to bring the slave to PREOP state.
  1554 \item[PREOP] The state change FSM is used to bring the slave to PREOP state.
  1555 If this is the requested state, the state machine is finished.
  1555 If this is the requested state, the state machine is finished.
  1556 
  1556 
  1557 \item[Sdo Configuration] If there is a slave configuration attached (see
  1557 \item[SDO Configuration] If there is a slave configuration attached (see
  1558 sec.~\ref{sec:masterconfig}), and there are any Sdo configurations are
  1558 sec.~\ref{sec:masterconfig}), and there are any SDO configurations are
  1559 provided by the application, these are sent to the slave.
  1559 provided by the application, these are sent to the slave.
  1560 
  1560 
  1561 \item[Pdo Configuration] The Pdo configuration state machine is executed to
  1561 \item[PDO Configuration] The PDO configuration state machine is executed to
  1562 apply all necessary Pdo configurations.
  1562 apply all necessary PDO configurations.
  1563 
  1563 
  1564 \item[Pdo Sync Manager Configuration] If any Pdo sync managers exist, they are
  1564 \item[PDO Sync Manager Configuration] If any PDO sync managers exist, they are
  1565 configured.
  1565 configured.
  1566 
  1566 
  1567 \item[FMMU Configuration] If there are FMMUs configurations supplied by the
  1567 \item[FMMU Configuration] If there are FMMUs configurations supplied by the
  1568 application (i.\,e.\ if the application registered Pdo entries), they are
  1568 application (i.\,e.\ if the application registered PDO entries), they are
  1569 applied. 
  1569 applied. 
  1570 
  1570 
  1571 \item[SAFEOP] The state change FSM is used to bring the slave to SAFEOP state.
  1571 \item[SAFEOP] The state change FSM is used to bring the slave to SAFEOP state.
  1572 If this is the requested state, the state machine is finished.
  1572 If this is the requested state, the state machine is finished.
  1573 
  1573 
  1675 
  1675 
  1676 \end{description}
  1676 \end{description}
  1677 
  1677 
  1678 %------------------------------------------------------------------------------
  1678 %------------------------------------------------------------------------------
  1679 
  1679 
  1680 \section{The Pdo State Machines}
  1680 \section{The PDO State Machines}
  1681 \label{sec:fsm-pdo}
  1681 \label{sec:fsm-pdo}
  1682 \index{FSM!Pdo}
  1682 \index{FSM!PDO}
  1683 
  1683 
  1684 The Pdo state machines are a set of state machines that read or write the Pdo
  1684 The PDO state machines are a set of state machines that read or write the PDO
  1685 assignment and the Pdo mapping via the ``CoE Communication Area'' described in
  1685 assignment and the PDO mapping via the ``CoE Communication Area'' described in
  1686 \cite[sec. 5.6.7.4]{alspec}. For the object access, the CANopen-over-EtherCAT
  1686 \cite[sec. 5.6.7.4]{alspec}. For the object access, the CANopen over EtherCAT
  1687 access primitives are used (see sec.~\ref{sec:coe}), so the slave must support
  1687 access primitives are used (see sec.~\ref{sec:coe}), so the slave must support
  1688 the CoE mailbox protocol.
  1688 the CoE mailbox protocol.
  1689 
  1689 
  1690 \paragraph{Pdo Reading FSM} This state machine (fig.~\ref{fig:fsm-pdo-read})
  1690 \paragraph{PDO Reading FSM} This state machine (fig.~\ref{fig:fsm-pdo-read})
  1691 has the purpose to read the complete Pdo configuration of a slave. It reads
  1691 has the purpose to read the complete PDO configuration of a slave. It reads
  1692 the Pdo assignment for each Sync Manager and uses the Pdo Entry Reading FSM
  1692 the PDO assignment for each Sync Manager and uses the PDO Entry Reading FSM
  1693 (fig.~\ref{fig:fsm-pdo-entry-read}) to read the mapping for each assigned Pdo.
  1693 (fig.~\ref{fig:fsm-pdo-entry-read}) to read the mapping for each assigned PDO.
  1694 
  1694 
  1695 \begin{figure}[htbp]
  1695 \begin{figure}[htbp]
  1696   \centering
  1696   \centering
  1697   \includegraphics[width=.4\textwidth]{graphs/fsm_pdo_read}
  1697   \includegraphics[width=.4\textwidth]{graphs/fsm_pdo_read}
  1698   \caption{Transition Diagram of the Pdo Reading State Machine}
  1698   \caption{Transition Diagram of the PDO Reading State Machine}
  1699   \label{fig:fsm-pdo-read}
  1699   \label{fig:fsm-pdo-read}
  1700 \end{figure}
  1700 \end{figure}
  1701 
  1701 
  1702 Basically it reads the every Sync manager's Pdo assignment Sdo's
  1702 Basically it reads the every Sync manager's PDO assignment SDO's
  1703 (\lstinline+0x1C1x+) number of elements to determine the number of assigned
  1703 (\lstinline+0x1C1x+) number of elements to determine the number of assigned
  1704 Pdos for this sync manager and then reads out the subindices of the Sdo to get
  1704 PDOs for this sync manager and then reads out the subindices of the SDO to get
  1705 the assigned Pdo's indices. When a Pdo index is read, the Pdo Entry Reading
  1705 the assigned PDO's indices. When a PDO index is read, the PDO Entry Reading
  1706 FSM is executed to read the Pdo's mapped Pdo entries.
  1706 FSM is executed to read the PDO's mapped PDO entries.
  1707 
  1707 
  1708 \paragraph{Pdo Entry Reading FSM} This state machine
  1708 \paragraph{PDO Entry Reading FSM} This state machine
  1709 (fig.~\ref{fig:fsm-pdo-entry-read}) reads the Pdo mapping (the Pdo entries) of
  1709 (fig.~\ref{fig:fsm-pdo-entry-read}) reads the PDO mapping (the PDO entries) of
  1710 a Pdo. It reads the respective mapping Sdo (\lstinline+0x1600+ --
  1710 a PDO. It reads the respective mapping SDO (\lstinline+0x1600+ --
  1711 \lstinline+0x17ff+, or \lstinline+0x1a00+ -- \lstinline+0x1bff+) for the given
  1711 \lstinline+0x17ff+, or \lstinline+0x1a00+ -- \lstinline+0x1bff+) for the given
  1712 Pdo by reading first the subindex zero (number of elements) to determine the
  1712 PDO by reading first the subindex zero (number of elements) to determine the
  1713 number of mapped Pdo entries. After that, each subindex is read to get the
  1713 number of mapped PDO entries. After that, each subindex is read to get the
  1714 mapped Pdo entry index, subindex and bit size.
  1714 mapped PDO entry index, subindex and bit size.
  1715 
  1715 
  1716 \begin{figure}[htbp]
  1716 \begin{figure}[htbp]
  1717   \centering
  1717   \centering
  1718   \includegraphics[width=.4\textwidth]{graphs/fsm_pdo_entry_read}
  1718   \includegraphics[width=.4\textwidth]{graphs/fsm_pdo_entry_read}
  1719   \caption{Transition Diagram of the Pdo Entry Reading State Machine}
  1719   \caption{Transition Diagram of the PDO Entry Reading State Machine}
  1720   \label{fig:fsm-pdo-entry-read}
  1720   \label{fig:fsm-pdo-entry-read}
  1721 \end{figure}
  1721 \end{figure}
  1722 
  1722 
  1723 \begin{figure}[htbp]
  1723 \begin{figure}[htbp]
  1724   \centering
  1724   \centering
  1725   \includegraphics[width=.9\textwidth]{graphs/fsm_pdo_conf}
  1725   \includegraphics[width=.9\textwidth]{graphs/fsm_pdo_conf}
  1726   \caption{Transition Diagram of the Pdo Configuration State Machine}
  1726   \caption{Transition Diagram of the PDO Configuration State Machine}
  1727   \label{fig:fsm-pdo-conf}
  1727   \label{fig:fsm-pdo-conf}
  1728 \end{figure}
  1728 \end{figure}
  1729 
  1729 
  1730 \begin{figure}[htbp]
  1730 \begin{figure}[htbp]
  1731   \centering
  1731   \centering
  1732   \includegraphics[width=.4\textwidth]{graphs/fsm_pdo_entry_conf}
  1732   \includegraphics[width=.4\textwidth]{graphs/fsm_pdo_entry_conf}
  1733   \caption{Transition Diagram of the Pdo Entry Configuration State Machine}
  1733   \caption{Transition Diagram of the PDO Entry Configuration State Machine}
  1734   \label{fig:fsm-pdo-entry-conf}
  1734   \label{fig:fsm-pdo-entry-conf}
  1735 \end{figure}
  1735 \end{figure}
  1736 
  1736 
  1737 %------------------------------------------------------------------------------
  1737 %------------------------------------------------------------------------------
  1738 
  1738 
  1742 The EtherCAT master implements the EoE and the CoE mailbox
  1742 The EtherCAT master implements the EoE and the CoE mailbox
  1743 protocols. See the below section for details.
  1743 protocols. See the below section for details.
  1744 
  1744 
  1745 %------------------------------------------------------------------------------
  1745 %------------------------------------------------------------------------------
  1746 
  1746 
  1747 \section{Ethernet-over-EtherCAT (EoE)}
  1747 \section{Ethernet over EtherCAT (EoE)}
  1748 \label{sec:eoe}
  1748 \label{sec:eoe}
  1749 \index{EoE}
  1749 \index{EoE}
  1750 
  1750 
  1751 The EtherCAT master implements the
  1751 The EtherCAT master implements the
  1752 Ethernet-over-EtherCAT\nomenclature{EoE}{Ethernet-over-EtherCAT, Mailbox
  1752 Ethernet over EtherCAT\nomenclature{EoE}{Ethernet over EtherCAT, Mailbox
  1753 Protocol} mailbox protocol~\cite[sec.~5.7]{alspec} to enable the tunneling of
  1753 Protocol} mailbox protocol~\cite[sec.~5.7]{alspec} to enable the tunneling of
  1754 Ethernet frames to special slaves, that can either have physical Ethernet
  1754 Ethernet frames to special slaves, that can either have physical Ethernet
  1755 ports to forward the frames to, or have an own IP stack to receive the frames.
  1755 ports to forward the frames to, or have an own IP stack to receive the frames.
  1756 
  1756 
  1757 \paragraph{Virtual Network Interfaces}
  1757 \paragraph{Virtual Network Interfaces}
  1901 an EoE interface link is set to ``up'', the requested slave's
  1901 an EoE interface link is set to ``up'', the requested slave's
  1902 application-layer state is automatically set to OP.
  1902 application-layer state is automatically set to OP.
  1903 
  1903 
  1904 %------------------------------------------------------------------------------
  1904 %------------------------------------------------------------------------------
  1905 
  1905 
  1906 \section{CANopen-over-EtherCAT (CoE)}
  1906 \section{CANopen over EtherCAT (CoE)}
  1907 \label{sec:coe}
  1907 \label{sec:coe}
  1908 \index{CoE}
  1908 \index{CoE}
  1909 
  1909 
  1910 The CANopen-over-EtherCAT\nomenclature{CoE}{CANopen-over-EtherCAT, Mailbox
  1910 The CANopen over EtherCAT\nomenclature{CoE}{CANopen over EtherCAT, Mailbox
  1911 Protocol} protocol~\cite[sec.~5.6]{alspec} is used to configure slaves and
  1911 Protocol} protocol~\cite[sec.~5.6]{alspec} is used to configure slaves and
  1912 exchange data objects on application level.
  1912 exchange data objects on application level.
  1913 
  1913 
  1914 % TODO
  1914 % TODO
  1915 %
  1915 %
  1916 % Download / Upload
  1916 % Download / Upload
  1917 % Expedited / Normal
  1917 % Expedited / Normal
  1918 % Segmenting
  1918 % Segmenting
  1919 % Sdo Info Services
  1919 % SDO Info Services
  1920 %
  1920 %
  1921 
  1921 
  1922 \ldots
  1922 \ldots
  1923 
  1923 
  1924 \paragraph{Sdo Download State Machine}
  1924 \paragraph{SDO Download State Machine}
  1925 
  1925 
  1926 The best time to apply Sdo configurations is during the slave's PREOP state,
  1926 The best time to apply SDO configurations is during the slave's PREOP state,
  1927 because mailbox communication is already possible and slave's application will
  1927 because mailbox communication is already possible and slave's application will
  1928 start with updating input data in the succeeding SAFEOP state. Therefore the
  1928 start with updating input data in the succeeding SAFEOP state. Therefore the
  1929 Sdo configuration has to be part of the slave configuration state machine (see
  1929 SDO configuration has to be part of the slave configuration state machine (see
  1930 sec.~\ref{sec:fsm-conf}): It is implemented via an Sdo download state machine,
  1930 sec.~\ref{sec:fsm-conf}): It is implemented via an SDO download state machine,
  1931 that is executed just before entering the slave's SAFEOP state. In this way,
  1931 that is executed just before entering the slave's SAFEOP state. In this way,
  1932 it is guaranteed that the Sdo configurations are applied each time, the slave
  1932 it is guaranteed that the SDO configurations are applied each time, the slave
  1933 is reconfigured.
  1933 is reconfigured.
  1934 
  1934 
  1935 The transition diagram of the Sdo Download state machine can be seen
  1935 The transition diagram of the SDO Download state machine can be seen
  1936 in figure~\ref{fig:fsm-coedown}.
  1936 in figure~\ref{fig:fsm-coedown}.
  1937 
  1937 
  1938 \begin{figure}[htbp]
  1938 \begin{figure}[htbp]
  1939   \centering
  1939   \centering
  1940   \includegraphics[width=.9\textwidth]{images/fsm-coedown} % FIXME
  1940   \includegraphics[width=.9\textwidth]{images/fsm-coedown} % FIXME
  1944 
  1944 
  1945 % FIXME
  1945 % FIXME
  1946 
  1946 
  1947 \begin{description}
  1947 \begin{description}
  1948 \item[START] The beginning state of the CoE download state
  1948 \item[START] The beginning state of the CoE download state
  1949   machine. The ``Sdo Download Normal Request'' mailbox command is
  1949   machine. The ``SDO Download Normal Request'' mailbox command is
  1950   sent. $\rightarrow$~REQUEST
  1950   sent. $\rightarrow$~REQUEST
  1951 
  1951 
  1952 \item[REQUEST] It is checked, if the CoE download request has been
  1952 \item[REQUEST] It is checked, if the CoE download request has been
  1953   received by the slave. After that, a mailbox check command is issued
  1953   received by the slave. After that, a mailbox check command is issued
  1954   and a timer is started. $\rightarrow$~CHECK
  1954   and a timer is started. $\rightarrow$~CHECK
  1955 
  1955 
  1956 \item[CHECK] If no mailbox data is available, the timer is checked.
  1956 \item[CHECK] If no mailbox data is available, the timer is checked.
  1957   \begin{itemize}
  1957   \begin{itemize}
  1958   \item If it timed out, the Sdo download is aborted.
  1958   \item If it timed out, the SDO download is aborted.
  1959     $\rightarrow$~ERROR
  1959     $\rightarrow$~ERROR
  1960   \item Otherwise, the mailbox is queried again.
  1960   \item Otherwise, the mailbox is queried again.
  1961     $\rightarrow$~CHECK
  1961     $\rightarrow$~CHECK
  1962   \end{itemize}
  1962   \end{itemize}
  1963 
  1963 
  1964   If the mailbox contains new data, the response is fetched.
  1964   If the mailbox contains new data, the response is fetched.
  1965   $\rightarrow$~RESPONSE
  1965   $\rightarrow$~RESPONSE
  1966 
  1966 
  1967 \item[RESPONSE] If the mailbox response could not be fetched, the data
  1967 \item[RESPONSE] If the mailbox response could not be fetched, the data
  1968   is invalid, the wrong protocol was received, or a ``Abort Sdo
  1968   is invalid, the wrong protocol was received, or a ``Abort SDO
  1969   Transfer Request'' was received, the Sdo download is aborted.
  1969   Transfer Request'' was received, the SDO download is aborted.
  1970   $\rightarrow$~ERROR
  1970   $\rightarrow$~ERROR
  1971 
  1971 
  1972   If a ``Sdo Download Normal Response'' acknowledgement was received,
  1972   If a ``SDO Download Normal Response'' acknowledgement was received,
  1973   the Sdo download was successful. $\rightarrow$~END
  1973   the SDO download was successful. $\rightarrow$~END
  1974 
  1974 
  1975 \item[END] The Sdo download was successful.
  1975 \item[END] The SDO download was successful.
  1976 
  1976 
  1977 \item[ERROR] The Sdo download was aborted due to an error.
  1977 \item[ERROR] The SDO download was aborted due to an error.
  1978 
  1978 
  1979 \end{description}
  1979 \end{description}
  1980 
  1980 
  1981 %------------------------------------------------------------------------------
  1981 %------------------------------------------------------------------------------
  1982 
  1982 
  1983 \section{Vendor-specific-over-EtherCAT (VoE)}
  1983 \section{Vendor specific over EtherCAT (VoE)}
  1984 \label{sec:voe}
  1984 \label{sec:voe}
  1985 \index{VoE}
  1985 \index{VoE}
  1986 
  1986 
  1987 The VoE protocol opens the possibility to implement a vendor-specific mailbox
  1987 The VoE protocol opens the possibility to implement a vendor-specific mailbox
  1988 communication protocol. VoE mailbox messages are prepended by a VoE header
  1988 communication protocol. VoE mailbox messages are prepended by a VoE header
  2085 
  2085 
  2086 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_master}
  2086 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_master}
  2087 
  2087 
  2088 %------------------------------------------------------------------------------
  2088 %------------------------------------------------------------------------------
  2089 
  2089 
  2090 \subsection{Sync Managers, Pdos and Pdo Entries}
  2090 \subsection{Sync Managers, PDOs and PDO Entries}
  2091 
  2091 
  2092 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_pdos}
  2092 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_pdos}
  2093 
  2093 
  2094 %------------------------------------------------------------------------------
  2094 %------------------------------------------------------------------------------
  2095 
  2095 
  2096 \subsection{Sdo Dictionary}
  2096 \subsection{SDO Dictionary}
  2097 
  2097 
  2098 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_sdos}
  2098 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_sdos}
  2099 
  2099 
  2100 %------------------------------------------------------------------------------
  2100 %------------------------------------------------------------------------------
  2101 
  2101 
  2102 \subsection{Sdo Access}
  2102 \subsection{SDO Access}
  2103 
  2103 
  2104 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_download}
  2104 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_download}
  2105 
  2105 
  2106 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_upload}
  2106 \lstinputlisting[basicstyle=\ttfamily\footnotesize]{external/ethercat_upload}
  2107 
  2107