Data interaction method between embedded module and FPGA
Through the data interaction method between embedded module and FPGA, the interactive RAM of the CAN FD bus and the data identifier of the sending RAM check the old and new data, which solves the problem of frequent device node errors in the aerospace field, and improves the reliability of the bus and bandwidth avoid unpredictable errors.
Patent Information
- Application Number
- CN202410306897.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-03-18
AI Technical Summary
In the aerospace field, the CAN FD bus has frequent equipment node errors, resulting in insufficient reliability, and the traditional CAN bus bandwidth and speed cannot meet the increased demand.
Design a data interaction method between an embedded module and an FPGA, communicate through the CAN FD bus, use the interactive RAM and the data identifier of the sending RAM to check the old and new data, avoid the conflict between the FPGA reading data when the embedded software is written, and ensure the data Transmission reliability.
It improves the network communication bandwidth of the CAN bus, eliminates unpredictable errors, enhances the reliability of the bus, and ensures the integrity and consistency of data transmission.
Smart Images

Figure CN118093467B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of bus communication used for automobile, aerospace communication and the like, and in particular to a data interaction method between an embedded module and an FPGA. Background Art
[0002] The CAN bus uses a two-wire serial communication protocol. Based on non-destructive arbitration technology, distributed real-time control, and reliable error handling and detection mechanisms, the CAN bus has high reliability. Due to its high reliability, it is increasingly used in the aerospace field. With the increase in interactive bandwidth and the increase in reliability requirements, the Control Area Network (CAN) is increasingly unable to cope with it. The bandwidth occupied by the traditional CAN bus during interaction is much higher than the recommended value (50%), and only 40% to 50% of the bandwidth in the CAN bus data frame is used for data transmission; the CAN bus communication rate is limited to 1Mbit / s, but in actual use, the communication rate is 500Kbit / s. All of the above problems have put forward higher requirements on the bandwidth and reliability of the CAN bus, and CAN with Flexible Data rate (CAN FD) came into being.
[0003] CAN FD inherits the main characteristics of the CAN bus and also has excellent reliability and anti-electromagnetic interference characteristics. At the same time, the CAN FD bus makes up for the limitations of the CAN bus bandwidth and data length. It is compatible with CAN, but its rate has been greatly improved compared to CAN. However, its reliability still needs to be improved. For example, in the aerospace field, device node errors often occur. How to improve the reliability of the CAN FD bus is an urgent problem to be solved in the aerospace field. Summary of the invention
[0004] In view of the problems and shortcomings of the CAN bus in the automotive and aerospace fields, the present invention provides a data interaction method between an embedded module and an FPGA to prevent unpredictable errors from occurring when communicating via CAN FD.
[0005] The present invention provides a data interaction method between an embedded module and an FPGA. The data interaction method is based on CAN FD for communication, wherein the embedded module writes data into an interactive RAM of the logic of the FPGA, the bottom layer logic detects the first address data of the interactive RAM, checks whether it is new data, and if it is new data, reads the data out of the interactive RAM and writes the data into a sending RAM of the CAN FD, and after the writing is completed, updates the data of the first address of the interactive RAM to represent it as old data; the embedded module queries the address to determine whether the data has been read by the FPGA, and if it has been read by the FPGA, the embedded module can write a new data frame of the CAN FD into the interactive RAM, and the CAN FD IP core of the FPGA reads the data of the sending RAM to complete the data sending.
[0006] In some possible implementation methods, after the FPGA writes the data into the CAN FD transmit RAM, it pulls the ready flag high to indicate that data is available for transmission. The CAN FD controller module reads the data in the transmit RAM to complete the transmission of the CAN FD data frame.
[0007] In some possible implementation methods, for CAN FD receive interaction, after the CAN FD IP core receives data, it writes the data into the receive fifo for the embedded software to read.
[0008] The beneficial effect of the present invention is that: the present invention provides a data interaction method between an embedded module and an FPGA, replaces the original CAN bus technology, improves the network communication bandwidth of the CAN bus, and eliminates the conflicts encountered in the data interaction process between the embedded module and the FPGA. The situation that the FPGA is reading data while the embedded software is being written will not occur, resulting in unpredictable errors in the CAN FD. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 This is a structural diagram of the intelligent CAN FD bus communication system of the present invention.
[0010] Figure 2 This is a structural diagram of the intelligent CAN FD bus communication module of the present invention.
[0011] Figure 3 This is a correct schematic diagram of the intelligent CAN FD sampling of the present invention.
[0012] Figure 4 Schematic diagram of intelligent CAN FD sampling error of the present invention.
[0013] Figure 5 This is a schematic diagram of the intelligent CAN FD automatic measurement sampling of the present invention.
[0014] Figure 6 This is a schematic diagram of manually setting sampling for the intelligent CAN FD of the present invention.
[0015] Figure 7 This is a schematic diagram of the interaction between the intelligent CAN FD embedded module and FPGA of the present invention.
[0016] Figure 8 The invention shows a state machine jump diagram of the interaction between the intelligent CAN FD embedded module and FPGA. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. The specific operation method in the method embodiment can also be applied to the device embodiment or the system embodiment. In the description of the present invention, unless otherwise specified, the meaning of "multiple" is two or more.
[0018] refer to Figure 1 The structure diagram of the intelligent CAN FD bus communication system is shown in FIG. 1 , wherein each of the devices Device1, Device2, and Device3 has at least one channel A and at least one channel B for sending and receiving data. Figure 1 In the example, channel A of Device1 is connected to channel A of Device2 and Device3, and channel B of Device1 is connected to channel B of Device2 and Device3 to send and receive data. When a channel is abnormal, the underlying logic resets the abnormal channel, and after the reset is completed, a channel switching frame is sent. After the sending is completed, it can switch to another channel to continue working. This design method improves the reliability of bus communication.
[0019] refer to Figure 2 The intelligent CAN FD bus communication module composition structure diagram is shown in FIG. The intelligent CAN FD bus communication module at least includes: at least one CAN FD bus monitoring module (CAN FD monitor), at least one CAN FD controller module (CAN FD controller), at least one CAN FD switching module (channel switching) and at least one embedded interactive module (interactive module). In addition, the intelligent CAN FD bus communication module may also include other well-known modules required to complete general CAN bus communication, such as a CAN FD driver chip, which are not specifically limited here.
[0020] The CAN FD bus monitoring module mainly detects abnormalities on the bus path. The basic principle of its detection is: CAN FD sends data and also receives the data through the CAN FD driver chip. Figure 3 As shown, compare the sent data with the received data. If they are consistent, the bus is considered correct. Figure 4 As shown in the figure, if the sent data is compared with the received data and it is found that they are inconsistent, the bus is considered abnormal. At the same time, the received data is sampled, and the sampling delay time can be manually set or the sampling time can be automatically measured. Figure 5 As shown in the figure, by using the automatic measurement method, the delay of multi-node and long-distance CAN FD interaction nodes can be measured, and the delay caused by the newly added CAN FD nodes can also be measured to ensure the accuracy of sampling. Figure 6 As shown, if manual measurement is used, an accurate estimate of the delay time is required. At the same time, if a new node is added to the system, the delay time will also increase. If the sampling point remains unchanged, it may cause sampling errors in the received data.
[0021] The CAN FD controller module mainly completes the self-test of the CAN FD bus, CAN FD module configuration, timestamp transmission, data frame transmission and data frame reception. During the timestamp transmission process, the peer device node does not need to respond. The CAN FD module requires embedded software to configure the arbitration domain rate, data domain rate, CAN FD mode, number of retransmissions, etc. CAN FD only uses data frames for communication, and data frame arbitration uses an extended format. The extended format data frame message format is as follows:
[0022] Table 1 CAN FD extended frame format
[0023] .
[0024] The data segment of CAN FD supports up to 64 bytes of data length. The data length is determined by DLC, and the data length of the data area corresponds to the value of DLC. The data byte lengths sent by CAN FD are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32, 48, 64.
[0025] After the intelligent CAN FD controller module is powered on, it first performs a power-on self-test to confirm the bus status. After the power-on self-test is completed, after receiving the bus scheduling start command, it can broadcast the timestamp message on the channel A and channel B buses with a period of 20ms for time synchronization of the entire system. All buses receive the timestamp message, but do not need to reply. The format of the timestamp message data segment is as follows:
[0026] Table 2 CAN FD timestamp message format
[0027] .
[0028] The CAN FD switching module mainly completes the switching between channel buses. The CAN FD bus monitoring module will report the monitored bus status to the CAN FD switching module. The bus status includes: bus off, bus busy, BIT error, sampling error, etc. When the CAN FD switching module detects an abnormality in the channel bus, it first resets the abnormal channel. After the reset is completed, the CAN FD switching module detects its status. If the status is normal, it sends 3 channel switching frames. The opposite node does not need to reply to the response frame to notify the opposite node of the bus switch. After the sending is completed, the bus is switched. The CAN FD channel switching data frame format is as follows:
[0029] Table 3 CAN FD channel switching data frame format
[0030] .
[0031] The embedded interactive module mainly completes the data interaction between embedded modules, such as embedded ARM, CPU, DSP, etc. and FPGA. The present invention designs a method for data interaction between embedded modules and FPGA, such as Figure 7 The specific workflow of embedded data sent via the CAN FD bus is as follows:
[0032] 1) The embedded software reads the first address of the interactive RAM on the FPGA side and determines whether it is FF. If it is FF, it is determined to be new data, indicating that the FPGA has not finished reading the data in the interactive RAM; if it is 00, it is determined to be old data, indicating that the FPGA has finished reading the data in the interactive RAM;
[0033] 2) FPGA reads the first address of the interactive RAM at intervals. If the data read is FF, it is considered to be new data. Then FPGA reads the data in the interactive RAM and writes it into the CAN FD transmission RAM. After the data in the interactive RAM is read, 00 needs to be written to the first address of the RAM to indicate that the data has been read. If the data read is 00, it is considered to be old data. There is no need to read the data in the interactive RAM or write the data into the transmission RAM.
[0034] 3) After the FPGA writes the data into the CAN FD transmit RAM, it pulls the ready flag high, indicating that data is available for transmission. The CAN FD controller module reads the data in the transmit RAM and completes the transmission of the CAN FD data frame.
[0035] 4) The CAN FD receiving interaction part is relatively simple. After the CAN FD IP core receives the data, it writes the data into the receiving fifo for the embedded software to read.
[0036] By using the interaction method of the present invention, conflicts encountered during the interaction process can be eliminated, and the situation where the FPGA is reading data while the embedded software is writing will not occur, resulting in unpredictable errors in CAN FD. The CAN FD interaction RAM address data format is as follows:
[0037] Table 4 CAN FD interactive RAM address data format table
[0038] .
[0039] The interaction between embedded software and FPGA is mainly the reading of data in the interactive RAM. Figure 8 Design of FPGA state machine for interaction between embedded software and FPGA. The state machine workflow is as follows:
[0040] 1) IDLE: The default state of the state machine. The interactive RAM will be read only when the interactive time arrives.
[0041] 2) RD_FLAG: Read address 0 of the interactive RAM to determine the new and old data flags. If it is new data, enter the RD_LENGTH state; if it is old data, enter the DONE state;
[0042] 3) RD_LENGT: Read the data length to determine the length of data to be exchanged;
[0043] 4) RD_ID: read CAN FD ID;
[0044] 5) RD_DATA: read CAN FD data;
[0045] 6) WR_FLAG: write the old data flag to address 0 of the interactive RAM and update the old and new data flags;
[0046] 7) DONE: The interaction is completed.
[0047] Therefore, the present invention also provides a data interaction method between an embedded module and an FPGA, wherein the embedded module writes data into the interaction RAM of the logic of the FPGA, and the underlying logic detects the first address data of the interaction RAM to check whether it is new data. If it is new data, the data is read out of the interaction RAM and written into the sending RAM of the CAN FD. After the writing is completed, the data at the first address of the interaction RAM is updated to indicate old data; the embedded module queries the address to determine whether the data has been read by the FPGA. If it has been read by the FPGA, the embedded module can write the new CAN FD data frame into the interaction RAM, and the CAN FD IP core of the FPGA reads the data in the sending RAM to complete the data sending.
[0048] Among them, after the FPGA writes the data into the CAN FD transmission RAM, it pulls the ready flag high to indicate that there is data to be sent. The CAN FD controller module reads the data in the transmission RAM and completes the CAN FD data frame transmission.
[0049] Among them, for CAN FD receiving interaction, after the CAN FD IP core receives the data, it writes the data into the receiving fifo for the embedded software to read.
[0050] This eliminates conflicts encountered during the interaction process and prevents the situation where the FPGA is reading data while the embedded software is writing, causing unpredictable errors in CAN FD.
[0051] It is understandable that in the embodiments of the present invention, the node device may be a terminal device, a computer device or other apparatus, which may perform some or all of the steps in the embodiments of the present invention, and these steps or operations are merely examples, and the embodiments of the present invention may also perform other operations or variations of various operations. In addition, the various steps may be performed in different orders presented in the embodiments of the present invention, and it is possible that not all operations in the embodiments of the present invention need to be performed. In the various embodiments of the present invention, unless otherwise specified and logically conflicting, the terms and / or descriptions between the different embodiments are consistent and may be referenced to each other, and the technical features in the different embodiments may be combined to form new embodiments according to their inherent logical relationships.
[0052] The various illustrative logic units and circuits described in the embodiments of the present invention can be implemented or operated by a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of the above. The general-purpose processor can be a microprocessor, and optionally, the general-purpose processor can also be any conventional processor, controller, microcontroller or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration.
[0053] The steps of the method or algorithm described in the embodiments of the present invention can be directly embedded in hardware, a software unit executed by a processor, or a combination of the two. The software unit can be stored in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM or any other storage medium in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be arranged in an ASIC, and the ASIC can be arranged in a terminal. Optionally, the processor and the storage medium can also be arranged in different components in the terminal.
[0054] Although the present invention has been described in conjunction with specific features and embodiments thereof, it is apparent that various modifications and combinations may be made thereto without departing from the spirit and scope of the present invention. Accordingly, this specification and the accompanying drawings are merely exemplary illustrations of the present invention as defined by the appended claims and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the present invention. Obviously, those skilled in the art may make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, the present invention is intended to include such modifications and variations if they fall within the scope of the claims of the present invention and their equivalents.
Claims
1. A data interaction method between an embedded module and an FPGA, characterized in that: The data interaction method is based on CANFD for communication, wherein: The embedded module writes data into the interactive RAM of the FPGA logic. The FPGA periodically detects the first address data of the interactive RAM to check whether it is new data. If it is new data, the data is read out of the interactive RAM and written into the transmit RAM of the CAN FD. After the writing is completed, the data at the first address of the interactive RAM is updated to indicate old data. The embedded module queries the first address data of the interactive RAM to determine whether the data in the interactive RAM has been read by the FPGA. If the data has been read by the FPGA, the embedded module writes the new CAN FD data frame into the interactive RAM. The FPGA's CAN FD IP core reads the data in the send RAM and completes data transmission; After the FPGA writes the data into the CAN FD transmit RAM, it pulls the ready flag high, indicating that data is available for transmission. The CAN FD controller module reads the data in the transmit RAM and completes the transmission of the CAN FD data frame. Among them, for CAN FD receiving interaction, after the CAN FD IP core receives the data, it writes the data into the receiving fifo for the embedded software to read.
Citation Information
Patent Citations
Data transmission method and device
CN110825432A
Message forwarding method and device, vehicle-mounted network system and readable storage medium
CN114827290A
Data communication control system
JP1995121463A
Memory having improved read capability
US20090157946A1
Memory system and data control method
US20160253112A1
