An asynchronous serial communication controller IP core with time synchronization function

By introducing time synchronization input module and serial logic control module into the asynchronous serial communication controller IP core, the problem of poor time synchronization in asynchronous serial communication is solved, and high-precision multi-source data synchronization and the integrity of big data transmission is achieved. Avoid frame drop.

CN117520259BActive Publication Date: 2024-11-08湖北汇领众科电子技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311520278.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-14
Publication Date
2024-11-08
Estimated Expiration
2043-11-14

AI Technical Summary

Technical Problem

The existing asynchronous serial communication controller IP core lacks time synchronization function, resulting in poor time synchronization during data acquisition of multi-source sensors, which cannot effectively solve the time synchronization problem under multiple interrupt triggering conditions, and is often used in high-frequency and large-data transmission. Frame drop occurs.

Method used

An asynchronous serial communication controller IP core that does not rely on CPU interrupts is designed, using register module, AXI Lite bus control module, time synchronization input module and serial logic control module. Through direct frequency synthesis method and FIFO storage space optimization, time is realized Stamp generation and data synchronization.

Benefits of technology

It improves the time synchronization accuracy to nanosecond level, supports time synchronization of multi-source asynchronous data acquisition, reduces time delay during data transmission, and reduces loss in big data transmission, improving the integrity of data decoding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117520259B_ABST
    Figure CN117520259B_ABST
Patent Text Reader

Abstract

The present invention proposes an asynchronous serial communication controller IP core with a time synchronization function, comprising a plurality of register modules; an AXI Lite bus control module, which is used for the IP core to communicate with the AXI Lite bus of a host; an AXI Lite bus address decoding module, which is used for decomposing the bus address space of the host into a plurality of accessible address blocks, and the plurality of accessible address blocks are set in a one-to-one correspondence with a plurality of register modules; a time synchronization input module, which is used for inputting synchronous time of the same source; and a plurality of serial port logic control modules, which are connected to the plurality of register modules in a one-to-one correspondence communication, and are used for enabling the asynchronous serial communication function, or cooperating with the time synchronization input module to obtain a timestamp of the received synchronous time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of flight control data acquisition equipment, and in particular to an asynchronous serial communication controller IP core with a time synchronization function. Background Art

[0002] Unmanned aerial vehicles have the characteristics of short preparation time, high flight speed, low cost, and adaptability to all-weather mission operations. They are increasingly used in defense, surveying and mapping, industrial control, agriculture and other fields. Strict time synchronization must be ensured between the flight control computer and flight control sensors of unmanned aerial vehicles, and between the flight control system and the ground control station. The higher the time accuracy and the better the time homology between multi-source sensors, the more conducive it is to flight control solution and ground control.

[0003] Asynchronous serial ports are widely used in the field of flight control sensors due to their low cost, ease of use, and strong anti-interference. Traditionally, asynchronous serial port communication methods implemented through single-chip microcomputers or general-purpose CPUs often use interrupt processing methods, and use CPU timers to timestamp communication data for time synchronization. Compared with the query method, it can effectively improve real-time performance, but it still cannot solve the time synchronization under the conditions of multiple interrupt triggers, and it cannot solve the time delay and software operation in the signal transmission process itself, and the time synchronization accuracy is poor. FPGA manufacturers' development tools generally provide asynchronous serial port communication controller IP cores developed based on UART16550, but this IP core does not have the time synchronization function and still needs to rely on traditional interrupt methods for time synchronization. The time synchronization accuracy is not high, and the method of adding timestamps to interrupt processing data cannot solve the parallel synchronous acquisition of multi-source sensor data and the homology of synchronization time. Moreover, the asynchronous serial port communication controller IP core developed based on UART16550 often suffers from frame loss for data transmission of high-frequency and large-volume sensors.

[0004] In summary, providing an asynchronous serial communication controller IP core with time synchronization function can avoid realizing time synchronization through CPU interruption and offset the time delay in data transmission. This is very necessary for improving the time synchronization of multi-source asynchronous data acquisition interfaces and improving data synchronization accuracy. Summary of the invention

[0005] In view of this, the present invention proposes an asynchronous serial communication controller IP core with a time synchronization function, which does not use a CPU interrupt synchronization mode and has a smaller multi-serial port data transmission time delay.

[0006] The technical solution of the present invention is implemented as follows: The present invention provides an asynchronous serial communication controller IP core with a time synchronization function, comprising:

[0007] Several register modules;

[0008] AXI Lite bus control module, used for the IP core to communicate with the host's AXI Lite bus;

