CAN bus data transmission method, device, storage medium and electronic device

Determine the STMIN by analyzing the process control frame in the CAN TP unit of the domain controller, and calls the timer when sending the CAN bus data to ensure that the sequence frame interval is greater than STMIN, solving the problem of multiple frame data delivery of the CAN bus, and realized data transmission of data transmission. Reliability and integrity.

CN115604187BActive Publication Date: 2025-01-24NOBO AUTOMOTIVE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110778981.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-09
Publication Date
2025-01-24
Estimated Expiration
2041-07-09

AI Technical Summary

Technical Problem

During the domain controller diagnostic refresh, there is a timing STmin requirement when sending multi-frame data on the CAN bus. However, the bus is preempted by high-priority packets, resulting in the time between sequence frames being less than STmin, resulting in the receiver failing to receive and multi-frame data being lost. .

Method used

Determine STmin by parsing out the process control frame at the data transmission layer, and calling the timing function after sending the first sequence frame. After confirming that the timing is completed, the second sequence frame is sent to the bus to ensure that the sending time interval of the two sequence frames is greater than STmin. .

Benefits of technology

Effectively avoids the problem of sequence frame interval due to the bus sequence of the bus, ensuring the integrity and reliability of data transmission, and avoiding multi -frame data loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115604187B_ABST
    Figure CN115604187B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a CAN bus data sending method, device, storage medium and electronic device. The method comprises: in response to receiving data distributed by a routing unit, assembling the data into pieces to obtain frame data, and sending the first frame in the frame data to the CAN bus, so that an electronic control unit receives the first frame through the CAN bus; in the case of receiving a process control frame, parsing STmin according to the process control frame, and inputting the STmin into a timing function, wherein the process control frame is sent by the electronic control unit in response to receiving the first frame; sending a first sequence frame in the frame data to the CAN bus, so that the electronic control unit receives the first sequence frame through the CAN bus; in the case of receiving a first confirmation mark, calling the timing function, wherein the first confirmation mark is sent by the electronic control unit in response to receiving the first sequence frame; and in the case where the return value of the timing function indicates that the timing is completed, sending a second sequence frame to the CAN bus.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of controller area networks, and in particular to a CAN bus data sending method, device, storage medium and electronic device. Background Art

[0002] When the domain controller is refreshing the diagnosis, there is a timing STmin requirement when sending multiple frames of data on the CAN bus. For example, when STmin is 10ms, the time difference between two sequence frames must be greater than 10ms. The domain controller stores the message to be sent in the cache unit and waits for the bus to be idle before sending it. When the bus is idle, the message stored in the cache unit will be thrown to the bus at the fastest speed. However, the message sent on the bus is preempted according to the priority. If the bus is preempted by a high-priority message from another module, and the preemption time has not reached STmin, the bus enters the idle state, which may cause the time between the sequence frames to be less than STmin, resulting in the receiver's failure to receive and the loss of multiple frames of data.

[0003] In the related art, STmin is generally set to 0 to meet the reception requirements. However, the smaller the STmin is set, the higher the computing power and storage resource requirements that the main control unit needs to allocate, which will result in the need to use more expensive chips. Summary of the invention

[0004] In order to solve the problem in the related art that the time for a cache unit to throw out a sequence frame is uncontrollable, the present disclosure provides a CAN bus data sending method, device, storage medium and electronic device.

[0005] A first aspect of the present disclosure provides a CAN bus data sending method, the method being applied to a CAN TP unit of a domain controller, the method comprising:

[0006] In response to receiving the data distributed by the routing unit, the data is segmented and assembled to obtain frame data, and a first frame of the frame data is sent to a CAN bus, so that the electronic control unit receives the first frame through the CAN bus;

[0007] In the case of receiving a flow control frame, parsing STmin according to the flow control frame, and inputting the STmin into a timing function, wherein the flow control frame is sent by the electronic control unit in response to receiving the first frame; and

[0008] Sending a first sequence of frames in the frame data to a CAN bus, so that an electronic control unit receives the first sequence of frames through the CAN bus;

[0009] calling the timing function in the case of receiving a first confirmation flag, the first confirmation flag being sent by the electronic control unit in response to receiving the first sequence of frames;

