Application and Implementation of Optical Fiber Communication in CNC Networks
2026-04-06 07:28:43··#1
Abstract: CNC network systems represent a trend in CNC system development. In these systems, the primary requirements for communication between nodes are high real-time performance and high reliability. Their most prominent characteristics are relatively small communication data volume and periodicity. This paper details how to design a module at the physical layer using VHDL to meet these requirements, enabling point-to-point communication via optical fiber. Keywords: Optical fiber communication, CNC network, CNC, FPGA 1 Introduction: CNC technology is a strategic foundational technology for the modernization of the manufacturing industry, and also an important strategic foundational technology for improving national comprehensive strength and defense modernization. With the development of digital drive technology and various manufacturing technologies, improving the flexibility, scalability, portability, interoperability, interchangeability, and reusability of CNC systems has become an urgent need. Therefore, advanced industrial countries worldwide have included the development of open CNC system architectures in their key development plans. To adapt to this development trend and further improve factory automation, CNC network systems will inevitably become the commanding height of future CNC technology competition. Solving the problem of high real-time and high-reliability data transmission in such networks is a core issue in the construction of CNC networks. This paper will focus on how to use optical fiber to achieve high-speed and high-reliability point-to-point transmission based on the characteristics of this network. 2 Characteristics of Network CNC: Currently, the protocols used in CNC network systems include SERCOS (Serial Real-time Communication System) and HSB (High Speech Serial Bus). [align=center] Figure 1: SERCOS Network Topology[/align] The controller of the SERCOS interface can be connected to one or more ring structures as needed. The topology diagram in Figure 1 is just an example. As can be seen from its topology, it combines master-slave structure and ring structure. The topology of HSB is relatively simpler than that of SERCOS. It is mainly a master-slave structure. Due to the characteristics of CNC systems, it has high requirements for data communication between underlying devices, and must ensure high real-time performance and high reliability. For example, the connection between the CNC (Computer Numeric Controller) main unit and interpolation axis units, drive units, etc., requires short control cycles in the millisecond range and high communication reliability. Communication errors can lead to serious consequences, such as scrapping machined parts. To ensure these requirements are met in the harsh environment of a factory, fiber optics must be used as the communication medium for the CNC network. The typical communication cycle between these high real-time, high-reliability underlying devices is between 1 and 5 milliseconds, and the typical effective communication data volume is between 500 and 2000 bits. These characteristics determine that CNC controller communication has short cycles and short data frames. Therefore, when designing point-to-point communication modules on an FPGA using VHDL at the physical layer, these basic requirements must be considered. Whether constructing a SERCOS or HSB network, the effective bit rate for point-to-point communication should be no less than 4 Mbps to expand to more nodes. Although the effective bit rate required for networking is greater than 4 Mbps, due to the overhead of the protocol itself and the communication redundancy necessary to ensure high reliability, the actual communication bit rate in such networks is much greater than the effective bit rate. Its communication efficiency is conservatively estimated to be only 15% to 30%. 3. Implementation of Fiber Optic Communication in CNC Networks Whether it is a SERCOS or HSB structure CNC network system, after the slave station obtains bus control through arbitration, the communication between the master station and the slave station is point-to-point communication. Therefore, based on the characteristics of the data transmitted in the CNC system, realizing point-to-point high real-time and high-reliability fiber optic communication is a fundamental step. This step is implemented at the physical layer. The peripheral interface model of point-to-point communication at the physical layer is as follows: [align=center] Figure 2: Peripheral Interface Model[/align] This module is implemented in FPGA using VHDL language. Its function is to encode the data frames packaged at the data link layer and transmit them to the bus through fiber optics, and to receive serial data from the bus, decode it, and hand it over to the data link layer. Almost all the main work of the physical layer is implemented by this module. The specific tasks of this module include: interface with the data link layer, interface with the fiber optic transceiver, data encoding and decoding, parallel-to-serial conversion of data, data oversampling or data clock recovery, data word alignment, etc. 1) Interface with the link layer: Outport[15..0]: The 16-bit data to be sent to the bus, with the lower 8 bits being the address of the higher 8 bits. inport[15..0]: The 16-bit data received from the bus, with the lower 8 bits being the address of the higher 8 bits. senddata: The data sending signal. When a transition occurs, the data in outport will be CRC-encoded and 4b/5b-encoded before being serially sent from data_out. Ack_y: A transition occurs when a handshake signal indicating that the other party has correctly received the data is received. Ack_n: A transition occurs when a handshake signal indicating that the other party has not correctly received the data is received. Receive_ok: A transition occurs when data is received from the other party and the CRC check is correct. At the same time, the data is output from the inport port, and a handshake signal frame indicating that the data has been received correctly is sent to the other party. When the received data fails the CRC check, receive_ok remains unchanged, the data is not output, and only a handshake signal frame indicating that the data has been received incorrectly is sent to the other party. 2) Fiber Optic Interface: data_in: Transmitted serial data. data_out: Received serial data. 3) Data Encoding/Decoding: When transmitting data, it is first encoded using 4b/5b, then CRC encoded; when receiving data, the process is reversed: first CRC decoded, then 4b/5b decoded. This module uses the European standard CRC-16 cyclic code generator polynomial. 4) Parallel-to-Serial Data Conversion: The 16-bit data in the output port is encoded and output serially; the serial data received from the fiber optic bus is decoded and output in parallel in the input port. 5) Data Oversampling or Data Clock Recovery: In asynchronous communication mode, sampling is required to determine the 0 and 1 of the data transmitted on the medium to generate the receiving data. Due to the lack of phase information from the transmitter in asynchronous mode, it is difficult to guarantee that the sampling point is located in the middle of the data, i.e., the middle of the communication "eye diagram," where the data has sufficient hold time and is the optimal decision point. Therefore, oversampling is used at the receiving end. Data is sampled 5 times within each bit's data period, and sampling begins when the data changes from 0 to 1. The middle sample result is taken as the result of that sampling. The format of the transmitted data frame is as follows: The types of transmitted frames are: data frames and handshake frames (correctly received handshake frames and incorrectly received handshake frames). Therefore, their mutual exclusion and priority issues must be properly addressed in this module. This is implemented using a state machine mechanism: a flag bit is assigned to each data frame, correctly received handshake frame, and incorrectly received handshake frame: sign_data, sign_ack_y, and sign_ack_n, respectively. When a data frame is to be transmitted, sign_data is set to 1. When a data frame is sent, `sign_data` is reset to 0, and the same applies to the handshake frame. The module's states are: `idle`, `SendingAck_y`, `SendingAck_n`, and `SendingData`. Their state transition relationships are as follows: [align=center] Figure 3: State Machine Transition Diagram[/align] As can be seen from the transition diagram, when both handshake frames and data frames need to be sent simultaneously, the handshake frame is sent first. This is because the handshake frame is much shorter than the data frame, so sending it first improves overall transmission efficiency. The data link layer operates on this module as follows: it sends the data frame to be sent to the `outport` port, and then gives `senddata` a transition edge; this signal is the start signal for sending. If the `ack_y` handshake signal is received, the next data frame is sent. If the `ack_n` handshake signal is received, it indicates a transmission failure, and the frame is retransmitted. If no handshake signal is received within a reasonable time, it is defined as a timeout, and the frame is also retransmitted. If the retransmission fails after three attempts, the system is notified of the communication failure via an interrupt. This ensures accurate and reliable data transmission in the CNC system. There will be no serious consequences, such as workpiece scrapping, due to the failure of a single frame of data transmission. 4. Simulation The simulation used a sampling clock of 100MHz (the actual sampling clock can be even higher after synthesis with Quartus II). The results show that the period from the senddata transition latching the output data and starting data transmission to receiving the handshake signal is 1.15µs. In these sixteen bits of data, the lower eight bits are the address, and the higher eight bits are the valid data, so the effective bit rate is 6.95MHz, which fully meets the requirements of CNC networks. Although this is a simulation result, the effect is the same when running in an actual CNC system. The debugging of this fiber optic communication module in the actual system has been completed. 5. Conclusion In today's increasingly automated factories, CNC network systems constructed with fiber optics will greatly enhance the core competitiveness of Chinese enterprises and provide technical and quality assurance for Chinese enterprises to fully participate in international competition. References [1] M. Week and Jochen Wolf. STEP-NC-The STEP compliant NC Programming Interface: Evaluation and Improvement of the modern Interface [Z]. IMS Forum. Ascona/Switzerland, October/2001. [2] Zou Zeming et al. Research on the integration of network numerical control system and enterprise information system [J]. Machine Tool & Hydraulics, 2003, (5). [3] Chen Weifu, Yang Jianwu. Open numerical control system and SERCOS interface application technology. Machinery Industry Press. [4] Dong Xiaoyi, Wang Yanyao. Principles and development of new generation optical fiber communication and synchronous network [M]. Tianjin: Tianjin Science and Technology Press. [5] Zhou Kai. Research on numerical control system architecture [J]. China Mechanical Engineering, 2002, 13 (5). [6] Huang Zhiwei, Wang Yan. FPGA system design and practice. Electronic Industry Press. [7] Liu Xiaojun et al. Design of full-duplex asynchronous receiver and transmitter circuit based on VHDL language. Microcomputer Information. 2005. Vol.21 No.1 P.156-157