Layer setting service (LSS) is CANopen setting service and protocol (CiA 305). CANopen equipment with LSS main function queries or changes three data of physical layer, data link layer and application layer on CANopen equipment through CAN network, including Node_ID, baud rate and LSS address (1018h).
Every LSS slave station has a unique LSS address, which contains four 1018h Identity object objects with 32-bit sub-indexes (see CiA301 specification for details). LSS slave station can be in configuration mode and waiting mode, and LSS master station is responsible for switching between the two modes.
Messages of LSS protocol are all composed of 8 bytes, of which byte 0 always contains the command specifier (CS) of the service, and the two CAN-IDs of LSS protocol are 7E5 and 7E4, respectively.
7E5h: Message (request) sent from LSS master station to LSS slave station.
7E4h: Message (response) sent from LSS slave station to LSS master station.
2. LSS service
LSS service mainly includes switch status service, configuration service, query service and identification service. Here, switch status service and configuration service are mainly introduced.
(1) Switch status service
With this service, the LSS master can switch the LSS slave to the configuration mode or the waiting mode. Only in the configuration mode can the LSS slave change the node ID and baud rate. Here, the command symbol CS=40h is mainly used. Through this service, all LSS slave stations in the network can be switched to the configuration mode or the waiting mode.
If you do not want to operate all LSS slave stations in the entire CAN network, you can also operate the corresponding equipment through the parameters in the LSS address. At this time, the LSS master will send four messages (as shown in the following figure), and then the corresponding slave stations will switch to the configuration mode and send confirmation.
(2) Configure service
By configuring the service, the LSS master can change and store (if necessary) the LSS slave node ID and baud rate.
1) Configuring Node Services
The LSS master sends a new node ID message to the LSS slave and returns an error code of 00h: no error, 01h: invalid node.
2) Configure baud rate service
The LSS master sends a new baud rate message to the LSS slave, and returns the error code 00h: no error, 01h: baud rate is not supported, and FFh: invalid table index.
The corresponding relationship between table index and baud rate is shown in the figure below
3) Activate bit timing parameter service
The LSS master uses this command to activate the set baud rate of all LSS slave stations in the network at the same time. The unit of switch delay is ms. This ensures that all LSS slave stations in the network have the same baud rate before sending messages again. After receiving this message from each LSS slave station, the time stored in it is the allowed waiting time. Only then can we accept the new baud rate and wait for the same time again; Only then can the LSS slave send the message again.
4) Save the configuration service
Through this service, LSS master station can save the reset node ID and baud rate; When performing this service, the LSS master station must ensure that only one LSS slave station in the network is in the configuration mode. Error code 00h: no error, 02h: access to nonvolatile memory failed.
At present, the parameters of an LSS slave station are set to node ID=40h and baud rate =1000kBd. Now, the parameters need to be modified as follows: node ID=04h and baud rate =500kBd. The following message command operations will be performed:
7E5 | 04 01 00 00 00 00 00 00 Switch LSS slave station to configuration mode
7E5 | 5E 00 00 00 00 00 00 00 00 Query the node ID of the LSS slave
7E4 | 5E 40 00 00 00 00 00 00 00 Reply to the node ID
7E5 | 11 04 00 00 00 00 00 00 Set the slave node to 04h
7E4 | 11 00 00 00 00 00 00 00 00 Slave station return confirmation
7E5 | 13 00 02 00 00 00 00 00 00 Set the baud rate of the LSS slave station to 500kBd
7E4 | 13 00 00 00 00 00 00 00 00 Slave station return confirmation
7E5 | 17 00 00 00 00 00 00 00 00 LSS master station sends the command to save changes
7E4 | 17 00 00 00 00 00 00 00 00 LSS Return Confirmation
7E5 | 04 00 00 00 00 00 00 00 00 Switch LSS slave station to waiting mode
705 | 00 The controller restarts to accept new parameters