[0010] When the return value of the timing function indicates that the timing is completed, the second sequence of frames in the frame data is sent to the CAN bus, so that the electronic control unit receives the second sequence of frames through the CAN bus.

[0011] Optionally, the domain controller further includes a cache unit and a CAN drive unit, and when the return value of the timing function indicates that the timing is completed, sending the second sequence of frames in the frame data to the CAN bus includes:

[0012] Determine whether the storage space of the cache unit is empty;

[0013] When it is determined that the storage space of the cache unit is not empty, the second sequence frame is sent to the cache unit, and the cache unit can send the second sequence frame in the storage space of the cache unit to the CAN driver unit when the CAN bus is idle, so that the CAN driver unit converts the data in the second sequence frame into a voltage signal and sends it to the CAN bus;

[0014] When it is determined that the storage space of the cache unit is empty, the second sequence of frames is sent to a CAN drive unit, so that the CAN drive unit converts the data in the second sequence of frames into voltage signals and sends them to a CAN bus.

[0015] Optionally, the frame data includes a plurality of sequence frames in addition to the first sequence frames and the second sequence frames, and the method further includes:

[0016] calling the timing function in the case of receiving an Nth confirmation flag, wherein the Nth confirmation flag is sent by the electronic control unit in response to receiving the Nth sequence frame;

[0017] When the return value of the timing function indicates that the timing is completed, sending the N+1th sequence frame of the frame data to the CAN bus;

[0018] Wherein, N is any natural number greater than 1 and less than the total number of the sequence frames.

[0019] Optionally, in response to receiving data distributed by a router, assembling the data into pieces to obtain frame data, and sending a first frame of the frame data to a CAN bus comprises:

[0020] In response to receiving data distributed by the router, determining whether the data needs to be fragmented;

[0021] In the case where the data needs to be fragmented, the data is fragmented and assembled to obtain frame data, and the first frame of the frame data is sent to the CAN bus;

[0022] When the data does not need to be segmented, the data is converted into single-frame data, and the single-frame data is sent to the CAN bus.

[0023] A second aspect of the present disclosure provides a CAN bus data sending device, the device being a part of a CAN TP unit of a domain controller, the device comprising:

[0024] A first sending module, configured to, in response to receiving data distributed by the routing unit, assemble the data into pieces to obtain frame data, and send a first frame of the frame data to a CAN bus, so that the electronic control unit receives the first frame through the CAN bus;

[0025] a parsing module, configured to parse STmin from a flow control frame upon receiving the flow control frame, and input the STmin into a timing function, wherein the flow control frame is sent by the electronic control unit in response to receiving the first frame;

[0026] A second sending module, used for sending a first sequence of frames in the frame data to a CAN bus, so that an electronic control unit receives the first sequence of frames through the CAN bus;

[0027] a timing module, configured to call the timing function upon receiving a first confirmation mark, wherein the first confirmation mark is sent by the electronic control unit in response to receiving the first sequence frame;

[0028] The third sending module is used to send the second sequence of frames in the frame data to the CAN bus when the return value of the timing function indicates that the timing is completed, so that the electronic control unit receives the second sequence of frames through the CAN bus.

[0029] Optionally, the domain controller further includes a cache unit and a CAN driver unit, and the third sending module is specifically used for:

[0030] Determine whether the storage space of the cache unit is empty;

[0031] When it is determined that the storage space of the cache unit is not empty, the second sequence frame is sent to the cache unit, and the cache unit can send the second sequence frame in the storage space of the cache unit to the CAN driver unit when the CAN bus is idle;

[0032] When it is determined that the storage space of the cache unit is empty, the second sequence of frames is sent to the CAN driver unit.

[0033] Optionally, the frame data includes a plurality of sequence frames in addition to the first sequence frames and the second sequence frames, and the timing module is further used for:

[0034] calling the timing function in the case of receiving an Nth confirmation flag, wherein the Nth confirmation flag is sent by the electronic control unit in response to receiving the Nth sequence frame;

[0035] The device also includes:

[0036] A fourth sending module, when the return value of the timing function indicates that the timing is completed, sends the N+1th sequence frame of the frame data to the CAN bus;

