ifm
System Manual
ecomat
mobile
SmartController (CR2500) V05
CAN in the ecomatmobile controller
Software for CAN and CANopen
55
8.4
Software for CAN and CANopen
In principle,
ecomat
mobile
controllers can directly participate in the CAN communication (layer 2) by
using the functions CANx_TRANSMIT and CANx_RECEIVE. In the operating mode CANopen the
programmer is provided with the defined services from the programming system CoDeSys.
The following points must be considered:
•
In the operating mode CAN layer 2 the programmer is responsible for all services. The controller is
in this state after the following events:
- after a program download or
- after a reset command by the programming system
•
The operating mode CANopen is activated by integrating the CoDeSys CANopen system libraries
(activate functions in the target settings). Depending on the selected function the controller
operates as CANopen master or slave (
→
from chapter ifm CANopen library,
→
page
8.5
CAN errors and error handling
The error mechanisms described are automatically processed by the CAN controller integrated in the
controller. This cannot be influenced by the user. (Depending on the application) the user should react
to signalled errors in the application software.
Goal of the CAN error mechanisms:
•
Ensuring uniform data objects in the complete CAN network
•
Permanent functionality of the network even in case of a faulty CAN participant
•
Differentiation between temporary and permanent disturbance of a CAN participant
•
Localisation and self-deactivation of a faulty participant in 2 steps:
- error passive
- disconnection from the bus (bus off)
This gives a temporarily disturbed participant a "rest".
To give the interested user an overview of the behaviour of the CAN controller in case of an error,
error handling is easily described below. After error detection the information is automatically prepared
and made available to the programmer as CAN error bits in the application software.
8.5.1
Error message
If a bus participant detects an error condition, it immediately transmits an error flag. The transmission
is then aborted or the correct messages already received by other participants are rejected. This
ensures that correct and uniform data is available to all participants. Since the error flag is directly
transmitted the sender can immediately start to repeat the disturbed message as opposed to other
fieldbus systems (they wait until a defined acknowledgement time has elapsed). This is one of the
most important features of CAN.
One of the basic problems of serial data transmission is that a permanently disturbed or faulty bus
participant can block the complete system. Error handling for CAN would increase such a risk. To
exclude this, a mechanism is required which detects the fault of a participant and disconnects this
participant from the bus, if necessary.