[0009] AXI Lite bus address decoding module, used to decompose the host bus address space into several accessible address blocks, and the several accessible address blocks are set in one-to-one correspondence with several register modules;

[0010] Time synchronization input module, used to input the synchronization time of the same source;

[0011] A plurality of serial port logic control modules are connected to a plurality of register modules in a one-to-one correspondence communication, and are used to enable the asynchronous serial port communication function, or cooperate with the time synchronization input module to obtain the timestamp of the received synchronization time.

[0012] On the basis of the above technical solution, preferably, the plurality of register modules include a global register and a plurality of sub-serial port private registers; the global register is used to reset a plurality of serial port logic control modules in the IP core, test the result of the global register accessing the host, and store the IP core version information or the IP core manufacturer information; the plurality of sub-serial port private registers respectively store the control status, data transmission and reception content, frame header configuration and synchronization time of the plurality of serial port logic control modules.

[0013] Preferably, the global register includes a global software reset subregister, an IP core read and write test subregister, an IP core version information subregister and an IP core developer code subregister which are sequentially arranged in the reserved address space; the global software reset subregister is used to store the code for resetting several serial port logic control modules in the IP core; the IP core read and write test subregister is used to test the code corresponding to the global register access result after the IP core is connected to the host; the IP core version information subregister is used to store the code corresponding to the IP core version information; the IP core developer code subregister is used to store the code corresponding to the IP core manufacturer information.

[0014] Further preferably, the plurality of sub-serial port private registers include a serial port control sub-register, a serial port receiving baud rate control sub-register, a serial port sending baud rate control sub-register, a serial port receiving data sub-register, a serial port sending data sub-register, a serial port interrupt control sub-register, a serial port status sub-register, a serial port receiving frame header configuration sub-register, a serial port receiving time tag low-bit sub-register and a serial port receiving time tag high-bit sub-register, which are sequentially arranged in the reserved address space; wherein the serial port control sub-register is used to store the start bit, data bit, stop bit, check mode and data frame header identification enable and time synchronization enable of the corresponding serial port logic control module for sending and receiving data; the serial port receiving baud rate control sub-register is used to store the baud rate used by the corresponding serial port logic control module for receiving data; the serial port sending baud rate control sub-register is used to store the baud rate used by the corresponding serial port logic control module for sending data; the serial port receiving data sub-register is used to store the data received by the corresponding serial port logic control module, and transmit the data to the host through the AXI Lite bus to read data; the serial port send data subregister writes the data written by the host to the sub-serial port private register into the corresponding serial port logic control module; the serial port interrupt control subregister is used to control the interrupt enable and shield of the current serial port logic control module; the serial port status subregister is used to record the working status of the current serial port logic control module.

[0015] More preferably, the plurality of serial port logic control modules are respectively provided with a receiving FIFO and a sending FIFO;

[0016] The serial port receiving data sub-register is used to store the data received by the receiving FIFO of the corresponding serial port logic control module, and read the data through the AXI Lite bus of the host;

[0017] The serial port send data sub-register writes the data written by the host into the private register of the sub-serial port into the send FIFO of the corresponding serial port logic control module;

[0018] The interrupt enable and mask configured by the serial port interrupt control subregister include the receive FIFO empty interrupt, receive FIFO depth trigger interrupt, receive FIFO full interrupt, transmit FIFO empty interrupt, transmit FIFO full interrupt, idle interrupt and frame header identification interrupt of the corresponding serial port logic control module;

[0019] The serial port status sub-register is used to record the working status of the current serial port logic control module, namely, the receive FIFO empty interrupt status, the receive FIFO depth trigger interrupt status, the receive FIFO full interrupt status, the transmit FIFO empty interrupt status, the transmit FIFO full interrupt status, the idle interrupt status, and the frame header recognition interrupt status. The serial port status sub-register also records the number of data in the receive FIFO and the number of data in the transmit FIFO;

[0020] The serial port receive frame header configuration subregister is used to configure the frame header that needs to be automatically recognized by the IP core, and combines the idle interrupts of the receive FIFO and the transmit FIFO to complete the recording of the synchronization time. The serial port receive frame header configuration subregister also generates a frame header recognition interrupt according to the configuration of the serial port interrupt control subregister;

[0021] When the current serial port logic control module is in the frame header identification interrupt working state, the serial port receiving time tag low-order sub-register and the serial port receiving time tag high-order sub-register respectively record 50% of the low-order data and 50% of the high-order data in the synchronization time;

[0022] In addition to the default storage space, the receiving FIFO and the transmitting FIFO are also configured with a variable storage space.