[0037] Wherein, N is any natural number greater than 1 and less than the total number of the sequence frames.

[0038] Optionally, the first sending module is specifically configured to:

[0039] In response to receiving data distributed by the router, determining whether the data needs to be fragmented;

[0040] In the case where the data needs to be fragmented, the data is fragmented and assembled to obtain frame data, and the first frame of the frame data is sent to the CAN bus;

[0041] When the data does not need to be segmented, the data is converted into single-frame data, and the single-frame data is sent to the CAN bus.

[0042] A third aspect of the present disclosure provides a non-temporary computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the methods described in the first aspect of the present disclosure.

[0043] A fourth aspect of the present disclosure provides an electronic device, including:

[0044] a memory having a computer program stored thereon;

[0045] A processor is used to execute the computer program in the memory to implement the steps of any one of the methods described in the first aspect of the present disclosure.

[0046] Through the above technical solution, after the process control frame is parsed out in the data transmission layer to determine STmin, STmin is input into the timing function, and the timing function is called after the first sequence frame is sent. After the timing is completed, the second sequence frame is sent to the bus. This ensures that the sending time interval between the two sequence frames is greater than STmin, ensuring that data transmission will not lose frames.

[0047] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:

[0049] Figure 1 is a flow chart of a CAN bus data sending method according to an exemplary embodiment;

[0050] Figure 2 is another flow chart of a CAN bus data sending method according to an exemplary embodiment;

[0051] Figure 3 is a block diagram of a CAN bus network according to an exemplary embodiment;

[0052] Figure 4 A block diagram of a CAN bus data sending device according to an exemplary embodiment;

[0053] Figure 5 A block diagram of an electronic device is shown according to an exemplary embodiment. DETAILED DESCRIPTION

[0054] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.

[0055] Those skilled in the art should know that in a CAN bus network, the cache unit, as a storage device, cannot parse and operate data by itself. When there is a lot of data to be transmitted, a queue will be sent. Since the cache unit cannot parse and operate the data, it will only send the earliest received data to the next layer at the fastest speed when it is in the queue, which will lead to the uncontrollable time of sending data to the CAN bus, and the message sent to the CAN bus may not meet the STmin. Therefore, the present disclosure proposes to use a CAN TP layer that can be controlled by software for timing, and send the data out after the timing is completed.

[0056] Based on the above invention concept, Figure 1The present invention is a flowchart of a method for sending data on a CAN (Controller Area Network) bus according to an exemplary embodiment. The method is applied to a CAN TP (Transport Layer) unit of a Body Domain Controller (BDC). The method includes:

[0057] S101. In response to receiving data distributed by a routing unit, the data is segmented and assembled to obtain frame data, and a first frame of the frame data is sent to a CAN bus, so that an electronic control unit receives the first frame through the CAN bus.

[0058] Among them, when sending the first frame of the frame data to the CAN bus, if the bus is occupied, the first frame can be sent to the cache unit first, and when the bus is idle, the cache unit will send the first frame to the CAN drive unit, and the CAN drive unit will convert the first frame data into a voltage signal and send it to the CAN bus.

[0059] S102 . When a flow control frame is received, STmin is parsed according to the flow control frame, and STmin is input into a timing function. The flow control frame is sent by the electronic control unit in response to receiving the first frame.

[0060] S103: Send a first sequence of frames in the frame data to a CAN bus, so that an electronic control unit receives the first sequence of frames through the CAN bus.

[0061] S104: Invoke the timing function when a first confirmation mark is received, where the first confirmation mark is sent by the electronic control unit in response to receiving the first sequence frame.

[0062] The timing function may be a function with only one parameter, STmin. For example, the timing function has a variable X, and X increases with the time after the function is started. When the value of X is greater than the value of the parameter STmin, the function returns a return value indicating that the timing is completed. In addition, the timing function may return another return value when X is greater than STmin, or may return a return value every fixed period, which is not limited in the present disclosure.

[0063] S105 . When the return value of the timing function indicates that the timing is completed, send a second sequence of frames in the frame data to a CAN bus, so that an electronic control unit receives the second sequence of frames via the CAN bus.

