The EAP state machine

The EAP state machine (EAP SM) controls the state of the EAP device. Depending on the state, different functions are accessible or executable in the EAP device. A distinction is made between the following states:

  • Init
  • Pre-Operational
  • Safe-Operational and
  • Operational
The EAP state machine 1:

The regular state of each EAP device after it started is the OP state. Until the OP state is reached, the EAP device is switched once to each state in turn. During each state transition the EAP device performs certain actions. If an error occurs during one of the transitions, the device cannot be switched to the corresponding subsequent state and therefore remains in the state that was reached last. A readable error code can be used to diagnose the reason for the error.

Init

As a rule, the Init state of an EAP device is a temporary state. That is, the EAP device cannot be set to the Init state explicitly. Nevertheless, there are cases in which the SM resets the EAP device to the Init state. In this state neither mailbox communication nor process data communication with the EAP device is possible.

Pre-Operational (Pre-Op)

During the transition from Init to Pre-Op, the EAP device checks whether the mailbox was initialized correctly. In Pre-Op state, mailbox communication is possible, but not process data communication.

Safe-Operational (Safe-Op)

During the transition from Pre-Op to Safe-Op, the EAP device checks the internal object references and updates:

  • the cycle time-based configuration parameters,
  • the reference pointers to the input and output variables of the process image, and
  • the mapping of each Publisher/Subscriber variables to its process variables from the PLC.

In Safe-Op state, mailbox communication and sending of Publisher variables takes place. No EAP telegrams are received yet.

Operational (Op)

During the transition from Safe-Op to Op, the EAP device checks once again whether an error has occurred during startup.

In Op state the EAP device receives incoming EAP telegrams and copies the received process data to the input variables, if required. Mailbox communication takes place, Publisher variables are sent, and Subscriber variables are received.

If an error occurs in one of the state transitions, the EAP device remains either in the last reached state, or it is reset to Safe-Op state. At the same time, the error bit and a corresponding error code are set (cf. section The CANopen object dictionary in the documentation for the TwinCAT EAP device). Typical errors occur due to inconsistencies in the CANopen object dictionary, for example, so that the configuration is invalid.