CN112491682A - High-precision synchronous communication method of CAN bus node equipment - Google Patents

High-precision synchronous communication method of CAN bus node equipment Download PDF

Info

Publication number
CN112491682A
CN112491682A CN202011489731.9A CN202011489731A CN112491682A CN 112491682 A CN112491682 A CN 112491682A CN 202011489731 A CN202011489731 A CN 202011489731A CN 112491682 A CN112491682 A CN 112491682A
Authority
CN
China
Prior art keywords
frame
data
time
node
timing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011489731.9A
Other languages
Chinese (zh)
Inventor
段芙蓉
李洋
龚辉斌
李刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Xiyao Instrument Co ltd
Original Assignee
Chengdu Xiyao Instrument Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Xiyao Instrument Co ltd filed Critical Chengdu Xiyao Instrument Co ltd
Priority to CN202011489731.9A priority Critical patent/CN112491682A/en
Publication of CN112491682A publication Critical patent/CN112491682A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention provides a high-precision synchronous communication method of CAN bus node equipment, which aims to solve the problem of the accuracy of data transmission of multi-node equipment. The communication of a plurality of node devices connected on the bus adopts time division multiplexing, all bus nodes share a synchronous signal source, and the conflict competition time of the multi-node devices is avoided in a mode of matching programmable logic and software.

Description