[0064] Among them, the CAN TP unit can be an electronic device in the TP data transmission layer of the CAN bus network. The routing unit can refer to the PduR (Protocol Data Units Router) module, which is used to route data to other transport layers or upper layer modules. In addition, the first frame is often written as FF (First Frame), the flow control frame is often written as FC (Flow Control), and the sequence frame is often written as CF (Consecutive Frame).

[0065] In the disclosed embodiment, after STmin is determined by parsing the process control frame at the data transmission layer, STmin is input into the timing function, and the timing function is called after the first sequence frame is sent. After the timing is completed, the second sequence frame is sent to the bus. This ensures that the sending time interval between the two sequence frames is greater than STmin, thereby ensuring that data transmission will not lose frames.

[0066] In some optional embodiments, the domain controller further includes a cache unit and a CAN driver unit, and when the return value of the timing function indicates that the timing is completed, sending the second sequence of frames in the frame data to the CAN bus includes:

[0067] Determine whether the storage space of the cache unit is empty;

[0068] When it is determined that the storage space of the cache unit is not empty, the second sequence frame is sent to the cache unit, and the cache unit can send the second sequence frame in the storage space of the cache unit to the CAN driver unit when the CAN bus is idle, so that the CAN driver unit converts the data in the second sequence frame into a voltage signal and sends it to the CAN bus;

[0069] When it is determined that the storage space of the cache unit is empty, the second sequence of frames is sent to a CAN drive unit, so that the CAN drive unit converts the data in the second sequence of frames into voltage signals and sends them to a CAN bus.

[0070] The CAN driver unit is used to convert frame data into voltage signals for transmission on the CAN bus. With this solution, the bus is determined to be occupied by checking whether the cache is empty. When the bus is not occupied, the cache is skipped and the sequence frame data is directly sent to the CAN driver unit, thereby shortening the cache reading loss and reducing the transmission time.

[0071] In some other optional embodiments, the frame data includes a plurality of sequence frames in addition to the first sequence frames and the second sequence frames, and the method further includes:

[0072] calling the timing function in the case of receiving an Nth confirmation flag, wherein the Nth confirmation flag is sent by the electronic control unit in response to receiving the Nth sequence frame;

[0073] When the return value of the timing function indicates that the timing is completed, sending the N+1th sequence frame of the frame data to the CAN bus;

[0074] Wherein, N is any natural number greater than 1 and less than the total number of the sequence frames.

[0075] Those skilled in the art should be aware that the number of sequence frames in multi-frame data is generally not limited to two frames. By adopting this solution, each sequence frame needs to make sure that the return value of the timing function representing the completion of timing is received before sending it, and the data transmission layer will send data to the lower layer. This can ensure that when the number of sequence frames is large, the time interval between two frames of data is greater than STmin, thereby ensuring that multi-frame data is not lost during transmission.

[0076] In some further optional embodiments, in response to receiving data distributed by a router, assembling the data into pieces to obtain frame data, and sending a first frame of the frame data to a CAN bus comprises:

[0077] In response to receiving data distributed by the router, determining whether the data needs to be fragmented;

[0078] In the case where the data needs to be fragmented, the data is fragmented and assembled to obtain frame data, and the first frame of the frame data is sent to the CAN bus;

[0079] When the data does not need to be segmented, the data is converted into single-frame data, and the single-frame data is sent to the CAN bus.

[0080] By adopting this solution, no matter what kind of data the router distributes, the CAN TP unit at the data transmission layer can be processed by the solution provided by the embodiment of the present disclosure. It is applicable to both data that needs to be fragmented and data that does not need to be fragmented, and has stronger applicability.

[0081] In order to enable those skilled in the art to better understand the inventive concept of the present disclosure, the present disclosure also provides the following Figure 2 The flowchart of another CAN bus data sending method according to an exemplary embodiment is shown, and the method is applied to Figure 3The CAN bus network 300 shown in FIG. 1 includes a domain controller 310 and an ECU (Electronic Control Unit) 320. The domain controller 310 and the ECU 320 are connected via a CAN bus. The domain controller includes a PduRouter 311, a CAN TP 312, a buffer unit Buffer 313, and a CAN driver unit CAN Driver 314. Figure 2 As shown, the method comprises the steps of:

[0082] S201, PduRouter311 sends data to CAN TP312.

