CANopen Basics - Guarding and Heartbeat
Node Monitoring via Node-Guarding or Heartbeat Messages
To ensure operability of network nodes, CANopen provides two alternatives:
With node guarding, a certain network node (the so-called NMT-master) requests the other nodes in the network (referred to accordingly as NMT-slaves) with a CAN remote frame one after the other at defined intervals ("guard time") to transmit a data telegram with its current communication state (stopped, operational, pre-operational) together with a toggle-bit. If a node does not respond to the request of the NMT-master within a certain time ("node life time"), this is assessed as a failure of the node and indicated to the host controller of the NMT-master as a "node-guarding event". On the other hand, the NMT-slaves also monitor whether they have received a request from the NMT-master within their "life time". If such a request was absent for longer than the so-called "life time" of a node, the NMT-slave assumes that the NMT-master itself has failed and indicates this event as "Life guarding event" to its host controller.
- Cyclic querying of the node state by a higher order instance, the so-called "NMT-Master" ("node guarding" principle) or
- Automatic transmission of a "heartbeat message" by the network nodes ("heartbeat" principle).
With node guarding, one CAN identifier per node is required to request the communication state. Low priority messages identifiers with a value of 1792 + node-ID are reserved for this.
With node monitoring according to the heartbeat principle, a node automatically transmits its communication state at regular intervals as evidence of its communication ability. The interval between two heartbeat messages ("heartbeat interval") of a heartbeat producer is configured via the object directory entry . A value of 0 disables the heartbeat mechanism. The so-called "heartbeat consumer time" of the up to 127 network nodes is given in the OD entry . This time interval describes the maximum time within which the arrival of a heartbeat message is expected by a particular node.
In a guarding or heartbeat message the communication status is transmitted in the form of a one-byte value:
t ..... Toggle-bit with node guarding
r ..... Reserved (= 0) with heartbeat
The following state values are defined:
0x00 - Bootup; 0x04 - Stopped; 0x05 - Operational; 0x7F - Pre-Operational. The highest value bit is assigned a special role - with guarding it must toggle, with heartbeat it must be constant 0.
The node status message has a special application as a so-called "bootup event". This message ("bootup message") is automatically sent by a network node as soon as it changes from "Initialization" state to "Pre-Operational" state; this notifies all nodes already present in a CANopen network of the presence of a new node. In addition, a configuring node (NMT-master) is informed when it may begin with the configuration of a node. The data byte of the bootup message has the value 0x00.