CN112596492A - CAN frame transmission method, device, equipment and medium - Google Patents

CAN frame transmission method, device, equipment and medium Download PDF

Info

Publication number
CN112596492A
CN112596492A CN202011379175.XA CN202011379175A CN112596492A CN 112596492 A CN112596492 A CN 112596492A CN 202011379175 A CN202011379175 A CN 202011379175A CN 112596492 A CN112596492 A CN 112596492A
Authority
CN
China
Prior art keywords
frame
controller
sending
transmission
receiving
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
CN202011379175.XA
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.)
Beijing Armyfly Technology Co Ltd
Original Assignee
Beijing Armyfly Technology 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 Beijing Armyfly Technology Co Ltd filed Critical Beijing Armyfly Technology Co Ltd
Priority to CN202011379175.XA priority Critical patent/CN112596492A/en
Publication of CN112596492A publication Critical patent/CN112596492A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B23/00Testing or monitoring of control systems or parts thereof
    • G05B23/02Electric testing or monitoring
    • G05B23/0205Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults
    • G05B23/0208Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults characterized by the configuration of the monitoring system
    • G05B23/0213Modular or universal configuration of the monitoring system, e.g. monitoring system having modules that may be combined to build monitoring program; monitoring system that can be applied to legacy systems; adaptable monitoring system; using different communication protocols

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Small-Scale Networks (AREA)

Abstract

The embodiment of the invention discloses a CAN frame transmission method, a device, equipment and a medium. The CAN frame transmission method comprises the following steps: storing at least one controller local area network (CAN) frame to be transmitted into a transmission chain table of the main controller; when receiving a sending interruption triggered by a CAN controller, sequentially taking out a CAN frame to be sent from the sending linked list, and writing the CAN frame to a target sending cache region corresponding to the sending interruption in the CAN controller so as to instruct the CAN controller to send the CAN frame. According to the technical scheme of the embodiment of the invention, the CAN frame to be transmitted is cached when the CAN controller does not have an idle transmission cache region through the transmission linked list arranged in the main controller, and the CAN frame to be transmitted is stored in the transmission cache region when the CAN controller triggers transmission interruption, so that CAN bus conflict is reduced.

Description