[0023] Further preferably, the variable storage space of the receiving FIFO or the transmitting FIFO needs to meet the following conditions: A) the data frame received by the receiving FIFO or the data frame sent by the transmitting FIFO is a data frame of indefinite length, and there are no other data frames to be received in the receiving FIFO before receiving the indefinite length data frame, or there are no other data frames to be sent in the transmitting FIFO before sending the indefinite length data frame; B) the receiving FIFO full interrupt has been triggered, the indefinite length data frame has not received timeout, and the remaining default storage space of the receiving FIFO of the current serial port logic control module is less than 50% for more than X consecutive sampling cycles; or the transmitting FIFO full interrupt has been triggered, and the host writes the indefinite length data frame into the current The state of the sending FIFO of the serial port logic control module has not changed, and the remaining default storage space of the sending FIFO is less than 50% for more than three consecutive sampling cycles; C) The variable storage space is at least twice the default storage space; D) The survival time of the variable storage space is that the default storage space and the variable storage space of the receiving FIFO of the current serial port logic control module are all read and no new content of the current variable-length data frame input from the external input is received for 2X consecutive sampling cycles, or the default storage space and the variable storage space of the sending FIFO of the current serial port logic control module are all read and no new content of the current variable-length data frame sent by the host is received for 2X consecutive sampling cycles, then the variable storage space is removed.

[0024] Further preferably, the several register modules reserve address space for several serial port logic control modules respectively, and the reserved address space is divided into a global register address block and several sub-serial port private register address blocks; the global register address block corresponds to each sub-register of the global register; the several sub-serial port private register address blocks are set corresponding to each sub-register of each sub-serial port private register; the base address of the global register address block and the base addresses of the several sub-serial port private register address blocks are both determined by offsetting relative to the base address of the AXI Lite bus of the host.

[0025] More preferably, the plurality of serial port logic control modules adopt a direct frequency synthesis method to obtain a frequency control word and write the frequency control word into a serial port receiving baud rate control subregister or a serial port transmitting baud rate control subregister; the input frequency f of the direct frequency synthesis method is i , output frequency f o The relationship between and the frequency control word K is as follows: Due to the oversampling technology, the frequency control word K and the input frequency f i The relationship is rewritten as Where p is the oversampling multiple; Baud is the baud rate; according to the required baud rate and sampling multiple, the obtained frequency control word K and baud rate are written into the serial port receiving baud rate control subregister and the serial port sending baud rate control subregister respectively.

[0026] On the basis of the above technical solution, preferably, the time synchronization input module receives external synchronous time with the same source by configuring an external time input interface; or configures a local clock in the IP core, and generates internal synchronous time with the same source by the local clock.

[0027] On the basis of the above technical solution, preferably, when time synchronization is required, the frame header intelligent identification submodule of the serial port logic control module is used to identify the source of the data frame, the type of the data frame or whether it is consistent with the configured frame header structure. If the transmission frame header of the data frame is consistent with the configured frame header, the IP core records the synchronization time of the current frame internally and stores it in the serial port receive time tag low subregister and the serial port receive time tag high subregister.

[0028] The asynchronous serial communication controller IP core with time synchronization function provided by the present invention has the following beneficial effects compared with the prior art:

[0029] (1) Compared with the traditional method of processing data and adding timestamps through CPU interrupts and application software, this application uses the logic inside the IP core to send and receive timestamps for synchronization time, which can effectively improve the time synchronization accuracy to nanoseconds, which is much higher than the milliseconds of the traditional time synchronization accuracy;

[0030] (2) The IP core of the present invention has a configurable number of serial port logic control modules, and is equipped with a homologous time input interface and has a homologous time synchronization function;

[0031] (3) The receiving FIFO and sending FIFO of each serial port logic control module of this solution are equipped with default storage space and variable storage space, which can meet the needs of large data transmission in the case of a terminal again, read the complete data and decode it, improve the integrity of the decoding, and reduce the problem of data loss under large data volume. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0033] Figure 1 This is a framework diagram of an asynchronous serial communication controller IP core with a time synchronization function of the present invention;

[0034] Figure 2 A structural schematic diagram of a register module of an asynchronous serial communication controller IP core with a time synchronization function according to the present invention;

[0035] Figure 3 A structural schematic diagram of a serial port logic control module of an asynchronous serial port communication controller IP core with a time synchronization function according to the present invention;

[0036] Figure 4 The present invention is a schematic diagram of the workflow of an asynchronous serial communication controller IP core with time synchronization function receiving data and time synchronization. DETAILED DESCRIPTION

