documentation/ethercat_doc.tex
changeset 813 bfc3f1ab52de
parent 487 448b0b23b905
child 814 a51f857b1b2d
equal deleted inserted replaced
812:80c3d9c8292f 813:bfc3f1ab52de
  2825 remains in one state until the sub state machine terminates. This is
  2825 remains in one state until the sub state machine terminates. This is
  2826 usually done like in the listing below, which is taken out of the
  2826 usually done like in the listing below, which is taken out of the
  2827 slave configuration state machine code:
  2827 slave configuration state machine code:
  2828 
  2828 
  2829 \begin{lstlisting}[language=C,numbers=left]
  2829 \begin{lstlisting}[language=C,numbers=left]
  2830   void ec_fsm_slaveconf_saveop(ec_fsm_t *fsm)
  2830   void ec_fsm_slaveconf_safeop(ec_fsm_t *fsm)
  2831   {
  2831   {
  2832           fsm->change_state(fsm); // execute state change
  2832           fsm->change_state(fsm); // execute state change
  2833                                   // sub state machine
  2833                                   // sub state machine
  2834 
  2834 
  2835           if (fsm->change_state == ec_fsm_error) {
  2835           if (fsm->change_state == ec_fsm_error) {
  3189   If the slave supports no FMMUs, the FMMU configuration can be
  3189   If the slave supports no FMMUs, the FMMU configuration can be
  3190   skipped. If the slave has SDOs to configure, it is begun with
  3190   skipped. If the slave has SDOs to configure, it is begun with
  3191   sending the first SDO. $\rightarrow$~SDO\_CONF
  3191   sending the first SDO. $\rightarrow$~SDO\_CONF
  3192 
  3192 
  3193   If no SDO configurations are provided, the slave can now directly be
  3193   If no SDO configurations are provided, the slave can now directly be
  3194   brought into the SAVEOP state and the state change state machine is
  3194   brought into the SAFEOP state and the state change state machine is
  3195   started again. $\rightarrow$~SAVEOP
  3195   started again. $\rightarrow$~SAFEOP
  3196 
  3196 
  3197   Otherwise, all supported FMMUs are configured according to the PDOs
  3197   Otherwise, all supported FMMUs are configured according to the PDOs
  3198   requested via the master's realtime interface. The appropriate
  3198   requested via the master's realtime interface. The appropriate
  3199   datagram is issued. $\rightarrow$~FMMU
  3199   datagram is issued. $\rightarrow$~FMMU
  3200 
  3200 
  3201 \item[FMMU] The FMMU configuration datagram was accepted. If the slave
  3201 \item[FMMU] The FMMU configuration datagram was accepted. If the slave
  3202   has SDOs to configure, it is begun with sending the first SDO.
  3202   has SDOs to configure, it is begun with sending the first SDO.
  3203   $\rightarrow$~SDO\_CONF
  3203   $\rightarrow$~SDO\_CONF
  3204 
  3204 
  3205   Otherwise, the slave can now be brought into the SAVEOP state. The
  3205   Otherwise, the slave can now be brought into the SAFEOP state. The
  3206   state change state machine is started.
  3206   state change state machine is started.
  3207   $\rightarrow$~SAVEOP
  3207   $\rightarrow$~SAFEOP
  3208 
  3208 
  3209 \item[SDO\_CONF] The CoE state machine is executed until termination.
  3209 \item[SDO\_CONF] The CoE state machine is executed until termination.
  3210   $\rightarrow$~SDO\_CONF
  3210   $\rightarrow$~SDO\_CONF
  3211 
  3211 
  3212   If another SDO has to be configured, a new SDO download sequence is
  3212   If another SDO has to be configured, a new SDO download sequence is
  3213   begun. $\rightarrow$~SDO\_CONF
  3213   begun. $\rightarrow$~SDO\_CONF
  3214 
  3214 
  3215   Otherwise, the slave can now be brought into the SAVEOP state. The
  3215   Otherwise, the slave can now be brought into the SAFEOP state. The
  3216   state change state machine is started.
  3216   state change state machine is started.
  3217   $\rightarrow$~SAVEOP
  3217   $\rightarrow$~SAFEOP
  3218 
  3218 
  3219 \item[SAVEOP] The state change state machine is executed until
  3219 \item[SAFEOP] The state change state machine is executed until
  3220   termination. $\rightarrow$~SAVEOP
  3220   termination. $\rightarrow$~SAFEOP
  3221 
  3221 
  3222   If the state change failed, the configuration has to be aborted.
  3222   If the state change failed, the configuration has to be aborted.
  3223   $\rightarrow$~END
  3223   $\rightarrow$~END
  3224 
  3224 
  3225   If the SAVEOP state was the target state, the configuration is
  3225   If the SAFEOP state was the target state, the configuration is
  3226   finished. $\rightarrow$~END
  3226   finished. $\rightarrow$~END
  3227 
  3227 
  3228   The slave can now directly be brought into the OP state and the
  3228   The slave can now directly be brought into the OP state and the
  3229   state change state machine is started a last time.
  3229   state change state machine is started a last time.
  3230   $\rightarrow$~OP
  3230   $\rightarrow$~OP
  3629 \paragraph{SDO Download State Machine}
  3629 \paragraph{SDO Download State Machine}
  3630 
  3630 
  3631 The best time to apply SDO configurations is during the slave's PREOP
  3631 The best time to apply SDO configurations is during the slave's PREOP
  3632 state, because mailbox communication is already possible and slave's
  3632 state, because mailbox communication is already possible and slave's
  3633 application will start with updating input data in the succeeding
  3633 application will start with updating input data in the succeeding
  3634 SAVEOP state. Therefore the SDO configuration has to be part of the
  3634 SAFEOP state. Therefore the SDO configuration has to be part of the
  3635 slave configuration state machine (see section~\ref{sec:fsm-conf}): It
  3635 slave configuration state machine (see section~\ref{sec:fsm-conf}): It
  3636 is implemented via an SDO download state machine, that is executed
  3636 is implemented via an SDO download state machine, that is executed
  3637 just before entering the slave's SAVEOP state. In this way, it is
  3637 just before entering the slave's SAFEOP state. In this way, it is
  3638 guaranteed that the SDO configurations are applied each time, the
  3638 guaranteed that the SDO configurations are applied each time, the
  3639 slave is reconfigured.
  3639 slave is reconfigured.
  3640 
  3640 
  3641 The transition diagram of the SDO Download state machine can be seen
  3641 The transition diagram of the SDO Download state machine can be seen
  3642 in figure~\ref{fig:fsm-coedown}.
  3642 in figure~\ref{fig:fsm-coedown}.
  3888   It can be read or written:
  3888   It can be read or written:
  3889 
  3889 
  3890   \begin{lstlisting}[gobble=4]
  3890   \begin{lstlisting}[gobble=4]
  3891     # `\textbf{cat /sys/ethercat0/slave003/state}`
  3891     # `\textbf{cat /sys/ethercat0/slave003/state}`
  3892     OP
  3892     OP
  3893     # `\textbf{echo SAVEOP > /sys/ethercat0/slave003/state}`
  3893     # `\textbf{echo SAFEOP > /sys/ethercat0/slave003/state}`
  3894   \end{lstlisting}
  3894   \end{lstlisting}
  3895 
  3895 
  3896   This command should also be receipted with a syslog message:
  3896   This command should also be receipted with a syslog message:
  3897 
  3897 
  3898   \begin{lstlisting}[gobble=4]
  3898   \begin{lstlisting}[gobble=4]
  3899     EtherCAT: Accepted new state SAVEOP for slave 3.
  3899     EtherCAT: Accepted new state SAFEOP for slave 3.
  3900     EtherCAT: Changing state of slave 3 from OP to SAVEOP.
  3900     EtherCAT: Changing state of slave 3 from OP to SAFEOP.
  3901     EtherCAT: Slave states: INIT, SAVEOP, OP.
  3901     EtherCAT: Slave states: INIT, SAFEOP, OP.
  3902   \end{lstlisting}
  3902   \end{lstlisting}
  3903 
  3903 
  3904   After the new requested state was accepted from user space, the
  3904   After the new requested state was accepted from user space, the
  3905   operation state machine (see section~\ref{sec:fsm-op}) or the idle
  3905   operation state machine (see section~\ref{sec:fsm-op}) or the idle
  3906   state machine (section~\ref{sec:fsm-idle}) notices, that the
  3906   state machine (section~\ref{sec:fsm-idle}) notices, that the
  3994   `\$` `\textbf{lsec}`
  3994   `\$` `\textbf{lsec}`
  3995   EtherCAT bus listing for master 0:
  3995   EtherCAT bus listing for master 0:
  3996      0  1:0  OP      EK1100 Ethernet Kopplerklemme (2A E-Bus)
  3996      0  1:0  OP      EK1100 Ethernet Kopplerklemme (2A E-Bus)
  3997      1  1:1  INIT    EL4132 2K. Ana. Ausgang +/-10V
  3997      1  1:1  INIT    EL4132 2K. Ana. Ausgang +/-10V
  3998      2  1:2  INIT    EL4132 2K. Ana. Ausgang +/-10V
  3998      2  1:2  INIT    EL4132 2K. Ana. Ausgang +/-10V
  3999      3  1:3  SAVEOP  EL4132 2K. Ana. Ausgang +/-10V
  3999      3  1:3  SAFEOP  EL4132 2K. Ana. Ausgang +/-10V
  4000      4  1:4  INIT    EL5101 Incremental Encoder Interface
  4000      4  1:4  INIT    EL5101 Incremental Encoder Interface
  4001      5  1:5  INIT    EL1014 4K. Dig. Eingang 24V, 10s
  4001      5  1:5  INIT    EL1014 4K. Dig. Eingang 24V, 10s
  4002      6  1:6  OP      EL6601 1 Port Switch (Ethernet, CoE)
  4002      6  1:6  OP      EL6601 1 Port Switch (Ethernet, CoE)
  4003      7  1:7  INIT    EL5101 Incremental Encoder Interface
  4003      7  1:7  INIT    EL5101 Incremental Encoder Interface
  4004      8  1:8  INIT    EL5001 1K. SSI Encoder
  4004      8  1:8  INIT    EL5001 1K. SSI Encoder