[0083] In the embodiment of the present disclosure, the data is data that needs to be fragmented.

[0084] S202, CAN TP312 assembles the data segments.

[0085] CAN TP312 assembles the data segments to obtain frame data, which includes a first frame FF and sequence frames CF1, CF2, and CF3.

[0086] S203 , CAN TP312 sends the first frame FF to ECU320 via the CAN bus.

[0087] S204 , in response to receiving the first frame FF, the ECU 320 sends a flow control frame FC to the CAN TP 312 .

[0088] S205. CAN TP312 parses the flow control frame FC to obtain STmin and inputs STmin into the timing function.

[0089] S206 , CAN TP312 sends the sequence frame CF1 directly to CAN Driver314 .

[0090] Those skilled in the art should be aware that in the embodiment of the present disclosure, taking the case where the CAN bus is idle when the sequence frames CF1 and CF3 are sent and the CAN bus is occupied when CF2 is sent as an example, before the execution of steps S206, S208 and S211, a step of determining to which unit the corresponding sequence frames are sent is also included. In order to save space, the embodiment of the present disclosure omits the corresponding steps. In the specific implementation, it is necessary to determine first which unit the sequence frames CF1, CF2 and CF3 are sent to when they are sent.

[0091] S207 , the CAN Driver 314 converts the data included in the sequence frame CF1 into a voltage signal and sends it to the ECU 320 via the CAN bus.

[0092] S208 : In response to receiving the sequence frame CF1 , the ECU 320 sends a confirmation flag corresponding to CF1 to the CAN TP 312 .

[0093] S209 . In response to receiving the confirmation flag corresponding to CF1 , CAN TP312 calls the timing function.

[0094] S210 , when CAN TP312 determines that the return value returned by the timing function corresponding to CF1 indicates that the timing is completed, it sends the sequence frame CF2 to Buffer313 .

[0095] S211 , when it is determined that the CAN bus is idle, Buffer 313 immediately sends CF2 to CAN Driver 314 .

[0096] S212 , CAN Driver 314 converts the data included in the sequence frame CF2 into a voltage signal and sends it to ECU 320 via the CAN bus.

[0097] S213 : In response to receiving the sequence frame CF2 , the ECU 320 sends a confirmation flag corresponding to CF2 to the CAN TP 312 .

[0098] S214. CAN TP312 calls a timing function in response to receiving the confirmation flag corresponding to CF2.

[0099] S215 , when the CAN TP312 determines that the return value returned by the timing function corresponding to CF2 indicates that the timing is completed, the CAN TP312 sends the sequence frame CF3 to the CAN Driver314 .

[0100] S216 , CAN Driver 314 converts the data included in the sequence frame CF3 into a voltage signal and sends it to ECU 320 via the CAN bus.

[0101] In the disclosed embodiment, after STmin is determined by parsing the process control frame at the data transmission layer, STmin is input into the timing function, and the timing function is called after the first sequence frame is sent. After the timing is completed, the second sequence frame is sent to the bus. This ensures that the sending time interval between the two sequence frames is greater than STmin, thereby ensuring that data transmission will not lose frames.

[0102] Based on the same inventive concept, Figure 4 40 is a block diagram of a CAN bus data sending device 40 according to an exemplary embodiment. The device 40 may be a part of a CAN TP unit of a domain controller. As shown in FIG40 , the device 40 includes:

[0103] A first sending module 41 is used for, in response to receiving data distributed by the routing unit, assembling the data into pieces to obtain frame data, and sending a first frame of the frame data to a CAN bus, so that the electronic control unit receives the first frame through the CAN bus;

[0104] A parsing module 42, configured to parse STmin from a flow control frame upon receiving the flow control frame, and input the STmin into a timing function, wherein the flow control frame is sent by the electronic control unit in response to receiving the first frame;

[0105] A second sending module 43, used for sending a first sequence of frames in the frame data to a CAN bus, so that the electronic control unit receives the first sequence of frames through the CAN bus;

[0106] a timing module 44, configured to call the timing function upon receiving a first confirmation mark, wherein the first confirmation mark is sent by the electronic control unit in response to receiving the first sequence frame;