[0037] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] like Figure 1 , Figure 2 and Figure 3As shown, the present invention provides an asynchronous serial communication controller IP core with time synchronization function, including several serial port logic control modules, several register modules, AXI Lite bus control modules, AXI Lite bus address decoding modules and time synchronization input modules. Among them:

[0039] Several serial port logic control modules are used to realize independent asynchronous communication or time synchronization functions through serial ports, such as realizing serial port data transmission and reception with a flight control sensor of an unmanned aerial vehicle. The number of serial port logic control modules can be set according to actual use. Figure 3 As shown in the figure, there are n different serial port logic control modules, n ≥ 1. Figure 3 As shown, different serial port logic control modules are distinguished by symbols UART1, UART2, ..., UARTn, and the internal structure of each serial port logic control module is the same.

[0040] A plurality of register modules are respectively connected to a plurality of serial port logic control modules in a one-to-one correspondence communication; the register modules enable or set corresponding functions of each serial port logic control module.

[0041] AXI Lite bus control module is used for the IP core to communicate with the AXI Lite bus of the host; in this application, the interface corresponding to the AXI Lite bus of the IP core is the Slave interface, and the interface corresponding to the AXI Lite bus of the host is the Master interface. The AXI Lite bus complies with the AMBA 4.0 bus protocol, specifically including a write address channel, a write data channel, a write response channel, a read address channel, and a read data channel. Each channel uses an independent handshake mechanism, including a Valid-Ready handshake signal. In this handshake signal mechanism, the data source sets the Valid flag signal after the data is ready, and the data receiving end sets the Ready flag signal when it is ready to receive data. When the Valid flag signal and the Ready flag signal are set at the same time on the clock edge, the data transmission is completed. This handshake mechanism can ensure the correctness of data transmission.

[0042] The AXI Lite bus address decoding module is used to decompose the host's bus address space into several accessible address blocks, and the several accessible address blocks are set in one-to-one correspondence with several register modules. The AXI Lite bus interface is a data interaction mechanism based on address mapping. The AXI Lite bus address decoding module decodes the AXI Lite bus address, that is, allocates several accessible address blocks to the address space corresponding to the AXI Lite bus interface. These accessible address blocks are respectively allocated to several register modules.

[0043] The time synchronization input module is connected to the serial port logic control modules for inputting synchronization time to the serial port logic control modules. The synchronization time can come from outside the IP core or from the IP core itself. For example, the time synchronization input module receives external synchronization time with the same source by configuring the external time input interface; or configures the local clock in the IP core, and generates internal synchronization time with the same source by the local clock.

[0044] In this application, the serial port logic control module is connected to several register modules for enabling asynchronous serial port communication functions, or cooperates with the time synchronization input module to obtain the timestamp of the synchronization time received by several serial port logic control modules. The clock synchronization process of each serial port logic control module in this solution is completed at the IP core, without relying on the traditional time-consuming CPU interrupt method, and the delay time and time synchronization accuracy error of time synchronization are smaller.

[0045] When time synchronization is required, the serial port logic control module obtains synchronization time from the time synchronization input module and encapsulates it in the frame header of the time synchronization data frame. The serial port logic control module also outputs the timestamp corresponding to the moment of receiving the time synchronization data frame.

[0046] like Figure 1 Combination Figure 2 As shown, several register modules include a global register and several sub-serial port private registers; the global register is used to reset several serial port logic control modules in the IP core, test the result of the global register accessing the host, and store the IP core version information or the IP core manufacturer information; the several sub-serial port private registers respectively store the control status, data transmission and reception content, frame header configuration and synchronization time of several serial port logic control modules.

[0047] Specifically, the global register Global_Reg includes a global software reset subregister IP_Resetn_Reg, an IP core read and write test subregister IP_Test_Reg, an IP core version information subregister IP_Version_Reg and an IP core developer code subregister IP_Vendor_Reg, which are sequentially arranged in the reserved address space; the global software reset subregister IP_Resetn_Reg is used to store the code for resetting several serial port logic control modules in the IP core; the IP core read and write test subregister IP_Test_Reg is used to test the code corresponding to the access result of the global register Global_Reg after the IP core is connected to the host, that is, whether the connection between the IP core and the host is reliable; the IP core version information subregister IP_Version_Reg is used to store the code corresponding to the IP core version information; the IP core developer code subregister IP_Vendor_Reg is used to store the code corresponding to the IP core manufacturer information.

[0048] This solution corresponds to the setting of n sub-serial port private registers. Different sub-serial port private registers are distinguished by UART1_Reg, UART2_Reg, ..., UARTn_Reg. The internal structure of each sub-serial port private register is the same.

