The CANopen network management uses the Heartbeat message as the confirmation of the NMT command sent by the NMT master device. Additionally, any CANopen device can use it, to check the availability of any other CANopen device. This is necessary in all cases, in which CANopen devices transmit PDO messages only on state-of-change events. The subscriber of such PDO messages could not know, if there is no event or if the device is not more available. The reception of the Heartbeat message of the related device indicates that it is still alive.
The transmission period is configurable by means of the heartbeat-producer-time parameter in the object dictionary of the transmitting device. The indication that a device is missing can be configured in any interested device by means of the heartbeat-consumer-time array. As a rule of thumb, the consumer time should twice of the producer time. The producer and consumer time configurations are highly application-specific.
In some applications, CANopen devices crosscheck each other by consuming the Heartbeat messages. Sensors normally do not consume Heartbeat messages, they just produce their PDO messages and their Heartbeat messages to indicate that they are still alive respectively to confirm the NMT command.
System designers are responsible for the configuration of the Heartbeat timing. There could be application-specific requirements that a device missing an essential device stops the production of its own Heartbeat message. The system designer should take care that the overall system availability is still sufficient.
The 1-byte Heartbeat message uses a CAN data frame with the ID 80016 plus producer node-ID. The one-byte content indicates the NMT status. This means, the consumer can also detect that a device does not sent PDO messages because of its NMT state. This can be evaluated in the consumer’s application program.
Heartbeat protocol: When the configured heartbeat-consumer-time elapses, the application gets an indication and may stop the production of its own Heartbeat message, because a missing CANopen device could be critical for the functionality
Heartbeat message content
The Hearbeat message is mapped to a CAN data frame with a 1-byte data field. This byte provides the NMT status of the CANopen device. It could be in Pre-operational state (7F16), Operational state (0516), or Stopped state (0416). In Pre-operational state the CANopen device does not process PDOs and in Stopped state it supports just the NMT message and sends its Heartbeat. In Operational state all CANopen functions are provided.
If the CAN data frame contains 0016, it is interpreted as Boot-up message indicating that this CANopen device has just entered the network. This happens after initial power-on, a power-cycle as well as after application and communication reset. The next CAN data frame with the same CAN-ID and content unequal 0016 is interpreted as Heartbeat message. The NMT master device uses the Heartbeat message as a confirmation of its NMT commands.