High-precision synchronous communication method of CAN bus node equipment
Technical Field
The invention belongs to the field of bus data communication synchronous processing. In particular to a high-precision transmission method of CAN bus node equipment.
Background
The CAN bus is a communication network with distributed control and is characterized in that data communication is free of master-slave division. A plurality of nodes may be mounted on the CAN bus, and any one node may initiate data communication to any other node(s). When a plurality of nodes initiate communication simultaneously, the avoidance priority with low priority is high, so that the communication line is not congested, but the opportunity that information with low priority is not sent all the time may occur.
To solve this problem, a method may be employed in which a plurality of nodes of the CAN bus transmit data by sharing a synchronous clock signal, and each node transmits the designation information at the designated time in accordance with the in-network communication protocol. However, how to accurately send the specific information at the specific time is a challenge for the node device. At present, a method of responding to a synchronization signal interrupt by software, timing by software and transmitting data is often adopted. The software timing accuracy in the method is easily influenced by system scheduling, and is represented as inaccurate data timing transmission time. For the same node and the same time segment, data needs to be sent at a plurality of moments in sequence, the data is more difficult to be sent at accurate timing, and due to inaccurate timing of the node, message conflict is caused by delay accumulation of the node, and the normal work of a system is influenced.
Disclosure of Invention
In view of the above disadvantages of the prior art, especially the insufficiency of software timing, the invention provides a method for solving the high-precision synchronization of nodes by adopting the cooperation of programmable logic and software, and realizes the accurate positioning of the data sending time. The specific method comprises the following steps:
a high-precision synchronous communication method for CAN bus node equipment is characterized in that data communication is carried out between each node equipment on a CAN bus based on the CAN bus. The following measures are adopted: 1) each node device communicates in a time division multiplexing mode, shares a periodic synchronous signal source, and starts periodic timing and enters timing logic when a synchronous periodic signal arrives; 2) all transmitted data frames are in a special format that can be updated by software in real time, including: the time of day, start flag, ID and data are sent.
Furthermore, all node devices start timing according to the starting point of the synchronization period signal, and send the CAN frame when the data to be sent of the node arrives, and so on until all data frames in the synchronization period of the node are sent.
Further, all CAN frame transmission needs to go through three stages, namely a frame writing stage, a frame preparation stage, and a frame sending stage.
The CAN frame is sent through three stages, namely a frame writing stage, a frame preparation stage and a frame sending stage:
a frame writing stage: the software is written in a data FIFO provided by the programmable logic in a fixed frame format.
A frame preparation stage: the programmable logic device captures the rising edge of the synchronous signal, starts timing in the synchronous time interval, and the timing precision is 10 ns; and simultaneously reading the data frame from the FIFO, judging a frame mark when reading the frame, judging whether the data frame is in the same synchronization time period, and reading the data from the beginning to the end frame in the synchronization time period to be placed in a buffer to prepare for sending the data.
Frame sending stage: and when the programmable logic counts the first frame sending time, writing the CAN frame ID and the CAN frame data of the data frame into a CAN sending cache, and starting a CAN frame sending command after writing the complete CAN frame, wherein the CAN frame data appears on the CAN bus. And by analogy, other CAN frames in the synchronization moment are sent.
By adopting the method, time division multiplexing is adopted, all bus nodes share a synchronous signal source, and by means of the cooperation of programmable logic and software, the conflict competition time of multi-node equipment is avoided, so that the method has better flexibility, the precision of the sending time and the convenience of receiving data analysis, and the precision of the sending time can reach 10 ns. The method is suitable for multi-node equipment communication, and is a system with high data throughput and strictly controlled sending time.
Drawings
FIG. 1 is a schematic view of multi-node synchronous CAN bus communication
FIG. 2 is a diagram illustrating a multi-stage operation of CAN frame transmission
FIG. 3 is a schematic diagram of a CAN frame structure
FIG. 4 is a diagram of a synchronization signal
FIG. 5 is a flow chart of CAN frame reception
FIG. 6 is a flow chart of CAN frame transmission work
Detailed Description
The present invention will be further described with reference to the accompanying drawings, taking the synchronization period as 20ms as an example.
The invention provides a method for accurately sending data at a node designated time. As shown in fig. 1, a CAN bus has multiple node devices, and each node is connected to a synchronization signal source through hardware. All transmitted CAN frames (data frames) are in a special format that CAN be updated by software in real time, including: the time of day, start flag, ID and data are sent.
As shown in fig. 2, CAN frame transmission data is performed in three stages. The first stage is a frame writing stage in which software writes frame information into a data FIFO provided by the programmable logic device.
The second stage is a data preparation stage, in which data reading in the data FIFO is realized by programmable logic, and the logic extracts frame information data according to a fixed frame information structure (as shown in fig. 3) to acquire information such as a transmission flag, transmission time, CAN data, and the like. Under the condition that the data FIFO is not empty, after the zero time of the synchronous signal and the transmission of the frame data are finished, a data preparation stage is entered to extract the frame information.
The third stage is a frame sending stage, and the CAN data sending is controlled by logic. And after the zero moment of the synchronous signal arrives, the logic starts to time, and the CAN frame data is logically sent out after the frame sending moment is timed. And acquiring next frame information after the CAN data is sent, logically timing to the sending time of the next frame, sending the CAN data again, and circulating the process until the data FIFO is empty.
As in fig. 3, the frame structure of the data frame is composed of 8 bytes. The frame mark and the frame sending time are both 1 byte, the CAN frame ID occupies 4 bytes, and the CAN frame data occupies 8 bytes.
(1) The frame flag includes a frame start transmission flag, a frame end transmission flag, and the number of frames to be transmitted in the synchronization period. In each synchronization period, the logic program judges whether the start flag bit and the end flag bit are set or not, and acquires the number of frames to be sent in the synchronization period, so that CAN frame data at a specified time and in a specified number are sent in the synchronization period.
(2) The frame transmission time is the transmission time of the frame data in the synchronization period of the synchronization signal, and the valid value range of the frame transmission time is 0 to the synchronization period (millisecond value).
(3) The CAN frame ID comprises an RTR control bit, the number of bytes of CAN frame data and CAN sending ID information.
(4) The CAN frame data comprises frame data sent on a CAN bus, and the maximum length of the frame data is 8 bytes. And when the number of the sending data bytes is less than 8, the CAN frame data of the valid bytes is logically sent to the CAN bus.
The frame information data written in the data FIFO contains various information, providing logic with the transmission timing of transmitting CAN frame data on time, in addition to the necessary CAN bus frame ID and frame data. Meanwhile, the frame information data in the data FIFO also provides start and end mark information for logic, so that the transmission of multi-frame CAN bus data in a synchronous period becomes possible. The data frame has a simple structure, and data can be written in by software and data information can be extracted logically conveniently. The frame structure contains enough information, and the software CAN send CAN frame data from the multi-aspect control logic.
As shown in fig. 4, the synchronization signal output by the synchronization signal source is a periodic signal, and after the logic receives the rising edge of the synchronization signal (i.e., the zero time of the synchronization signal), the timer of each node starts to time; and after the zero moment of the synchronous signal of the next period arrives, the timer restarts timing.
Each node logic has the function of accurate timing counting. The timing frequency of each timer is 100MHz, and the high-precision timing time CAN be provided for the transmission of data on the CAN bus.
As shown in fig. 5, a node may receive data on a bus at any time of a synchronous clock, and after receiving CAN bus data, the node logically stores the CAN data in a receiving buffer. After the nodes receive CAN frame data, the nodes temporarily store timing values of the timer as time scale data, and the time scale data are stored in a receiving cache for software access of each node.
As shown in fig. 6, each node software transmits the transmission time and the CAN frame to each node. After receiving the zero time mark of the synchronous clock, the node clears the timer and starts the timer timing function, and the logic program simultaneously acquires the frame information data in the data FIFO. If the frame start transmission flag in the frame information is set, the logic program transmits the CAN data at the transmission time of the frame.
If the frame end sending flag in the current frame information is not set, and after the CAN data of the current frame is sent, the logic program acquires the next frame information in the data FIFO. And then executing the timing of the next frame and the logic program for sending data until the acquired frame end mark is set.
If the frame end flag in the current frame information is set, the logic program does not read the frame information in the data FIFO any more after the CAN data of the current frame is sent. After the zero time mark of the next synchronizing signal comes, the logic executes the procedures of reading frame information, timing and sending data.