[0049] like Figure 2 As shown, several register modules reserve address spaces for several serial port logic control modules respectively, and the reserved address space is divided into a global register address block and several sub-serial port private register address blocks; the global register address block corresponds to each sub-register of the global register; several sub-serial port private register address blocks are set corresponding to each sub-register of each sub-serial port private register; the base address of the global register address block and the base addresses of the several sub-serial port private register address blocks are offset and determined relative to the base address of the AXI Lite bus of the host. The example given in the figure is that when the AXILite bus is accessed, the address alignment needs to be ensured. Specifically, the offset address of the global register relative to the base address of the host's AXI Lite bus is 0X00; the base address of the first sub-serial port private register address block relative to the base address of the host's AXILite bus is 0X100; the base address of the second sub-serial port private register address block relative to the base address of the host's AXI Lite bus is 0X200; and so on, the base address of the nth sub-serial port private register address block relative to the base address of the host's AXI Lite bus is 0X100*n. This address offset method can be used for fast addressing. The address in any sub-serial port private register address block can also be addressed using the following formula: IP_BASE_ADDR+UARTX_BASE+REG_OFFSET, where IP_BASE_ADDR is the base address of the global register address block; UARTX_BASE represents the base address of the corresponding sub-serial port private register; REG_OFFSET represents the offset of the address in the current sub-serial port private register address block relative to the base address. As a preferred implementation, the interval between the base addresses of each adjacent sub-serial port private register address block can also be set arbitrarily, and does not have to be an integer multiple of 0X100.

[0050] like Figure 1 Combination Figure 2 and Figure 3As shown, several serial port logic control modules are respectively provided with receiving FIFO and transmitting FIFO, as well as a transmitting module for realizing the transmitting logic function and a receiving module for the receiving logic function; each sub-serial port controller independently sets a receiving FIFO and a transmitting FIFO with a depth of 1024 bytes, which is used to solve the problem that the FIFO depth of the traditional serial port controller is small and cannot realize the transmission and reception of large data volume and high frequency data, and solve the problem of data loss in high frequency data transmission and reception. In addition, each serial port logic control module is also provided with a control module Ctrl, a baud rate generation module Baud_Gen, a working status module Stauts, an interrupt control module Int_Ctrl and a frame header intelligent recognition module. The baud rate generation module Baud_Gen is used to obtain the frequency control word and store the frequency control word and the baud rate Baud. The working status module Stauts and the interrupt control module Int_Ctrl are used to read / write the corresponding state parameters or interrupt modes to the corresponding sub-serial port private registers. The frame header intelligent identification module is used to identify the source of the data frame, the type of the data frame, or whether it is consistent with the configured frame header structure. If the data transmission frame header is consistent with the configured frame header, the IP core will record and store the synchronization time of the current frame. At the same time, if the frame header identification interrupt enable is configured, a frame header identification interrupt will be generated.

[0051] Combination Figure 2 and Figure 3 As shown, several sub-serial port private registers include a serial port control sub-register UART_Ctrl_Reg, a serial port receive baud rate control sub-register UART_RxBaud_Reg, a serial port transmit baud rate control sub-register UART_TxBaud_Reg, a serial port receive data sub-register UART_RxData_Reg, a serial port transmit data sub-register UART_TxData_Reg, a serial port interrupt control sub-register UART_IntCtrl_Reg, a serial port status sub-register UART_Status_Reg, a serial port receive frame header configuration sub-register UART_Head_Reg, a serial port receive time label low sub-register UART_SyncTimeL_Reg and a serial port receive time label high sub-register UART_SyncTimeH_Reg, which are sequentially set in the reserved address space.

[0052] The serial port control subregister is used to store the start bit, data bit, stop bit, check mode, data frame header recognition enable and time synchronization enable of the corresponding serial port logic control module for sending and receiving data.

[0053] The serial port receiving baud rate control subregister is used to store the baud rate used by the corresponding serial port logic control module to receive data;

[0054] The serial port transmission baud rate control subregister is used to store the baud rate used by the corresponding serial port logic control module to send data;

[0055] The serial port receive data sub-register is used to store the data received by the receive FIFO of the corresponding serial port logic control module, and read the data through the AXI Lite bus of the host;

[0056] The serial port send data sub-register writes the data written by the host into the private register of the sub-serial port into the send FIFO of the corresponding serial port logic control module;

[0057] The serial port interrupt control subregister is used to control the interrupt enable and mask of the current serial port logic control module; specifically, the interrupt enable and mask configured by the serial port interrupt control subregister include the corresponding serial port logic control module's receive FIFO empty interrupt, receive FIFO depth trigger interrupt, receive FIFO full interrupt, transmit FIFO empty interrupt, transmit FIFO full interrupt, idle interrupt and frame header recognition interrupt.