[0107] The third sending module 45 is used to send the second sequence of frames in the frame data to the CAN bus when the return value of the timing function indicates that the timing is completed, so that the electronic control unit receives the second sequence of frames through the CAN bus.

[0108] Optionally, the domain controller further includes a cache unit and a CAN driver unit, and the third sending module 45 is specifically used for:

[0109] Determine whether the storage space of the cache unit is empty;

[0110] When it is determined that the storage space of the cache unit is not empty, the second sequence frame is sent to the cache unit, and the cache unit can send the second sequence frame in the storage space of the cache unit to the CAN driver unit when the CAN bus is idle;

[0111] When it is determined that the storage space of the cache unit is empty, the second sequence of frames is sent to the CAN driver unit.

[0112] Optionally, the frame data includes a plurality of sequence frames in addition to the first sequence frames and the second sequence frames, and the timing module 44 is further used for:

[0113] calling the timing function in the case of receiving an Nth confirmation flag, wherein the Nth confirmation flag is sent by the electronic control unit in response to receiving the Nth sequence frame;

[0114] The device also includes:

[0115] A fourth sending module, when the return value of the timing function indicates that the timing is completed, sends the N+1th sequence frame of the frame data to the CAN bus;

[0116] Wherein, N is any natural number greater than 1 and less than the total number of the sequence frames.

[0117] Optionally, the first sending module 41 is specifically configured to:

[0118] In response to receiving data distributed by the router, determining whether the data needs to be fragmented;

[0119] In the case where the data needs to be fragmented, the data is fragmented and assembled to obtain frame data, and the first frame of the frame data is sent to the CAN bus;

[0120] When the data does not need to be segmented, the data is converted into single-frame data, and the single-frame data is sent to the CAN bus.

[0121] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0122] Figure 5 FIG. 5 is a block diagram of an electronic device 500 according to an exemplary embodiment. Figure 5 As shown, the electronic device 500 may include: a processor 501 and a memory 502. The electronic device 500 may also include one or more of an input / output (I / O) interface 503 and a communication component 504.

[0123] The processor 501 is used to control the overall operation of the electronic device 500 to complete all or part of the steps in the above-mentioned CAN bus data transmission method. The memory 502 is used to store various types of data to support the operation of the electronic device 500, and these data may include, for example, instructions for any application or method used to operate on the electronic device 500, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 502 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The I / O interface 503 provides an interface between the processor 501 and other interface modules, and the above-mentioned other interface modules can be a keyboard, a mouse, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 504 is used for wired or wireless communication between the electronic device 500 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 504 may include: Wi-Fi module, Bluetooth module, NFC module, etc.

[0124] In an exemplary embodiment, the electronic device 500 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned CAN bus data sending method.

[0125] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned CAN bus data sending method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 502 including program instructions, and the above-mentioned program instructions can be executed by the processor 501 of the electronic device 500 to complete the above-mentioned CAN bus data sending method.

[0126] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device. The computer program has a code portion for executing the above-mentioned CAN bus data transmission method when executed by the programmable device.

[0127] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0128] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.

[0129] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.

Claims

1. A CAN bus data sending method, characterized in that: The method is applied to a CAN TP unit of a domain controller, and the method comprises: In response to receiving the data distributed by the routing unit, the data is segmented and assembled to obtain frame data, and a first frame of the frame data is sent to a CAN bus, so that the electronic control unit receives the first frame through the CAN bus; In the case of receiving a flow control frame, parsing STmin according to the flow control frame, and inputting the STmin into a timing function, wherein the flow control frame is sent by the electronic control unit in response to receiving the first frame; and Sending a first sequence of frames in the frame data to a CAN bus, so that an electronic control unit receives the first sequence of frames through the CAN bus; calling the timing function in the case of receiving a first confirmation flag, the first confirmation flag being sent by the electronic control unit in response to receiving the first sequence of frames; When the return value of the timing function indicates that the timing is completed, sending the second sequence of frames in the frame data to the CAN bus, so that the electronic control unit receives the second sequence of frames through the CAN bus; The domain controller further includes a cache unit and a CAN driver unit, and when the return value of the timing function indicates that the timing is completed, sending the second sequence of frames in the frame data to the CAN bus includes: Determine whether the storage space of the cache unit is empty; When it is determined that the storage space of the cache unit is not empty, the second sequence frame is sent to the cache unit, and the cache unit can send the second sequence frame in the storage space of the cache unit to the CAN driver unit when the CAN bus is idle, so that the CAN driver unit converts the data in the second sequence frame into a voltage signal and sends it to the CAN bus; When it is determined that the storage space of the cache unit is empty, the second sequence of frames is sent to a CAN drive unit, so that the CAN drive unit converts the data in the second sequence of frames into voltage signals and sends them to a CAN bus.