CAN frame transmission method, device, equipment and medium
Technical Field
The embodiment of the invention relates to the field of mobile communication, in particular to a CAN frame transmission method, a device, equipment and a medium.
Background
In the prior art, when a Controller Area Network (CAN) Controller of an SPI (Serial Peripheral interface) interface sends a CAN frame, the CAN frame is written to an idle sending buffer Area in the CAN Controller by a master Controller, and after the CAN frame is sent by the CAN Controller, the master Controller is notified in an interrupt manner, and sets the sending buffer Area to an idle state according to an interrupt state.
In the above manner, the rate of writing the to-be-sent CAN frame into the sending buffer area of the CAN controller by the master controller is limited by the rate of the SPI interface and the idle degree of the master controller. When the transmission rate of the SPI interface is low or the main controller is busy, CAN bus conflict is easily caused, and data loss and data mistransmission are caused.
Disclosure of Invention
The embodiment of the invention provides a CAN frame transmission method, a device, equipment and a medium, which buffer a CAN frame to be transmitted through a transmission linked list arranged in a main controller, and transmit the CAN frame to be transmitted to a transmission buffer area when the CAN controller has an idle transmission buffer area, thereby reducing CAN bus conflict.
In a first aspect, an embodiment of the present invention provides a method for transmitting a CAN frame, where the method includes:
storing at least one controller local area network (CAN) frame to be transmitted into a transmission chain table of the main controller;
when receiving a sending interruption triggered by a CAN controller, sequentially taking out a CAN frame to be sent from the sending linked list, and writing the CAN frame to a target sending cache region corresponding to the sending interruption in the CAN controller so as to instruct the CAN controller to send the CAN frame.
In a second aspect, an embodiment of the present invention further provides a device for transmitting a CAN frame, where the device includes:
the CAN frame storage module to be sent is used for storing at least one controller local area network CAN frame to be sent into a receiving chain table of the main controller;
and the CAN frame writing module to be sent is used for sequentially taking out a CAN frame to be sent from the sending linked list when receiving a sending interruption triggered by the CAN controller, and writing the CAN frame to a target sending cache region corresponding to the sending interruption in the CAN controller so as to indicate the CAN controller to send the CAN frame.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the CAN frame transmission method provided by any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the CAN frame transmission method provided in any embodiment of the present invention.
According to the technical scheme of the embodiment of the invention, when CAN frames are transmitted, at least one CAN frame to be transmitted is stored in a transmission chain table of a main controller, and when a transmission interrupt triggered by the CAN controller is received, one CAN frame to be transmitted is sequentially taken out from the transmission chain table and written into a target transmission buffer zone corresponding to the transmission interrupt in the CAN controller so as to indicate the CAN controller to transmit the CAN frames.
Drawings
Fig. 1 is a flowchart of a CAN frame transmission method according to a first embodiment of the present invention;
fig. 2 is a flowchart of a CAN frame transmission method according to a second embodiment of the present invention;
fig. 3 is a flowchart of a CAN frame transmission method in the third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a CAN frame transmission apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus in the fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a CAN frame transmission method in a first embodiment of the present invention, where the technical scheme of this embodiment is suitable for a situation where a to-be-transmitted CAN frame is cached by a transmission chain table set in a main controller, and the method may be executed by a CAN frame transmission device, and specifically includes the following steps:
and 110, storing at least one CAN frame to be sent into a sending linked list of the main controller.
The sending linked list is a linked list which is arranged in the main controller and used for caching CAN frames to be sent.
When transmitting the CAN frame, the main controller is required to transmit the CAN frame to be transmitted to an idle transmission buffer area in the CAN controller, and the CAN controller transmits the CAN frame. When the CAN frames needing to be sent in a short time are more and no idle sending buffer area exists in the CAN controller, the main controller needs to wait for a longer time, and when the waiting time exceeds the set time, the main controller CAN report errors, so that the CAN frames are failed to be sent.
In order to solve the above problem, in this embodiment, a sending linked list is created at the master controller, and when there is no idle sending buffer area in the CAN controller, the master controller may first buffer the to-be-sent CAN frame into the sending linked list and execute other operations, without continuously waiting for an idle sending buffer area in the CAN controller.
And 120, when receiving a sending interruption triggered by the CAN controller, sequentially taking out a CAN frame to be sent from the sending linked list, and writing the CAN frame to a target sending cache region corresponding to the sending interruption in the CAN controller so as to instruct the CAN controller to send the CAN frame.
The sending interruption is an interruption initiated to the main controller by the CAN controller after the CAN controller sends the CAN frames stored in at least one sending buffer area to the external device, and is used for indicating the main controller to set a beacon sending buffer area corresponding to the sending interruption to an idle state, and sending the CAN frames to be sent, which are cached in a sending linked list, to the target sending buffer area to wait for sending.
In this embodiment, when receiving a transmission interrupt triggered by a CAN controller, a master controller first sequentially takes out a to-be-transmitted CAN frame from a transmission chain table, and then writes the to-be-transmitted CAN frame into a target transmission buffer area corresponding to the transmission interrupt, so that the CAN controller transmits the CAN frame.
According to the technical scheme of the embodiment of the invention, when CAN frames are transmitted, at least one CAN frame to be transmitted is stored in a transmission chain table of a main controller, and when a transmission interrupt triggered by the CAN controller is received, one CAN frame to be transmitted is sequentially taken out from the transmission chain table and written into a target transmission buffer zone corresponding to the transmission interrupt in the CAN controller so as to indicate the CAN controller to transmit the CAN frames.
Example two
Fig. 2 is a flowchart of a CAN frame transmission method according to a second embodiment of the present invention, which is further detailed based on the above embodiments and provides a specific step before at least one controller local area network CAN frame to be transmitted is stored in a transmission chain table of a main controller, and a specific step of sequentially taking out one CAN frame to be transmitted from the transmission chain table and writing the CAN frame to be transmitted into a target transmission buffer area corresponding to a transmission interrupt in the CAN controller when the transmission interrupt triggered by the CAN controller is received. A CAN frame transmission method provided in the second embodiment of the present invention is described below with reference to fig. 2, which includes the following steps:
step 210, in the master controller, a transmit linked list and a receive linked list are created.
In this embodiment, in order to reduce the CAN bus collision, a sending linked list and a receiving linked list are created in the main controller, and are used to cache the CAN frames to be sent and the CAN frames to be received. The receiving chain table is used for caching the CAN frames read from the receiving buffer area of the CAN controller.
Optionally, before the master controller starts working, the SPI for transmitting data to and from the CAN controller is initialized, the interrupt vector (the status flag bit vector for marking each of the sending buffer area and the receiving buffer area) is initialized, the CAN controller is initialized, the sending linked list and the receiving linked list are created, and the interrupt vector is finally enabled, so that when the interrupt triggered by the CAN controller is received, the status flag bit of each of the sending buffer area and the receiving buffer area is provided for the master controller.
Step 220, inquiring whether the CAN controller includes at least one sending buffer area in an idle state, if so, executing step 230, otherwise, executing step 240.
In this embodiment, when the CAN frame needs to be sent, the main controller first queries the states of the sending buffer areas in the CAN controller, and determines whether the current CAN controller includes at least one sending buffer area in an idle state, and specifically, the main controller may read the flag bit state of each sending buffer area to determine whether each sending buffer area is in an idle state.
And step 230, writing at least one CAN frame to be sent into at least one sending buffer area in an idle state.
In this embodiment, when the CAN controller includes an idle sending buffer, the main controller may directly write the to-be-sent CAN frame into the idle sending buffer, so as to instruct the CAN controller to send the CAN frame in the sending buffer to the external device.
And 240, storing at least one controller local area network CAN frame to be transmitted into a transmission linked list of the main controller.
And step 250, when a sending interruption triggered by the CAN controller is received, sequentially taking out a CAN frame to be sent from the sending linked list, and writing the CAN frame into a target sending cache region corresponding to the sending interruption in the CAN controller so as to instruct the CAN controller to send the CAN frame.
Optionally, the sending interrupt includes a flag bit state of at least one sending buffer;
when receiving a sending interruption triggered by a CAN controller, sequentially taking out a CAN frame to be sent from a sending chain table, and writing the CAN frame to a target sending cache region corresponding to the sending interruption in the CAN controller, wherein the method comprises the following steps:
determining a target sending cache region corresponding to the sending interruption in the CAN controller according to the flag bit state of the at least one sending cache region;
and sequentially taking out a CAN frame to be sent from the sending linked list and writing the CAN frame into the target sending cache region.
In an optional embodiment, the sending interrupt carries a flag bit state of at least one sending buffer, and when the master controller receives the sending interrupt sent by the CAN controller, the master controller may determine, according to the flag bit state of each sending buffer, a target sending buffer converted into an idle state, that is, a target sending buffer corresponding to the current sending interrupt, then sequentially take out a CAN frame to be sent from the sending linked list, write the CAN frame into the target sending buffer, and wait for the CAN controller to send the CAN frame.
The technical scheme of the embodiment of the invention comprises the steps that firstly, a sending linked list and a receiving linked list are created in a main controller, when CAN frames need to be sent, whether the CAN controller comprises at least one sending buffer area in an idle state or not is inquired, if yes, at least one CAN frame to be sent is written into at least one sending buffer area in the idle state, otherwise, at least one controller local network CAN frame to be sent is stored into the sending linked list of the main controller, when sending interruption triggered by the CAN controller is received, one CAN frame to be sent is sequentially taken out from the sending linked list and written into a target sending buffer area corresponding to the sending interruption in the CAN controller so as to indicate the CAN controller to send the CAN frames, when no idle sending buffer area exists in the CAN controller, the CAN frames to be sent are buffered through the sending linked list arranged in the main controller, and when the CAN controller triggers the sending interruption, and the CAN frame to be sent is stored in the sending buffer area, so that the waiting time of the master controller for sending the CAN frame is reduced, and the sending reliability of the CAN frame is improved.
EXAMPLE III
Fig. 3 is a flowchart of a CAN frame transmission method in the third embodiment of the present invention, and the present embodiment further provides specific steps for receiving a CAN frame. A CAN frame transmission method provided by a third embodiment of the present invention is described below with reference to fig. 3, including the following steps:
and 310, storing at least one controller local area network CAN frame to be transmitted into a transmission linked list of the main controller.
And step 320, when receiving a sending interruption triggered by the CAN controller, sequentially taking out a CAN frame to be sent from the sending linked list, and writing the CAN frame into a target sending cache region corresponding to the sending interruption in the CAN controller so as to instruct the CAN controller to send the CAN frame.
And step 330, polling at least one receiving buffer area in the CAN controller when receiving the receiving interruption triggered by the CAN controller.
In this embodiment, when receiving a CAN frame sent by an external device, the CAN controller sends a reception interrupt to the main controller to prompt the main controller to receive the CAN frame currently, and after receiving the reception interrupt triggered by the CAN controller, the main controller polls all reception buffer areas in the CAN controller to acquire all the CAN frames received by the CAN controller.
And 340, reading the CAN frames stored in the at least one receiving buffer area in the polling process, and writing the read CAN frames into a receiving linked list of the main controller.
In this embodiment, the main controller reads the CAN frames stored in the receiving buffer areas during the polling process, and writes the read CAN frames into the receiving linked list of the main controller. The main controller polls all the receiving cache areas in the CAN controller after receiving the receiving interruption every time, so that the problem of data loss caused by missing one interruption when the main controller is busy and frequently receives the receiving interruption is avoided.
Optionally, the master controller and the CAN controller perform CAN frame transmission through the serial peripheral interface SPI.
Optionally, the sending linked list is configured to adapt to a transmission rate of the SPI between the main controller and the CAN controller in the process of sending the CAN frame, and store at least one to-be-sent CAN frame;
and the receiving linked list is used for adapting the data transmission rate of the SPI between the main controller and the CAN controller in the process of receiving the CAN frame.
In an optional embodiment, the master controller and the CAN controller perform CAN frame transmission through the SPI. The sending linked list CAN buffer the CAN frame to be sent when no idle sending buffer area exists on one hand, and CAN adapt to the transmission rate of the SPI between the master controller and the CAN controller when the master controller transmits the CAN frame to be sent to the sending buffer area of the CAN controller on the other hand; similarly, the receiving linked list CAN adapt to the transmission rate of the SPI between the main controller and the CAN controller in the process that the main controller obtains the CAN frames from the receiving buffer area of the CAN controller, so that reliable communication between the main controller and the CAN controller is realized.
According to the technical scheme of the embodiment of the invention, when the CAN frame is sent, at least one local network CAN frame of the controller to be sent is stored in a sending chain table of a main controller, and when a sending interruption triggered by the CAN controller is received, one CAN frame to be sent is sequentially taken out from the sending chain table and written into a target sending cache region corresponding to the sending interruption in the CAN controller so as to instruct the CAN controller to send the CAN frame; when receiving the receiving interruption triggered by the CAN controller, polling at least one receiving buffer area in the CAN controller, reading the CAN frame stored in the at least one receiving buffer area in the polling process, and writing the read CAN frame into a receiving linked list of the main controller, solving the problems that the speed for sending and receiving the CAN frame is limited by the speed of an SPI interface and the idle degree of the main controller in the prior art, reducing CAN bus conflict through a sending linked list and a receiving linked list arranged in the main controller, and improving the CAN frame transmission throughput and the reliability of CAN frame transmission.
Example four
Fig. 4 is a schematic structural diagram of a CAN frame transmission device according to a fourth embodiment of the present invention, where the CAN frame transmission device includes: a to-be-sent CAN frame storage module 410 and a to-be-sent CAN frame writing module 420.
A to-be-sent CAN frame storage module 410, configured to store at least one to-be-sent controller local area network CAN frame in a receiving chain table of the master controller;
and a to-be-sent CAN frame writing module 420, configured to, when a sending interrupt triggered by a CAN controller is received, sequentially take out one to-be-sent CAN frame from the sending linked list, and write the to-be-sent CAN frame into a target sending buffer area, corresponding to the sending interrupt, in the CAN controller, so as to instruct the CAN controller to send the CAN frame.
According to the technical scheme of the embodiment of the invention, when CAN frames are transmitted, at least one CAN frame to be transmitted is stored in a transmission chain table of a main controller, and when a transmission interrupt triggered by the CAN controller is received, one CAN frame to be transmitted is sequentially taken out from the transmission chain table and written into a target transmission buffer zone corresponding to the transmission interrupt in the CAN controller so as to indicate the CAN controller to transmit the CAN frames.
Optionally, the CAN frame transmission apparatus further includes:
the buffer area judging module is used for inquiring whether the CAN controller comprises at least one sending buffer area in an idle state;
the CAN frame sending module is used for writing at least one CAN frame to be sent into at least one sending buffer area in an idle state when the CAN controller comprises at least one sending buffer area in the idle state;
and the CAN frame storage module is used for executing the operation of storing at least one CAN frame to be sent into a receiving chain table of the main controller when the CAN controller does not contain at least one sending buffer area in an idle state.
Optionally, the sending interrupt includes a flag bit state of at least one sending buffer;
the to-be-sent CAN frame writing module 420 includes:
a target buffer area determining unit, configured to determine, according to a flag bit state of the at least one sending buffer area, a target sending buffer area corresponding to the sending interruption in the CAN controller;
and the CAN frame writing unit to be sent is used for sequentially taking out a CAN frame to be sent from the sending linked list and writing the CAN frame to be sent into the target sending cache region.
Optionally, the CAN frame transmission apparatus further includes:
the buffer polling module is used for polling at least one receiving buffer in the CAN controller when receiving the receiving interruption triggered by the CAN controller;
and the CAN frame reading module is used for reading the CAN frames stored in the at least one receiving buffer area in the polling process and writing the read CAN frames into a receiving linked list of the main controller.
Optionally, the master controller and the CAN controller perform CAN frame transmission through a serial peripheral interface SPI.
Optionally, the sending linked list is configured to adapt to a transmission rate of the SPI between the main controller and the CAN controller in a process of sending the CAN frame, and store at least one to-be-sent CAN frame;
and the receiving linked list is used for adapting the data transmission rate of the SPI between the main controller and the CAN controller in the process of receiving the CAN frame.
Optionally, the CAN frame transmission apparatus further includes:
and the linked list creating module is used for creating the sending linked list and the receiving linked list in the main controller.
The CAN frame transmission device provided by the embodiment of the invention CAN execute the CAN frame transmission method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
Fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention, as shown in fig. 5, the electronic device includes a processor 50 and a memory 51; the number of processors 50 in the device may be one or more, and one processor 50 is taken as an example in fig. 5; the processor 50 and the memory 51 in the device may be connected by a bus or other means, as exemplified by the bus connection in fig. 5.
The memory 51 is used as a computer-readable storage medium, and CAN be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to a CAN frame transmission method in the embodiment of the present invention (for example, a to-be-transmitted CAN frame storage module 410 and a to-be-transmitted CAN frame writing module 420 in a CAN frame transmission device). The processor 50 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 51, that is, implements the above-described CAN frame transmission method.
The CAN frame transmission method comprises the following steps:
storing at least one controller local area network (CAN) frame to be transmitted into a transmission chain table of the main controller;
when receiving a sending interruption triggered by a CAN controller, sequentially taking out a CAN frame to be sent from the sending linked list, and writing the CAN frame to a target sending cache region corresponding to the sending interruption in the CAN controller so as to instruct the CAN controller to send the CAN frame.
The memory 51 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 51 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 51 may further include memory located remotely from the processor 50, which may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
EXAMPLE six
An embodiment of the present invention also provides a computer-readable storage medium having stored thereon a computer program for executing a CAN frame transmission method when executed by a computer processor.
The CAN frame transmission method comprises the following steps:
storing at least one controller local area network (CAN) frame to be transmitted into a transmission chain table of the main controller;
when receiving a sending interruption triggered by a CAN controller, sequentially taking out a CAN frame to be sent from the sending linked list, and writing the CAN frame to a target sending cache region corresponding to the sending interruption in the CAN controller so as to instruct the CAN controller to send the CAN frame.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the CAN frame transmission apparatus, each unit and each module included in the embodiment are only divided according to functional logic, but are not limited to the above division, as long as the corresponding function CAN be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A CAN frame transmission method is applied to a main controller and comprises the following steps:
storing at least one controller local area network (CAN) frame to be transmitted into a transmission chain table of the main controller;
when receiving a sending interruption triggered by a CAN controller, sequentially taking out a CAN frame to be sent from the sending linked list, and writing the CAN frame to a target sending cache region corresponding to the sending interruption in the CAN controller so as to instruct the CAN controller to send the CAN frame.
2. The method of claim 1, further comprising, prior to storing at least one to-be-transmitted Controller Area Network (CAN) frame in a receive chain table of the master controller:
inquiring whether the CAN controller comprises at least one sending buffer area in an idle state;
if yes, writing at least one CAN frame to be sent into at least one sending buffer area in an idle state;
and if not, executing the operation of storing at least one CAN frame to be sent into a receiving linked list of the main controller.
3. The method of claim 1, wherein the transmission interrupt includes a flag bit status of at least one transmission buffer;
when receiving a sending interruption triggered by a CAN controller, sequentially taking out a CAN frame to be sent from the sending linked list, and writing the CAN frame to a target sending cache region corresponding to the sending interruption in the CAN controller, wherein the method comprises the following steps:
determining a target sending cache region corresponding to the sending interruption in the CAN controller according to the flag bit state of the at least one sending cache region;
and sequentially taking out a CAN frame to be sent from the sending linked list and writing the CAN frame into the target sending cache region.
4. The method of claim 1, further comprising:
when receiving interruption triggered by the CAN controller, polling at least one receiving buffer area in the CAN controller;
and reading the CAN frame stored in at least one receiving buffer area in the polling process, and writing the read CAN frame into a receiving linked list of the main controller.
5. The method of claim 4, wherein the master controller and the CAN controller perform CAN frame transmission over a Serial Peripheral Interface (SPI).
6. The method of claim 5, wherein the transmission chain table is used to adapt the transmission rate of the SPI between the master controller and the CAN controller during the transmission of the CAN frames and to store at least one CAN frame to be transmitted;
and the receiving linked list is used for adapting the data transmission rate of the SPI between the main controller and the CAN controller in the process of receiving the CAN frame.
7. The method of claim 1, further comprising, prior to storing at least one to-be-transmitted Controller Area Network (CAN) frame in a receive chain table of the master controller:
in the master controller, the transmit chain table and the receive chain table are created.
8. A CAN frame transmission apparatus, comprising:
the CAN frame storage module to be sent is used for storing at least one controller local area network CAN frame to be sent into a receiving chain table of the main controller;
and the CAN frame writing module to be sent is used for sequentially taking out a CAN frame to be sent from the sending linked list when receiving a sending interruption triggered by the CAN controller, and writing the CAN frame to a target sending cache region corresponding to the sending interruption in the CAN controller so as to indicate the CAN controller to send the CAN frame.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the CAN frame transmission method of any of claims 1-7.
10. A computer storage medium having stored thereon a computer program, characterized in that the program, when being executed by a processor, implements the CAN frame transmission method according to any one of claims 1 to 7.
CN202011379175.XA 2020-11-30 2020-11-30 CAN frame transmission method, device, equipment and medium Pending CN112596492A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011379175.XA CN112596492A (en) 2020-11-30 2020-11-30 CAN frame transmission method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011379175.XA CN112596492A (en) 2020-11-30 2020-11-30 CAN frame transmission method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN112596492A true CN112596492A (en) 2021-04-02