[0058] The serial port status subregister is used to record the working status of the current serial port logic control module, namely, the receive FIFO empty interrupt status, the receive FIFO depth trigger interrupt status, the receive FIFO full interrupt status, the transmit FIFO empty interrupt status, the transmit FIFO full interrupt status, the idle interrupt status, and the frame header recognition interrupt status. The serial port status subregister also records the number of data in the receive FIFO and the number of data in the transmit FIFO.

[0059] The serial port receive frame header configuration subregister is used to configure the frame header that needs to be automatically recognized by the IP core, and combines the idle interrupts of the receive FIFO and the transmit FIFO to complete the recording of the synchronization time. The serial port receive frame header configuration subregister also generates a frame header recognition interrupt according to the configuration of the serial port interrupt control subregister; it can be seen that the serial port receive frame header configuration subregister is used in correspondence with the frame header intelligent recognition module of the serial port logic control module.

[0060] When the current serial port logic control module is in the frame header identification interrupt working state, the low-order sub-register of the serial port receiving time tag and the high-order sub-register of the serial port receiving time tag respectively record 50% of the low-order data and 50% of the high-order data in the synchronization time. If the synchronization time contains 64 bits of data, the low-order sub-register of the serial port receiving time tag stores the low 32 bits of the synchronization time, and the high-order sub-register of the serial port receiving time tag stores the low and high bits of the synchronization time.

[0061] like Figure 3 As shown, several serial port logic control modules use direct frequency synthesis method to obtain frequency control word and write it into serial port receiving baud rate control subregister or serial port sending baud rate control subregister; the input frequency f of the direct frequency synthesis methodi , output frequency f o The relationship between and the frequency control word K is as follows: Due to the oversampling technology, the frequency control word K and the input frequency f i The relationship is rewritten as Where p is the oversampling multiple; Baud is the baud rate; according to the required baud rate and sampling multiple, the frequency control word K and baud rate are written into the serial port receiving baud rate control subregister and the serial port sending baud rate control subregister respectively. Usually, the oversampling multiple can be selected as 16 or 32, which are integer exponents with a base of 2.

[0062] The instantiation modules of the baud rate generation module Baud_Gen of the serial port logic control module are TX_Badu_Gen and RX_Badu_Gen. In order to realize data transmission and reception at any baud rate, the baud rate generation module Baud_Gen adopts direct frequency synthesis technology to realize the fractional frequency output of any frequency. Compared with the direct frequency division method, the direct frequency synthesis technology can control the output baud rate more accurately, reduce the dependence on the accuracy of the input clock frequency, and can output the baud rate of any frequency.

[0063] Usually, the data generated by the sensor periodically is a data frame of fixed length. If in some occasions where the amount of data is relatively large, in order to avoid data loss caused by congestion, the variable storage space of the receiving FIFO or the transmitting FIFO can be activated accordingly. However, the variable storage space of the receiving FIFO or the transmitting FIFO needs to meet the following conditions at the same time: A) The data frame received by the receiving FIFO or the data frame sent by the transmitting FIFO is a data frame of indefinite length, and there are no other data frames to be received in the receiving FIFO before receiving the indefinite length data frame, or there are no other data frames to be sent in the transmitting FIFO before sending the indefinite length data frame; B) The receiving FIFO full interrupt has been triggered, the indefinite length data frame has not received timeout, and the remaining default storage space of the receiving FIFO of the current serial port logic control module is less than 50% for more than X consecutive sampling cycles; or the transmitting FIFO full interrupt has been triggered, and the host writes the indefinite length data frame into the current serial port logic through the private register of the sub-serial port The state of the control module's transmit FIFO has not changed, and the remaining default storage space of the transmit FIFO is less than 50% for more than three consecutive sampling cycles; C) the variable storage space is at least twice the default storage space; D) the survival time of the variable storage space is that the default storage space and the variable storage space of the receive FIFO of the current serial port logic control module are all read and no new content of the current indefinite-length data frame input from the external input is received for 2X consecutive sampling cycles, or the default storage space and the variable storage space of the transmit FIFO of the current serial port logic control module are all read and no new content of the current indefinite-length data frame sent by the host is received for 2X consecutive sampling cycles, then the variable storage space is removed.

