HDLC serial communication controller based on zynq
By using Zynq processor in the HDLC serial communication controller, the system master control and Ethernet communication are integrated into the ARM side, and the HDLC protocol control function is ported to the FPGA side, which solves the problem of high power consumption, large resource occupancy and low transmission rate in traditional designs. The problem of this achieves a more efficient and stable single-chip design.
Patent Information
- Application Number
- CN202410992715.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-11-19
AI Technical Summary
The existing HDLC communication controller architecture has poor stability, and the traditional dual-chip design results in high power consumption, large resource utilization and low transmission rate, which is susceptible to interference.
Using the Zynq-based HDLC serial communication controller, the Zynq-7000 processor integrates the system master control and Ethernet communication tasks into the ARM side, and the HDLC bus protocol control function is ported to the FPGA side, and data exchange is performed through the AXI high-speed bus to realize Single chip design.
It improves transmission rate and stability, saves board area, reduces development costs, and meets the needs of complex system-on-chip design.
Smart Images

Figure CN118981440A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer bus communication, and in particular relates to a HDLC serial port communication controller based on zynq. Background Art
[0002] HDLC is a high-level data link control protocol, which is widely used in data frame synchronization and error detection in data communications. It is a data link layer protocol used to provide reliable data transmission between the physical layer and the network layer. HDLC defines the format, transmission rules and error detection mechanism of the data frame, ensuring the reliability and integrity of the data.
[0003] The HDLC protocol uses a specific bit sequence to identify the start and end of a data frame to achieve frame synchronization. This synchronization mechanism ensures that the receiver can correctly parse the data frame. In order to ensure the integrity of the data, the HDLC protocol uses a CRC (cyclic redundancy check) algorithm for error detection. The background technology of the HDLC communication protocol makes it a reliable and efficient data transmission protocol, which is widely used in various fields, including communication networks, data storage, and aerospace.
[0004] The complete functions of traditional HDLC communication usually consist of two parts, one is the system main control and Ethernet communication functions located on the main controller chip, and the other is the HDLC protocol transceiver control function located on the microcontroller or CPLD chip. The two chips use the SPI bus communication method to complete data transmission. This design method requires the use of two chips, which occupies a large resource area and has high power consumption. At the same time, this chip external communication method usually has a low transmission rate and is susceptible to interference. Summary of the invention
[0005] 1. Technical issues to be resolved
[0006] In order to solve the problems that the existing HDLC communication controller architecture has poor stability and the traditional "dual-chip" design method usually has high power consumption and occupies a large resource area, an HDLC serial port communication controller is provided.
[0007] (II) Technical solution
[0008] In order to solve the above technical problems, the present invention provides a Zynq-based HDLC serial communication controller, wherein the HDLC serial communication controller uses a Zynq-7000 processor, including an FPGA processor part as an FPGA end and a dual-core ARM cortex-A9 processor part as an ARM end, wherein the ARM end is responsible for overall process control, data processing and Ethernet communication; the FPGA end is responsible for data format conversion and HDLC bus protocol control, and data is exchanged between the two ends through an AXI high-speed bus, and the interface type is a GP interface.
[0009] Preferably, the HDLC serial port communication controller includes a system main control module, an Ethernet control module and an HDLC protocol transceiver module; the system main control module and the Ethernet control module are located at the ARM end, and the HDLC protocol transceiver module is located at the FPGA end;
[0010] The HDLC protocol transceiver module is divided into two parts: data upload and data sending. The data upload process is to receive external data to the HDLC protocol transceiver module on the FPGA side through the HDLC synchronous serial port, and then the HDLC protocol transceiver module extracts valid data from the HDLC frame data, including a "remove 0" operation and a CRC check operation. The extracted content includes an address field, a control field and valid data. The valid data is written to the address specified by the ARM side through the AXI bus, and the system main control module on the ARM side extracts and processes it. The data sending process is that the ARM side sends data to the FPGA side through the AXI bus, and then the HDLC protocol transceiver module extracts information from the received valid data, including the address field, the control field and the valid data. The HDLC protocol transceiver module performs framing according to the HDLC protocol, encapsulates the address field, the control field and the valid data into the HDLC data frame and checks it, and also adds the checked CRC value to the HDLC data frame, and performs "0 interpolation" processing at the same time. After the HDLC frame data is encapsulated, it is sent out through the HDLC synchronous serial port of the corresponding channel.
[0011] The system main control module is used to control the overall operation process of the controller and some peripheral circuit interface drivers;
[0012] The Ethernet control module is located at the ARM end of the zynq device, and enables Ethernet 0 by configuring and opening the MIO16 to MIO27 interfaces in Block Design; the Ethernet control module enables the network protocol stack LWIP in the BSP to provide a network transmission API interface function that can be called.
[0013] Preferably, the Ethernet transmission protocol between the Ethernet control module and the outside is UDP transmission mode, and the transmission rate is 1000M.
[0014] Preferably, the network IP address of the Ethernet control module is set to 192.168.43.20, the network mask is set to 255.255.255.0, and the external network is set to be in the same network segment as the Ethernet control module; before receiving and sending data, the Ethernet control module first creates a new UDP PCB for communication, and then binds the PCB to the local address.
[0015] Preferably, when external network data is input, the Ethernet control module caches the received valid data in the receiving buffer recv_buf; then, the data is adjusted and byte-joined, converted into 32-bit data, and sent to the FPGA end through the AXI bus; when data needs to be sent to the external network, first the FPGA end sends the data to the ARM end through the AXI bus; then, the Ethernet control module caches the valid data in the sending buffer send_buf; the 32-bit data is byte-split, converted into big and small ends, and then sent to the outside byte by byte through Ethernet.
[0016] Preferably, the HDLC protocol transceiver module has a function of realizing HDLC synchronous serial port transceiver;
[0017] For the data receiving process, the work completed by the HDLC protocol transceiver module includes: receiving data from the synchronous serial port bit by bit, sampling the data line according to the rising edge of the clock line, and inputting each bit into the shift register in turn, determining whether the value in the shift register is "7e" to determine the packet header, and after determining the packet header, taking out the address field, control field, and valid data in turn, and performing CRC judgment in the receiving process to ensure the accuracy of the data, wherein the valid data is saved in the receiving buffer FIFO according to the byte, and the number of bytes received is counted by the counter;
[0018] For the data transmission process, the work completed by the HDLC protocol transceiver module includes: receiving the valid data to be sent from the transmission buffer FIFO according to the number of bytes to be sent, converting the data into serial data in sequence, and putting it on the synchronous serial port data line, and sending it out in conjunction with the clock; the data sent to the synchronous serial port data line includes: the "7e" of the packet header and the packet tail, the address field and the control field are provided by the host computer of the controller, the valid data comes from the transmission buffer FIFO, the CRC check value is calculated in the process of sending the valid data bit by bit, and the final calculation result is added after the valid data and before the packet tail. For the data line and the clock line, the rising edge of the clock is aligned with the center of the data bit.
[0019] The invention also provides a method for realizing the reception and transmission of the HDLC synchronous serial port by using the controller.
[0020] Preferably, the method comprises the following steps:
[0021] (1) For the sending process, the host computer of the controller writes the data to be sent in the form of a message to the Ethernet control module on the ARM side through Ethernet. When the system main control module detects that new data has arrived, it goes to the designated buffer area to read the received message, and extracts, verifies and processes the valid data in the message; after obtaining the valid data, the system main control module sends the valid data to the HDLC protocol transceiver module on the FPGA side through the AXI bus. The sending part of the HDLC protocol transceiver module performs packet processing on the valid data, adds a frame header, a frame footer and a check value, and performs "0 interpolation" processing, and finally sends it out through the synchronous serial port;
[0022] (2) For the receiving process, the HDLC data input by the controller's host computer through the synchronous serial port first enters the HDLC protocol transceiver module, and the receiving part of the HDLC protocol transceiver module unpacks, removes zeros and verifies the received data; after extracting valid data, the HDLC protocol transceiver module on the FPGA side sends the valid data to the system main control module on the ARM side through the AXI bus, and the system main control module processes and assembles the valid data through Ethernet, and sends it to the Ethernet control module and then sends it to the outside through Ethernet.
[0023] The invention also provides an application of the controller in the technical field of computer bus communication.
[0024] The invention also provides an application of the method in the technical field of computer bus communication.
[0025] (III) Beneficial effects
[0026] In order to optimize the traditional HDLC communication controller architecture, the present invention provides a zynq-based HDLC serial communication controller, including a system main control module, an Ethernet control module and an HDLC protocol transceiver module. The controller as a whole is composed of two parts. The ARM side is responsible for overall process control, data processing and Ethernet communication; the FPGA side is responsible for data format conversion, HDLC bus protocol control, etc. Data is exchanged between the two ends through the AXI high-speed bus, meeting the requirements of ultra-high performance and complex system-on-chip (SoC) design.
[0027] Compared with the prior art, the present invention adopts a new zynq architecture, integrates system master control tasks and network communication functions into the ARM side, thereby replacing the traditional method of using a separate processor chip; transplants HDLC bus transceiver control functions into the FPGA side, thereby replacing the traditional control method of using a single-chip microcomputer; the two parts communicate through the on-chip AXI high-speed bus, which greatly improves the transmission rate and stability compared to the traditional external SPI communication method. At the same time, this single-chip design method better saves board area and reduces development costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a schematic diagram of the main structural modules of the HDLC serial communication controller based on zynq of the present invention;
[0029] Figure 2 It is a structural diagram of the HDLC protocol transceiver module in the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.
[0031] To solve the problems of the prior art, the present invention provides a HDLC serial communication controller based on zynq, such as Figure 1 As shown, the HDLC serial communication controller includes a system main control module, an Ethernet control module and an HDLC protocol transceiver module.
[0032] The HDLC serial communication controller uses the Zynq-7000 processor, including the FPGA processor part as the FPGA end and the dual-core ARM cortex-A9 processor part as the ARM end, where the ARM end is responsible for overall process control, data processing and Ethernet communication; the FPGA end is responsible for data format conversion, HDLC bus protocol control, etc. The two ends exchange data through the AXI high-speed bus, and the interface type is a GP interface. The system main control module and Ethernet control module are located on the ARM end, and the HDLC protocol transceiver module is located on the FPGA end;
[0033] The HDLC protocol transceiver module is divided into two parts: data upload and data sending. The data upload process is summarized as receiving external data to the FPGA end through the HDLC synchronous serial port, and the HDLC protocol transceiver module extracts valid data from the HDLC frame data, including the "remove 0" operation and CRC check operation, and the extracted content includes the address field, control field and valid data; the valid data will be written to the address specified by the ARM end through the AXI bus, and the system main control module on the ARM end will extract and process it; the data sending process is summarized as the ARM end sends data to the FPGA end through the AXI bus, and the HDLC protocol transceiver module extracts information from the received valid data, including the address field, control field and valid data; the HDLC protocol transceiver module performs framing according to the HDLC protocol, encapsulates the address field, control field and valid data into the HDLC data frame and checks it, and also adds the checked CRC value to the HDLC data frame, and performs "0 interpolation" processing at the same time; after the HDLC frame data is encapsulated, it is sent out through the HDLC synchronous serial port of the corresponding channel.
[0034] The system master control module is the control core of the entire controller, which is used to control the overall operation process of the controller and some peripheral circuit interface drivers. The receiving and sending process of the HDLC synchronous serial port is summarized as follows:
[0035] (1) For the sending process, the controller external device or the controller host computer writes the data to be sent in the form of a message to the Ethernet control module on the ARM side through Ethernet. When the system main control module detects that new data has arrived, it goes to the designated buffer area to read the received message, and extracts, verifies and processes the valid data in the message; after obtaining the valid data, the system main control module sends the valid data to the HDLC protocol transceiver module on the FPGA side through the AXI bus. The sending part of the HDLC protocol transceiver module performs packet processing on the valid data, adds a frame header, a frame footer and a check value, and performs "0 interpolation" processing, and finally sends it out through the synchronous serial port.
[0036] (2) For the receiving process, the HDLC data input by the external device through the synchronous serial port first enters the HDLC protocol transceiver module, and the receiving part of the HDLC protocol transceiver module unpacks, removes zeros and verifies the received data; after extracting the valid data, the FPGA end sends the valid data to the ARM end through the AXI bus, and the system main control module processes the data and assembles the data through Ethernet, and sends it to the Ethernet control module and then sends it to the outside through Ethernet.
[0037] The Ethernet control module is located at the ARM end of the zynq device, and Ethernet 0 is enabled by configuring and opening the MIO16 to MIO27 interfaces in Block Design. The Ethernet control module enables the network protocol stack LWIP in the BSP (Board Support Package) to provide a network transmission API interface function that can be called. The Ethernet transmission protocol between the Ethernet control module and the outside uses UDP transmission mode, and the transmission rate is 1000M.
[0038] Furthermore, the network IP address of the Ethernet control module is set to 192.168.43.20, the network mask is set to 255.255.255.0, and the external network is set to be in the same network segment as the Ethernet control module. Before receiving and sending data, the Ethernet control module first creates a new UDP PCB (Protocol Control Block) for communication, and then binds the PCB to the local address.
[0039] Furthermore, when external network data is input, the Ethernet control module caches the received valid data in the receiving buffer recv_buf. Then, the data is adjusted and byte-joined, converted into 32-bit wide data, and sent to the FPGA end through the AXI bus; when data needs to be sent to the external network, the FPGA end first sends the data to the ARM end through the AXI bus; then, the Ethernet control module caches the valid data in the sending buffer send_buf; the 32-bit wide data is byte-split, converted into big and small ends, and sent to the outside byte by byte through Ethernet.
[0040] The HDLC protocol transceiver module has the function of realizing HDLC synchronous serial port transceiver. The module structure is as follows: Figure 2 shown.
[0041] Furthermore, for the data receiving process, the work completed by the HDLC protocol transceiver module includes: receiving data from the synchronous serial port bit by bit, sampling the data line according to the rising edge of the clock line, and inputting each bit into the shift register in turn, determining the packet header by judging whether the value in the shift register is "7e", and after judging the packet header, taking out the address field, control field, and valid data in turn, and performing CRC judgment during the receiving process to ensure the accuracy of the data, wherein the valid data is saved in the receive buffer FIFO according to bytes, and the number of bytes received is counted by a counter.
[0042] Furthermore, for the data transmission process, the work completed by the HDLC protocol transceiver module includes: receiving valid data to be sent from the transmission buffer FIFO according to the number of bytes to be sent, converting the data into serial data in sequence, and putting it on the synchronous serial port data line, and sending it out in conjunction with the clock. The data sent to the synchronous serial port data line includes: "7e" of the packet header and the packet tail, the address field and the control field are provided by the host computer of the controller, the valid data comes from the transmission buffer FIFO, the CRC check value is calculated in the process of sending valid data bit by bit, and the final calculation result is added after the valid data and before the packet tail. For the data line and the clock line, the rising edge of the clock is aligned with the center of the data bit.
[0043] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A HDLC serial communication controller based on zynq, characterized in that: The HDLC serial communication controller uses a Zynq-7000 processor, including an FPGA processor part as the FPGA end and a dual-core ARM cortex-A9 processor part as the ARM end, wherein the ARM end is responsible for overall process control, data processing and Ethernet communication; the FPGA end is responsible for data format conversion and HDLC bus protocol control, and data is exchanged between the two ends through an AXI high-speed bus, and the interface type is a GP interface.
2. The controller according to claim 1, characterized in that The HDLC serial communication controller includes a system main control module, an Ethernet control module and an HDLC protocol transceiver module; the system main control module and the Ethernet control module are located at the ARM end, and the HDLC protocol transceiver module is located at the FPGA end; The HDLC protocol transceiver module is divided into two parts: data upload and data download. The data upload process is to receive external data through the HDLC synchronous serial port to the HDLC protocol transceiver module on the FPGA side, and then the HDLC protocol transceiver module extracts valid data from the HDLC frame data, including a "remove 0" operation and a CRC check operation. The extracted content includes an address field, a control field and valid data. The valid data is written to the specified address on the ARM side through the AXI bus, and is to be extracted and processed by the system main control module on the ARM side. The data sending process is that the ARM end sends data to the FPGA end through the AXI bus, and then the HDLC protocol transceiver module extracts information from the received valid data, including the address field, the control field and the valid data. The HDLC protocol transceiver module performs framing according to the HDLC protocol, encapsulates the address field, the control field and the valid data into the HDLC data frame and verifies it, and also adds the verified CRC value to the HDLC data frame, and performs "0 interpolation" processing at the same time; after the HDLC frame data is encapsulated, it is sent out through the HDLC synchronous serial port of the corresponding channel; The system main control module is used to control the overall operation process of the controller and some peripheral circuit interface drivers; The Ethernet control module is located at the ARM end of the zynq device, and enables Ethernet 0 by configuring and opening the MIO16 to MIO27 interfaces in Block Design; the Ethernet control module enables the network protocol stack LWIP in the BSP to provide a network transmission API interface function that can be called.
3. The controller according to claim 2, characterized in that The Ethernet transmission protocol between the Ethernet control module and the outside is UDP transmission mode, and the transmission rate is 1000M.
4. The controller according to claim 2, characterized in that The network IP address of the Ethernet control module is set to 192.168.43.20, the network mask is set to 255.255.255.0, and the external network is set to be in the same network segment as the Ethernet control module; before receiving and sending data, the Ethernet control module first creates a new UDP PCB for communication, and then binds the PCB to the local address.
5. The controller according to claim 2, characterized in that When external network data is input, the Ethernet control module caches the received valid data into the receiving buffer recv_buf; then, the data is adjusted and byte-joined, converted into 32-bit data, and sent to the FPGA end through the AXI bus; when data needs to be sent to the external network, the FPGA end first sends the data to the ARM end through the AXI bus; then, the Ethernet control module caches the valid data into the sending buffer send_buf; the 32-bit data is byte-split, converted into big and small ends, and then sent to the outside byte by byte through Ethernet.
6. The controller according to claim 2, characterized in that The HDLC protocol transceiver module has the function of realizing HDLC synchronous serial port transceiver; For the data receiving process, the work completed by the HDLC protocol transceiver module includes: receiving data from the synchronous serial port bit by bit, sampling the data line according to the rising edge of the clock line, and inputting each bit into the shift register in turn, determining whether the value in the shift register is "7e" to determine the packet header, and after determining the packet header, taking out the address field, control field, and valid data in turn, and performing CRC judgment in the receiving process to ensure the accuracy of the data, wherein the valid data is saved in the receiving buffer FIFO according to the byte, and the number of bytes received is counted by the counter; For the data transmission process, the work completed by the HDLC protocol transceiver module includes: receiving the valid data to be sent from the transmission buffer FIFO according to the number of bytes to be sent, converting the data into serial data in sequence, and putting it on the synchronous serial port data line, and sending it out in conjunction with the clock; the data sent to the synchronous serial port data line includes: the "7e" of the packet header and the packet tail, the address field and the control field are provided by the host computer of the controller, the valid data comes from the transmission buffer FIFO, the CRC check value is calculated in the process of sending the valid data bit by bit, and the final calculation result is added after the valid data and before the packet tail. For the data line and the clock line, the rising edge of the clock is aligned with the center of the data bit.
7. A method for implementing reception and transmission of a HDLC synchronous serial port using the controller as claimed in any one of claims 2 to 6.
8. The method according to claim 7, characterized in that The method comprises the following steps: (1) For the sending process, the host computer of the controller writes the data to be sent in the form of a message to the Ethernet control module on the ARM side through Ethernet. When the system main control module detects that new data has arrived, it goes to the designated buffer area to read the received message, and extracts, verifies and processes the valid data in the message. After obtaining the valid data, the system main control module sends the valid data to the HDLC protocol transceiver module on the FPGA side through the AXI bus. The sending part of the HDLC protocol transceiver module performs packet processing on the valid data, adds a frame header, a frame footer and a check value, and performs "0 interpolation" processing, and finally sends it out through the synchronous serial port; (2) For the receiving process, the HDLC data input by the controller's host computer through the synchronous serial port first enters the HDLC protocol transceiver module. The receiving part of the HDLC protocol transceiver module unpacks, removes zeros and verifies the received data. After extracting valid data, the HDLC protocol transceiver module on the FPGA side sends the valid data to the system main control module on the ARM side through the AXI bus. The system main control module processes the valid data and assembles it into Ethernet packets, sends it to the Ethernet control module, and then sends it to the outside through Ethernet.
9. Application of the controller according to any one of claims 1 to 6 in the field of computer bus communication technology.
10. An application of the method according to claim 7 or 8 in the field of computer bus communication technology.
Citation Information
Cited By
Configurable multi-mode HDLC protocol controller and data transmission method
CN122870342A