Family

ID=75187568

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011379175.XA Pending CN112596492A (en) 2020-11-30 2020-11-30 CAN frame transmission method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN112596492A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2478661A (en) * 2007-11-23 2011-09-14 Illinois Tool Works A Controller Device and Method for Testing for an Automotive Test System
CN102664779A (en) * 2012-03-31 2012-09-12 航天东方红卫星有限公司 CAN bus data transmitting method
CN103049414A (en) * 2012-12-28 2013-04-17 中国航空工业集团公司第六三一研究所 Method for converting and transmitting data between FC (fiber channel) bus and CAN (controller area network) bus
CN106130991A (en) * 2016-06-30 2016-11-16 北京东土军悦科技有限公司 A kind of data forwarding method and device
CN107124344A (en) * 2017-04-28 2017-09-01 中车青岛四方车辆研究所有限公司 Train is changed and data storage control method with CAN ethernet communications
CN109525473A (en) * 2018-11-28 2019-03-26 深圳市元征科技股份有限公司 A kind of MCU extension CAN method, system, MCU and computer media
CN110727619A (en) * 2019-10-16 2020-01-24 中科睿微(宁波)电子技术有限公司 Communication system based on SDIO interface and data transmission method
CN111010352A (en) * 2019-12-31 2020-04-14 厦门金龙联合汽车工业有限公司 Automobile CAN message sending method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2478661A (en) * 2007-11-23 2011-09-14 Illinois Tool Works A Controller Device and Method for Testing for an Automotive Test System
CN102664779A (en) * 2012-03-31 2012-09-12 航天东方红卫星有限公司 CAN bus data transmitting method
CN103049414A (en) * 2012-12-28 2013-04-17 中国航空工业集团公司第六三一研究所 Method for converting and transmitting data between FC (fiber channel) bus and CAN (controller area network) bus
CN106130991A (en) * 2016-06-30 2016-11-16 北京东土军悦科技有限公司 A kind of data forwarding method and device
CN107124344A (en) * 2017-04-28 2017-09-01 中车青岛四方车辆研究所有限公司 Train is changed and data storage control method with CAN ethernet communications
CN109525473A (en) * 2018-11-28 2019-03-26 深圳市元征科技股份有限公司 A kind of MCU extension CAN method, system, MCU and computer media
CN110727619A (en) * 2019-10-16 2020-01-24 中科睿微(宁波)电子技术有限公司 Communication system based on SDIO interface and data transmission method
CN111010352A (en) * 2019-12-31 2020-04-14 厦门金龙联合汽车工业有限公司 Automobile CAN message sending method