[0064] In the above content, the default storage space of the receiving FIFO and the transmitting FIFO, the variable storage space and the continuous 2X sampling cycles determine the overall time consumption for processing the variable-length data frame. In order to improve the timeliness of data transmission, usually X sampling cycles are determined based on 2-3 times the sampling clock cycle used for the average processing of the fixed-length data frame. The present application adopts variable-length receiving FIFO and transmitting FIFO storage space, which can adaptively receive or send complete variable-length data frames during an interruption process, and can buffer a large amount of sudden data, thereby improving the problem of data loss that may exist in the IP core under high frequency and large data volume.

[0065] Figure 4 Two different work processes of data reception and time synchronization of the present invention are demonstrated. Figure 4 The serial port in the serial port logic control module is the UART serial interface implemented by software. The data receiving process is as follows Figure 4As shown in the left block diagram, after the serial port is initialized, data is received, and after serial-to-parallel conversion and byte reception completion verification, it is stored in the receive FIFO for buffering until the entire data reception process is completed.

[0066] When time synchronization is required, the frame header intelligent identification submodule of the serial port logic control module is used to identify the source of the data frame, the type of the data frame, or whether it is consistent with the configured frame header structure. If the data transmission frame header is consistent with the configured frame header, the IP core records the synchronization time of the current frame internally to form a timestamp and outputs it. The synchronization time is stored in the serial port receive time tag low subregister and the serial port receive time tag high subregister. At the same time, if the frame header identification interrupt enable is configured, a frame header identification interrupt is generated.

[0067] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. An asynchronous serial communication controller IP core with time synchronization function, characterized in that: include: Several register modules; AXI Lite bus control module, used for the IP core to communicate with the host's AXI Lite bus; AXI Lite bus address decoding module, used to decompose the host bus address space into several accessible address blocks, and the several accessible address blocks are set in one-to-one correspondence with several register modules; Time synchronization input module, used to input the synchronization time of the same source; Several serial port logic control modules are connected to several register modules in a one-to-one correspondence, and are used to enable the asynchronous serial port communication function, or cooperate with the time synchronization input module to obtain the timestamp of the received synchronization time; The plurality of register modules include a global register and a plurality of sub-serial port private registers; the global register is used to reset a plurality of serial port logic control modules in the IP core, test the result of the global register accessing the host, and store the IP core version information or the IP core manufacturer information; the plurality of sub-serial port private registers respectively store the control status, data transmission and reception content, frame header configuration and synchronization time of the plurality of serial port logic control modules; The global register includes a global software reset subregister, an IP core read / write test subregister, an IP core version information subregister, and an IP core developer code subregister that are sequentially arranged in a reserved address space; the global software reset subregister is used to store codes for resetting several serial port logic control modules in the IP core; the IP core read / write test subregister is used to test the codes corresponding to the global register access results after the IP core is connected to the host; the IP core version information subregister is used to store the codes corresponding to the IP core version information; the IP core developer code subregister is used to store the codes corresponding to the IP core manufacturer information; The several sub-serial port private registers include a serial port control sub-register, a serial port receiving baud rate control sub-register, a serial port sending baud rate control sub-register, a serial port receiving data sub-register, a serial port sending data sub-register, a serial port interrupt control sub-register, a serial port status sub-register, a serial port receiving frame header configuration sub-register, a serial port receiving synchronization time label low sub-register and a serial port receiving synchronization time label high sub-register, which are sequentially set in the reserved address space; wherein the serial port control sub-register is used to store the start bit, data bit, stop bit, check mode and data frame header identification enable and time synchronization enable of the corresponding serial port logic control module for sending and receiving data; the serial port receiving baud rate control sub-register is used to store the baud rate used by the corresponding serial port logic control module to receive data; the serial port sending baud rate control sub-register is used to store the baud rate used by the corresponding serial port logic control module to send data; the serial port receiving data sub-register is used to store the data received by the corresponding serial port logic control module, and transmit the data to the AXI of the host. Lite bus to read data; the serial port send data subregister writes the data written by the host into the sub-serial port private register into the corresponding serial port logic control module; the serial port interrupt control subregister is used to control the interrupt enable and shield of the current serial port logic control module; the serial port status subregister is used to record the working status of the current serial port logic control module; The plurality of serial port logic control modules are respectively provided with a receiving FIFO and a transmitting FIFO; The serial port receiving data sub-register is used to store the data received by the receiving FIFO of the corresponding serial port logic control module, and read the data through the AXI Lite bus of the host; The serial port send data sub-register writes the data written by the host into the private register of the sub-serial port into the send FIFO of the corresponding serial port logic control module; The interrupt enable and mask configured by the serial port interrupt control subregister include the receive FIFO empty interrupt, receive FIFO depth trigger interrupt, receive FIFO full interrupt, transmit FIFO empty interrupt, transmit FIFO full interrupt, idle interrupt and frame header identification interrupt of the corresponding serial port logic control module; The serial port status sub-register is used to record the working status of the current serial port logic control module, namely, the receive FIFO empty interrupt status, the receive FIFO depth trigger interrupt status, the receive FIFO full interrupt status, the transmit FIFO empty interrupt status, the transmit FIFO full interrupt status, the idle interrupt status, and the frame header recognition interrupt status. The serial port status sub-register also records the number of data in the receive FIFO and the number of data in the transmit FIFO; The serial port receive frame header configuration subregister is used to configure the frame header that needs to be automatically recognized by the IP core, and combines the idle interrupts of the receive FIFO and the transmit FIFO to complete the recording of the synchronization time. The serial port receive frame header configuration subregister also generates a frame header recognition interrupt according to the configuration of the serial port interrupt control subregister; The serial port receiving synchronization time tag low-order sub-register and the serial port receiving synchronization time tag high-order sub-register respectively record 50% of the low-order data and 50% of the high-order data in the input synchronization time when the current serial port logic control module is in the frame header identification interrupt working state; In addition to the default storage space, the receiving FIFO and the transmitting FIFO are also configured with a variable storage space.

