Application of CAN bus technology in embedded machine tool CNC systems
2026-04-06 04:29:24··#1
[align=center]Pan Yuedou, School of Information Engineering, University of Science and Technology Beijing; Xu Zhenlin, School of Automation, Tianjin University; Xu Donggui, School of Electronic and Information Engineering, Zhanjiang Ocean University[/align] This paper proposes a design method for an embedded machine tool CNC system based on a DSP (TMS320F2812) and CAN bus structure, solving the problem of the impact of instruction information errors between the CNC system and the servo on the performance of the CNC system. A CAN bus-based data structure between the CNC system and the servo is designed. The designed CNC system features high integration, flexible structure, good scalability, and high cost-effectiveness. 1 Introduction Currently, the main market share of domestically produced CNC systems is in economical machine tool CNC systems. These systems are mostly 16-bit microprocessors with a maximum clock frequency of 12–40MHz, resulting in low operating speeds. This limits the improvement of CNC machine tool performance, especially in functions such as multi-axis high-speed linkage, high-speed thread cutting, and high-resolution real-time control. Furthermore, most mid-to-high-end closed-loop CNC systems for machine tools currently used domestically and internationally employ a control method where the position loop adjustment is completed by the CNC system, connected to a speed servo system. The speed servo system adjusts the load torque current and motor speed. The machine tool CNC system converts the output data of the position loop regulator into analog signals via a D/A converter, which then serves as the machine tool CNC system's output command to control the servo system. The servo system converts the analog voltage commands output by the machine tool CNC system into motor control commands via an A/D converter. During this process, due to the D/A and A/D conversions, errors occur in the real-time command data output by the machine tool CNC system's position loop regulator when transmitted to the servo system, affecting the motor's control performance and making it difficult to achieve high-precision machining control. Therefore, this paper proposes a design method for an embedded machine tool CNC system based on a DSP (TMS320F2812) and CAN bus structure. 2 Hardware Structure Design of the CNC System This system adopts a DSP (Digital Signal Processor) + programmable logic device structure, using F2812 + CPLD as the core hardware to complete the CNC system design. The TMS320F2812DSP (hereinafter referred to as F2812) is the latest generation of high-speed, high-performance fixed-point DSP in the 2000 series manufactured by Texas Instruments (T1). Its 32-bit CPU can provide 150M instructions/s and has a CAN bus interface. The system principle is shown in Figure 1. The F2812 CPU mainly performs two tasks: ① Data communication with the host computer, including downloading machining programs, setting basic parameters, and receiving unified commands from the host computer; ② Completing the machining work of an independent CNC system. This involves inputting the machining program, control parameters, and compensation data, followed by decoding the machining program, data processing, calculating tool radius compensation, feed rate, executing auxiliary function codes, performing interpolation calculations, and sending the interpolated data to the servo driver via the CAN bus. The CPLD section mainly implements logic circuits and a counter for counting handwheel pulses. It includes a 4x frequency multiplier circuit and a 32-bit counter to count the spindle encoder signal for use during thread interpolation. [IMG=Figure 1 CNC System Structure Diagram]/uploadpic/THESIS/2007/11/20071114161502573434.jpg[/IMG] Figure 1 CNC System Structure Diagram [IMG=Figure 2 System Software Structure Diagram]/uploadpic/THESIS/2007/11/20071114161736355377.jpg[/IMG] Figure 2 System Software Structure Diagram [IMG=Table 1 Definition of 16-bit Control Signal Words]/uploadpic/THESIS/2007/11/20071114162004170088.jpg[/IMG] Table 1 Definition of 16-bit Control Signal Words [IMG=Table 2 [Definition of 16-bit Status Signals]/uploadpic/THESIS/2007/11/2007111416220085531K.jpg[/IMG] Table 2 Definition of 16-bit Status Signals 3 Software Structure of CNC System In a CNC control system, the basic functions of CNC are implemented by various functional subroutines. Different software structures arrange the functional modules differently and manage them differently. In this system, the software adopts an interrupt-type software structure. This CNC system consists of the following 5 main modules, and their interrelationships are shown in Figure 2. (1) Human-Machine Interface Module: Display of machining status information, parameter management, file management, DNC function, program input, etc. (2) Data Processing Module: Decoding, tool compensation. (3) Task Coordination Module: Calculation and position control of the control system under different modes. (4) Control Module: Speed processing, interpolation preprocessing, interpolation calculation, position control. (5) PLC module: S, M, T function implementation, machine tool panel function implementation, fault diagnosis, and information feedback. 4 Communication between CNC system and servo system based on CAN bus The CAN interface between CNC system and servo is used to transmit motion data and control status data. The data sent from CNC to servo includes control signals from CNC system to servo, modified values of servo parameters, and instruction servo motion data values; the data sent from servo system to CNC system includes the current status signal of servo, servo parameters, and actual motion data values of servo. 4.1 Data sent from CNC to servo 4.1.1 Definition of CNC data transmission structure The information that CNC needs to send to servo system mainly includes: control signals, (position/speed) increments, and servo parameters (when servo parameters are modified on CNC). The data structure of each frame during point-to-point transmission is as follows: The following data content is the control signal for servo, which is defined in 16-bit words, and the meaning of each bit can be defined by the user, see Table 1. 4.1.2 Data Transmission Method Under normal circumstances, the CNC sends control signals to the servo system in an irregular manner, specifically in the following three situations: ① After power-on (or restart) initialization, the CNC sends a control signal every 200ms to establish communication with the servo until communication is established; ② When the CNC needs to change its control over the servo; ③ When an alarm occurs. Transmission is generally point-to-point, but broadcasting can be used when necessary. When the CNC needs to send (position/speed) increments to the servo system, it uses a timed transmission method, generally broadcasting, but point-to-point can be used when necessary. 4.2 Data Sent from Servo to CNC 4.2.1 Servo Data Transmission Structure Definition The data information that the servo system needs to send to the CNC mainly includes: status signals, servo parameters, actual (encoder) (position/speed) increments, and other servo data. The structure of each frame of data sent is as follows: Status signals are defined in 16-bit word form, and the meaning of each bit is shown in Table 2. 4.2.2 Servo Data Transmission Method: When the CNC system requests a servo status signal but there is no position response frame at that time, the servo sends a status signal; when the servo experiences an alarm, the servo sends a status signal; the status signal is sent in the position response frame after the CNC position broadcast. When the servo receives the (position/speed) increment from the CNC, it immediately replies with the actual (position/speed) increment from the encoder of the previous cycle. 5. Experimental Results [IMG=Table 3 Communication Data Experimental Results]/uploadpic/THESIS/2007/11/20071114162903449935.jpg[/IMG] Table 3 Communication Data Experimental Results 5.1 Reliability Experiment of CAN Bus Communication between CNC System and Digital AC Servo Artificial interference sources, including electromagnetic coupling clamps, were used in the experiment. The CAN bus data communication was tested in a machine tool workshop under strong interference industrial environment. The CNC sent 8 bytes of data to three servos respectively. After receiving the data, the servos immediately returned the received data. After verifying the data was correct, the CNC continued to send data until a data communication error occurred or the number of communication attempts was reached. The communication line length was 30m. The coupling clamp test parameters adopted IEC61000-4-4 standard level 3, with a peak interference pulse voltage of 1kV, a repetition frequency of 5kHz, and the PROFIBUS-DP baud rate set to 9Mbps. Multiple long-term tests were conducted. The following is the communication data experiment of one of the experiments. The test data is shown in Table 3. Test Results: The test time was 969 seconds, with 3,108,472 data transmissions. The calculated time for one data exchange between the CNC and servos was 0.3117 ms. Considering timing errors and the waiting time between the CNC and each servo, the time for one communication between the CNC and the three servos was 0.9351 ms, meeting the system requirements. The experimental results show that using the CAN bus for data communication between the machine tool CNC system and the servo system offers long transmission distances, strong anti-interference capabilities, and a simple interface. 5.2 System Machining Experiment: On a CJK6140H machine tool in Baoji, an embedded CNC system with a CAN bus structure and a CAN bus servo driver was used. The CNC system's GO speed was 6 m/min, and the acceleration/deceleration time constant was 40 (i.e., 160 ms). After continuously running the same machining program for over 80 hours, the pulse position error of the DA98 was 0 after returning to zero. On a Shenyang CNC CK6136H machine tool, an embedded CNC system with a CAN bus structure and a CAN bus servo driver was used. The GO speed of the CNC system was 6 m/min, and the acceleration/deceleration time constant was 40 (i.e., 160 ms). A cylinder with internal threads and a plug with external threads were machined. After water was placed inside the cylinder, the plug was screwed on; it could be screwed to the end of the thread without leakage. 6. Conclusion This paper studies a design method for an embedded CNC system based on a CAN bus structure using a DSP (TMS320F2812), solving the problem of the impact of command information errors between the CNC system and the servo on the performance of the CNC system. A CAN bus-based data structure was designed between the CNC system and the servo. Data communication and system control experiments, as well as system machining experiments, were conducted under strong interference conditions. The experimental results verified the feasibility of the proposed design method for an embedded CNC system based on a CAN bus structure using a DSP (TMS320F2812). This DSP (TMS320F2812)-based CAN bus embedded machine tool CNC system features high integration, flexible structure, and good scalability. It avoids the D/A and A/D conversion errors that occur when real-time command data from a closed-loop machine tool CNC system is transmitted to the servo system, simplifying the interface design between the machine tool CNC system and the servo system. Furthermore, the CAN bus structure allows for remote control of the machine tool CNC system and the servo system over distances of up to several hundred meters, offering strong anti-interference capabilities, ease of networking, and convenient application in large and ultra-large equipment and production lines. (Proceedings of the 2nd and 3rd Servo and Motion Control Forums)