Similar Documents

Publication Publication Date Title
CN108989432B (en) User-mode file sending method, user-mode file receiving method and user-mode file receiving and sending device
CN112559436B (en) Context access method and system of RDMA communication equipment
CN116150054B (en) Interrupt information processing method based on PCIE
CN113535425A (en) Data sending method and device, electronic equipment and storage medium
CN115941382A (en) Flow control method and device for SPI communication, terminal equipment and storage medium
CN116185936A (en) SPI communication data receiving and transmitting abnormity detection control system and detection method
CN103650401A (en) Internal communication method for mobile terminal
CN116932454B (en) Data transmission method, device, electronic equipment and computer readable storage medium
US10949095B2 (en) Method, network adapters and computer program product using network adapter memory to service data requests
CN102117261B (en) Communication method between inner processors of chip
CN115176453A (en) Message caching method, memory distributor and message forwarding system
CN112596492A (en) CAN frame transmission method, device, equipment and medium
CN111190840A (en) Multi-party central processing unit communication architecture based on field programmable gate array control
CN104850517A (en) Method and apparatus for transmitting packet data using DMA
CN114064221A (en) Interrupt processing method, device, system, equipment and storage medium
CN103744816B (en) Universal serial bus equipment and data transmission method thereof
CN110673554A (en) Data caching processing mechanism applied to industrial control system
CN118502323B (en) Industrial Ethernet data transmission method and FPGA
CN111124987B (en) PCIE-based data transmission control system and method
CN103605622B (en) A kind of method and apparatus transmitting data
US11714608B2 (en) Device and method for handling programming language function
CN108304214B (en) Method and device for verifying integrity of immediate data
US20090313393A1 (en) Method of increasing efficiency of end point memory in usb devices
CN114265788A (en) Memory management device, method, equipment and medium
KR101065588B1 (en) Hardware-based object exchangeOBEX module, transceiver device comprising the same module, and method of transceiving data using the same module

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210402

RJ01 Rejection of invention patent application after publication