Claims (3)

1. A high-precision synchronous communication method of CAN bus node equipment is characterized in that the following means are adopted: 1) each node device communicates in a time division multiplexing mode, shares a periodic synchronous signal source, and starts periodic timing and enters timing logic when a synchronous periodic signal arrives; 2) all transmitted data frames are in a special format that can be updated by software in real time, including: the time of day, start flag, ID and data are sent.
2. The method of claim 1, wherein all node devices start timing according to a start point of a synchronization cycle signal, and send a CAN frame when a data transmission time of the node arrives, and so on until all data frames in the synchronization cycle of the node are sent.
3. The method according to claim 2, wherein the CAN frame is transmitted through three stages, namely a frame writing stage, a frame preparation stage, and a frame sending stage;
a frame writing stage: the software is written into a data FIFO provided by the programmable logic according to a fixed frame format; a frame preparation stage: the programmable logic device captures the rising edge of the synchronous signal, starts timing in the synchronous time interval, and the timing precision is 10 ns; reading data frames from FIFO, judging frame marks when reading the frames, judging whether the data frames are in the same synchronization time period, reading the data from the beginning to the end frames in the synchronization time period, putting the read data into a buffer memory, and preparing to send the data; frame sending stage: when the programmable logic counts the time to the first frame sending time, writing the CAN frame ID and the CAN frame data of the data frame into a CAN sending cache, and starting a CAN frame sending command after writing the complete CAN frame, wherein the CAN frame data appears on a CAN bus; and by analogy, other CAN frames in the synchronization moment are sent.
CN202011489731.9A 2020-12-17 2020-12-17 High-precision synchronous communication method of CAN bus node equipment Pending CN112491682A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011489731.9A CN112491682A (en) 2020-12-17 2020-12-17 High-precision synchronous communication method of CAN bus node equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011489731.9A CN112491682A (en) 2020-12-17 2020-12-17 High-precision synchronous communication method of CAN bus node equipment

Publications (1)

Publication Number Publication Date
CN112491682A true CN112491682A (en) 2021-03-12

Family

ID=74917191

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011489731.9A Pending CN112491682A (en) 2020-12-17 2020-12-17 High-precision synchronous communication method of CAN bus node equipment