2. The method according to any one of claim 1, characterized in that: The frame data includes a plurality of sequence frames in addition to the first sequence frames and the second sequence frames, and the method further includes: calling the timing function in the case of receiving an Nth confirmation flag, wherein the Nth confirmation flag is sent by the electronic control unit in response to receiving an Nth sequence frame; When the return value of the timing function indicates that the timing is completed, sending the N+1th sequence frame of the frame data to the CAN bus; Wherein, N is any natural number greater than 1 and less than the total number of the sequence frames.

3. The method according to any one of claim 1, characterized in that: In response to receiving the data distributed by the router, assembling the data into pieces to obtain frame data, and sending the first frame of the frame data to the CAN bus includes: In response to receiving data distributed by the router, determining whether the data needs to be fragmented; In the case where the data needs to be fragmented, the data is fragmented and assembled to obtain frame data, and the first frame of the frame data is sent to the CAN bus; When the data does not need to be segmented, the data is converted into single-frame data, and the single-frame data is sent to the CAN bus.

4. A CAN bus data sending device, characterized in that: The device is part of a CAN TP unit of a domain controller, and comprises: A first sending module, configured to, in response to receiving data distributed by the routing unit, assemble the data into pieces to obtain frame data, and send a first frame of the frame data to a CAN bus, so that the electronic control unit receives the first frame through the CAN bus; a parsing module, configured to parse STmin from a flow control frame upon receiving the flow control frame, and input the STmin into a timing function, wherein the flow control frame is sent by the electronic control unit in response to receiving the first frame; A second sending module, used for sending a first sequence of frames in the frame data to a CAN bus, so that an electronic control unit receives the first sequence of frames through the CAN bus; a timing module, configured to call the timing function upon receiving a first confirmation mark, wherein the first confirmation mark is sent by the electronic control unit in response to receiving the first sequence frame; A third sending module is used for sending a second sequence of frames in the frame data to a CAN bus when the return value of the timing function indicates that the timing is completed, so that the electronic control unit receives the second sequence of frames through the CAN bus; The domain controller further includes a cache unit and a CAN driver unit, and the third sending module is specifically used for: Determine whether the storage space of the cache unit is empty; When it is determined that the storage space of the cache unit is not empty, the second sequence frame is sent to the cache unit, and the cache unit can send the second sequence frame in the storage space of the cache unit to the CAN driver unit when the CAN bus is idle; When it is determined that the storage space of the cache unit is empty, the second sequence of frames is sent to the CAN driver unit.

5. The device according to any one of claims 4, characterized in that: The frame data includes a plurality of sequence frames in addition to the first sequence frame and the second sequence frame, and the timing module is further used for: calling the timing function in the case of receiving an Nth confirmation flag, wherein the Nth confirmation flag is sent by the electronic control unit in response to receiving an Nth sequence frame; The device also includes: A fourth sending module, when the return value of the timing function indicates that the timing is completed, sends the N+1th sequence frame of the frame data to the CAN bus; Wherein, N is any natural number greater than 1 and less than the total number of the sequence frames.

6. The device according to any one of claims 4, characterized in that: The first sending module is specifically used for: In response to receiving data distributed by the router, determining whether the data needs to be fragmented; In the case where the data needs to be fragmented, the data is fragmented and assembled to obtain frame data, and the first frame of the frame data is sent to the CAN bus; When the data does not need to be segmented, the data is converted into single-frame data, and the single-frame data is sent to the CAN bus.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 3 are implemented.

8. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Communication apparatus, transmitting method and receiving method

    CN102315922A

  • UDS network layer protocol implementation method, computer readable storage medium and computer equipment

    CN110474950A