All about CAN
-Hidden- -Hidden-
Nederlandse taal English language
Skip to main content

Layer Setting Services (LSS)

Interconnection in a CANopen network

As mentioned earlier, two conditions must be met for the interconnection of CANopen devices within a network:

  • All devices must use the same baud rate, and
  • All CANopen node IDs must be unique.

In the early days of CANopen, the node ID and baud rate could be set using DIP switches on the devices. Nowadays, of course, such settings are stored in non-volatile memory. The CANopen specification DS-306: Layer Setting Services (LSS) describes how these important values can be set via the bus using a simple protocol. A prerequisite for using LSS, in addition to software support from the node itself, is a 1:1 wired connection to the node. The baud rate and node ID can then be set via a dialogue. COB-ID 0x7E5 is used for CAN messages to the device; the device responds to this via COB-ID 0x7E4. LSS messages are always the full 8 bytes long. Unused bytes are reserved and must be initialised to 0.

To establish contact with the CANopen device to be configured, the “Global Switch Mode” command is sent:

CANopen LSS message: Start global switch ON

This command puts the device into LSS configuration mode. Unfortunately, this command does not return a confirmation response. The system integrator can therefore only determine whether the device has responded by sending the following command. The node ID is then requested via the ‘Inquire Node-ID’ message:

CANopen LSS message: Inquire Node-ID

If successful, the device responds with:

CANopen LSS message: Inquire Node-ID acknowledge

If there is no response, the device does not support LSS or the baud rate is incorrect. If the baud rate is not known at the start, the above message sequence must be repeated for all possible CANopen baud rates until the device sends a valid acknowledgement.
The “Configure Node-ID” message is then used to configure the new node-ID:

CANopen LSS message: Configure Node-ID

A possible error code is included in the node’s response:

CANopen LSS message: Configure Node-ID acknowledge

Error code 0 indicates a successful change; error code 1 indicates an invalid CANopen node ID; the other error codes are reserved. The ‘Error Extension’ contains vendor-specific information, but this is only valid for error code 0xFF.

CAN Bridges & Gateways
CAN Bridges & Gateways

If everything went well, the baud rate can be configured using the ‘Configure Bit Timing Parameters’ message:

CANopen LSS message: Configure Bit Timing

The standardised CANopen baud rates are as follows:

Baud rate table 0x00
Table index Baud rate
0 1000 kBit/s
1 800 kBit/s
2 500 kBit/s
3 250 kBit/s
4 125 kBit/s
5 Reserved
6 50 kbit/s
7 20 kBit/s
8 10 kBit/s

Once again, the node reports back:

CANopen LSS message: Configure Bit Timing acknowledge

Error code 0 indicates a successful change; error code 1 indicates an invalid baud rate; the other error codes are reserved. The ‘Error Extension’ contains vendor-specific information, but this is only valid for error code 0xFF.
Now that the CANopen node ID and baud rate have been configured, these settings must be saved using the “Store Configuration” message:

CANopen LSS message: Store Configuration

Here too, a possible error code forms part of the node response:

CANopen LSS message: Store Configuration acknowledge

Error code 0 indicates successful storage; error code 1 indicates that the device does not support the storage of values; error code 2 indicates a problem accessing the storage medium; the other error codes are reserved. The “Error Extension” contains vendor-specific information, but this is only valid for error code 0xFF. Finally, the device is returned from configuration mode to normal mode via “Switch Mode Global”:

CANopen LSS message: Stop global switch OFF

Once the CANopen node has been physically switched off and on again, or at least rebooted, the device will operate with the new settings.

All CAN Solutions
All CAN Solutions