2. The asynchronous serial communication controller IP core with time synchronization function according to claim 1, characterized in that: The variable storage space of the receiving FIFO or the transmitting FIFO needs to meet the following conditions: A) the data frame received by the receiving FIFO or the data frame sent by the transmitting FIFO is a variable-length data frame, and there are no other data frames to be received in the receiving FIFO before receiving the variable-length data frame, or there are no other data frames to be sent in the transmitting FIFO before sending the variable-length data frame; B) The receive FIFO full interrupt has been triggered, the indefinite-length data frame has not received timeout, and the remaining default storage space of the receive FIFO of the current serial port logic control module is less than 50% for more than X consecutive sampling cycles; or the transmit FIFO full interrupt has been triggered, the host writes the indefinite-length data frame into the transmit FIFO of the current serial port logic control module through the slave serial port private register without changing the state, and the remaining default storage space of the transmit FIFO is less than 50% for more than three consecutive sampling cycles; C) The variable storage space is at least twice the default storage space; D) The survival time of the variable storage space is when all the contents of the default storage space and the variable storage space of the receiving FIFO of the current serial port logic control module are read and no new content sent by the current indefinite-length data frame of external input is received within 2X consecutive sampling cycles, or when all the contents of the default storage space and the variable storage space of the sending FIFO of the current serial port logic control module are read and no new content sent by the host for the current indefinite-length data frame is received within 2X consecutive sampling cycles, then the variable storage space is removed.

3. The asynchronous serial communication controller IP core with time synchronization function according to claim 1, characterized in that: The several register modules respectively reserve address space for several serial port logic control modules, and the reserved address space is divided into a global register address block and several sub-serial port private register address blocks; the global register address block corresponds to each sub-register of the global register; the several sub-serial port private register address blocks are set corresponding to each sub-register of each sub-serial port private register; the base address of the global register address block and the base addresses of the several sub-serial port private register address blocks are offset and determined relative to the base address of the AXI Lite bus of the host.

4. The asynchronous serial communication controller IP core with time synchronization function according to claim 1, characterized in that: The plurality of serial port logic control modules adopt a direct frequency synthesis method to obtain a frequency control word and write the word into a serial port receiving baud rate control subregister or a serial port sending baud rate control subregister; the input frequency f of the direct frequency synthesis method i , output frequency f o The relationship between and the frequency control word K is as follows: Due to the oversampling technology, the frequency control word K and the input frequency f i The relationship is rewritten as Where p is the oversampling multiple; Baud is the baud rate; According to the required baud rate and sampling multiple, the obtained frequency control word K and baud rate are written into the serial port receiving baud rate control subregister and the serial port sending baud rate control subregister respectively.

5. The asynchronous serial communication controller IP core with time synchronization function according to claim 1, characterized in that: The time synchronization input module receives external synchronous time with the same source by configuring an external time input interface; or configures a local clock in the IP core, and generates internal synchronous time with the same source by the local clock.

6. The asynchronous serial communication controller IP core with time synchronization function according to claim 1, characterized in that: When time synchronization is required, the frame header intelligent identification submodule of the serial port logic control module is used to identify the source of the data frame, the type of the data frame, or whether it is consistent with the configured frame header structure. If the transmission frame header of the data frame is consistent with the configured frame header, the IP core records the synchronization time of the current frame internally and stores it in the serial port receive time tag low subregister and the serial port receive time tag high subregister.