This paper addresses the issues of complexity, uniformity, and instability in remote control wiring for servo motors by proposing a new method for servo motor control using the open communication protocol DS301 and the driver sub-protocol DSP402.
Foreword
CANopen is a high-level communication protocol built on Controller Area Networks (CAN), including communication sub-protocols and device sub-protocols. It is commonly used in embedded systems and is also a frequently used fieldbus in industrial control. CANopen implements protocols above the network layer (including the network layer) in the OSI model. The CANopen standard includes an addressing scheme, several small communication sub-protocols, and an application layer defined by the device sub-protocols. CANopen supports network management, device monitoring, and inter-node communication, including a simplified transport layer that can handle the segmented transmission and combination of data. Generally, the data link layer and physical layer are implemented using CAN. Besides CANopen, other communication protocols (such as EtherCAT) also implement CANopen's device sub-protocols.
CANopen standards were drafted and reviewed by the non-profit organization CiA. The basic CANopen device and communication sub-protocols are defined in CiA301. Sub-protocols for individual devices are then expanded upon CiA301, such as CiA401 for I/O modules and CiA402 for motion control.
To address the problems of complex wiring, limited control options, and low reliability in remote control of servo motors, a novel method for servo motor control using the CANopen communication protocol and driver sub-protocol is proposed. The object dictionary and message format of the CANopen protocol are analyzed, and the transitions of each step in the CANopen servo control state machine are detailed, along with the message settings for implementing PP, PV, and HM servo control modes under the CANopen protocol. An experimental platform was constructed using a CAN card, a servo drive device, and a PC. Control of the servo motor in PP, PV, and HM modes based on the CANopen protocol was successfully implemented via message settings on the host computer interface. Experimental results demonstrate that controlling the motor using the protocol's message settings is simple and easy to operate, with fast and reliable communication data. Users can effectively monitor the servo motor through the host computer.
System Architecture Setup
The entire control system consists of a PC, a CANopen host computer, a USBCAN adapter, and servo drive devices. The CANopen communication part is implemented using the DS301 protocol, while the servo control part is implemented using the DSP402 protocol. The servo drive device acts as a slave node, possessing CANopen communication capabilities, and is responsible for controlling parameters such as motor current, speed, and position. It connects to the bus via a communication interface, transmitting information to the host computer interface. The host computer interface then controls the servo drive device through the USBCAN adapter based on the feedback information from the slave station. Figure 1 shows the overall architecture diagram of the servo control system using the open communication protocol.
Figure 1. Overall architecture diagram of the open communication protocol servo control system
Open communication protocol servo control principle
1CANopen communication device model
CANopen's device model is divided into three parts: communication unit, object dictionary, and application process. Users can use this model to describe devices with completely different functions.
The core concept of CANopen is the object dictionary, which contains all the parameters describing the device and its network behavior. Both application units and communication units can query this parameter list. Parameters in the object dictionary are identified and located using a 16-bit index and bit sub-indexes.
The communication section consists of a CAN transceiver, a CAN controller, and a CANopen protocol stack. The protocol stack defines communication objects for implementation: NMT (Network Management Message), PDO (Process Data Object), and SDO (Service Data Object). Predefined messages or special function objects (including synchronization messages, emergency messages, time stamp objects, etc.) describe all communication content and functions, and all communication between devices is accomplished through these communication objects. Specifically, NMT is used by the master station for status management of slave stations and for slave stations to respond to their own communication status. SDO is used by the master station for configuring and monitoring the object dictionary of slave stations. PDO is used to transmit high-speed, small data. Special function objects are used to synchronize communication objects (usually PDOs) in the network. The application section defines and describes the basic functions of the device. It is the link between the device and the master station's host computer. Its core function is to configure parameters, control and monitor the device's status by accessing the device's object dictionary, and to transmit the device's process data information at high speed.
2 Servo Control Mode
The CANopen driver and motion control device sub-protocol DSP402 requires highly accurate descriptions of its features. It defines not only the driver's operating mode but also the state machine used to control the driver. The driver state machine is controlled through control word 6040 in the object dictionary and reads the driver's state through status word 6041. The control state machine is shown in Figure 2.
The state machine can be divided into three parts: PowerDisabled (main power off), PowerEmbedded (main power on), and Fault. All states enter "Fault" upon alarm occurrence. After power-on, the driver completes initialization and then enters the SWUTCH_ON_DISABLED state. In this state, CAN communication is possible, and the driver can be configured. The main power remains off, and the motor is not energized. After StateTransitions 2 , 3 , and 4, it enters OPERATIONENABLE. At this point, the main power is on, and the driver controls the motor according to the configured operating mode. StateTransition 9 completes the shutdown of the main power circuit. Once an alarm occurs, the driver's state enters FAULT.
PP mode (simplified position mode) is a typical positioning mode, which can control the motor to run to the target position through single-step setting and continuous setting. PV mode (simplified speed mode) is a speed control mode, and HM (homing mode) provides multiple methods to reach the starting position.
System hardware and software design
1 System Hardware Design
This design uses USBCAN, a servo drive device, and a PC to build a hardware platform. The servo drive control chip is a DSP chip.
The system hardware setup is performed as follows: First, configure the relevant parameters in the TI development environment and create a DS301 project, then debug and run the CANopen protocol communication program. After successful project debugging, download the program to the driver, set the messages in the host computer interface, and test communication objects such as SDO, PDO, and NMT. If the test results are correct, the system hardware setup is complete.
2 System Software Design
The entire servo control software design was built in CCS, mainly including two parts: the closed-loop control program for the permanent magnet synchronous motor and the implementation of the CANopen protocol. Figure 3 shows the software design flowchart.
The initialization section mainly completes the initialization of the DSP system and the CANopen communication.
The initialization process mainly involves the following tasks:
Initialize relevant variables, enable global interrupt, and use the UVW signals from the servo motor encoder Hall sensor to determine the initial electrical angle position of the motor.
The main tasks performed during communication initialization are as follows:
Set the slave node address and CAN communication baud rate, initialize each communication object, complete the predefined mapping of each channel, and finally enter the communication processing program.
3 Servo Control Message Settings
The CANopen message structure consists of an 11-bit COB-ID and a data field of up to 8 bytes. In the host computer interface, the NMT message is used to set the slave station to enter either a pre-operation or running state. Then, the SDO message is used to set various servo control parameters (speed, position, etc.) and the various states of the state machine, allowing the motor to operate according to different control modes. Finally, by mapping the motor's current parameters to the PDO, reading the PDO message value, and comparing it with the set value, the correctness of the control result is determined. All control messages are implemented using SDO.
The following is a list of control messages in PP mode, PV mode, and HM mode:
1. PP Mode Control Message List
2. PV Mode Control Message List
3. HM mode message list
The above three control mode message operations all involve first setting the servo control mode, then inputting the relevant target control values (such as position, speed, homing mode, etc.) according to the current mode, and finally using the 6040h to control the motor to start and stop according to the state machine steps.
Simulation Experiment
The host computer interface of this system consists of two parts: the USBCAN host computer interface and the motor monitoring interface. The USBCAN host computer interface serves as the CANopen message data monitoring interface, while the motor monitoring interface is developed using VB2008. In the host computer interface, the communication baud rate is set to 1Mbps, the servo motor Node-ID is set to 1, the heartbeat cycle is 1s, and the TPDO transmission cycle is 100ms. The parameters for the motor current loop, position loop, and speed loop are also set. The configured messages are sequentially input into the SDO control of the host computer interface. The motor starts and runs to the set values in the messages. The values displayed on the motor manual remote control are consistent with the set values, and the values displayed in the messages on the host computer interface are also consistent with the set values, successfully achieving servo control.
1PP mode
The position control curve in the motor monitoring interface is shown in Figure 4 below:
Figure 4 Motor position control curve
After setting the message values in the host computer interface, the motor starts. The motor first accelerates, and after reaching the set target speed, it begins to run at a constant speed until it reaches the set target position value, at which point it stops changing. The process data on the host computer is consistent with the changes in the motor monitoring curve. If it is necessary to change the motor position value, new control messages are entered sequentially in the host computer interface. The motor will then rotate forward or reverse according to the set value and continue running to the new position.
2PV mode
The motor first accelerates to the set target speed value, and then operates at that speed. If it is necessary to change the operating speed, a new speed value can be entered in the host computer interface, and the acceleration changes are as described above. During deceleration control, the motor decelerates until the speed reaches a certain threshold and then stops. Figure 5 shows the speed control curve, which shows the consistency between the changes in host computer data and the changes in the motor monitoring curve.
Figure 5 Motor speed control curve
3HM mode
The motor first accelerates to the set speed, then searches for the origin position. After finding the origin, the motor returns to zero and decelerates until it reaches the set point. The current position value of the motor can be checked on both the host computer interface and the manual remote control servo motor. Both displays indicate that the motor's return-to-zero operation is complete. Figure 6 shows the position control curve.
Figure 6 Position control curve
in conclusion
In practical applications, the system designed in this paper demonstrates reliable operation, accurate and easily analyzable data, good real-time performance (accelerating before reaching the set target speed and then maintaining a constant speed), and easy implementation of the protocol stack. This method can be extended to multi-motor control systems, and the CANopen communication protocol stack is applicable to all devices, making it widely used in engineering applications.