Country Status (1)

Country Link
CN (1) CN112491682A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105141483A (en) * 2015-09-25 2015-12-09 中国科学院电工研究所 Multi-node network minimum communication interval measurement method based on CAN bus
WO2016119525A1 (en) * 2015-01-26 2016-08-04 国电南瑞科技股份有限公司 Elastic data interaction integrated bus system
CN106603367A (en) * 2017-02-28 2017-04-26 北京艾利特科技有限公司 CAN bus communication method for time synchronization
CN107153412A (en) * 2017-06-16 2017-09-12 北方电子研究院安徽有限公司 It is a kind of that there is the CAN controller circuit for sending FIFO
CN108616320A (en) * 2016-12-12 2018-10-02 中国航空工业集团公司西安航空计算技术研究所 A kind of remaining bus time synchronous method
CN111049718A (en) * 2019-12-30 2020-04-21 北京京航计算通讯研究所 CAN bus simulation monitoring method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016119525A1 (en) * 2015-01-26 2016-08-04 国电南瑞科技股份有限公司 Elastic data interaction integrated bus system
CN105141483A (en) * 2015-09-25 2015-12-09 中国科学院电工研究所 Multi-node network minimum communication interval measurement method based on CAN bus
CN108616320A (en) * 2016-12-12 2018-10-02 中国航空工业集团公司西安航空计算技术研究所 A kind of remaining bus time synchronous method
CN106603367A (en) * 2017-02-28 2017-04-26 北京艾利特科技有限公司 CAN bus communication method for time synchronization
CN107153412A (en) * 2017-06-16 2017-09-12 北方电子研究院安徽有限公司 It is a kind of that there is the CAN controller circuit for sending FIFO
CN111049718A (en) * 2019-12-30 2020-04-21 北京京航计算通讯研究所 CAN bus simulation monitoring method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
钟波等: "实时监控系统中的时分复用CAN协议", 《单片机与嵌入式系统应用》 *

Similar Documents

Publication Publication Date Title
CN108650051B (en) The clock synchronization apparatus and method of general devices at full hardware single step 1588
CN105024777B (en) Servo-driver synchronous method based on EtherCAT real-time ethernets
CN110166952B (en) Wireless sensor network data acquisition method and system based on broadcast synchronization
CN103326802A (en) Wireless network system for achieving synchronous acquisition, synchronous acquisition device and method
EP3163786A1 (en) Clock synchronization method and apparatus
EP3664375A1 (en) Packet processing method and network device
EP2701335A1 (en) Synchronization control system
CN103248471A (en) Clock synchronization method based on PTP (Precision Time Protocol) and reflective memory network
CN106230541B (en) A kind of Site synch system and method for Industrial Ethernet
CN108833366B (en) Control frame compression method based on AS6802 protocol
CN112583477B (en) Delay measurement method, delay measurement system and storage medium
CN111447030A (en) Network time service precision control method and system of earthquake collector and terminal equipment
CN113960413A (en) Time synchronization method for collecting unit and collecting unit in fault indicator
US20220360350A1 (en) Method and apparatus for acquiring timestamp of data stream, storage medium, and electronic apparatus
CN112491682A (en) High-precision synchronous communication method of CAN bus node equipment
CN113534888B (en) FPGA-based time synchronization method and device for multiple VPX boards
CN108683470B (en) Circuit and method for acquiring and updating transparent clock
CN103227708A (en) Method and device for transmitting clock synchronization messages in E1 link
WO2016000324A1 (en) Method and apparatus for implementing time synchronization
CN111357243A (en) User device of bus system, operation method and bus system
CN214480655U (en) Embedded equipment compatible with definable deterministic communication Ethernet
CN205195718U (en) Embedded network synchronization system based on FPGA
EP2680466A1 (en) Low latency transparent clock
CN111123805A (en) Data synchronization method for signal acquisition unit
CN110958072B (en) Multi-node audio and video information synchronous sharing display method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20210312