Data unvarnished transmission method and device, electronic equipment and storage medium

By listening to the CAN bus and encapsulating CAN data in a specific protocol format, the problem of high data transmission resource consumption between the MCU and the SOC is solved, which improves development efficiency and simplifies protocol development.

CN119690879APending Publication Date: 2025-03-25BEI DOU ZHI LIAN KE JI YOU XIAN GONG SI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411766437.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The existing data transmission method between MCU and SOC requires a lot of resources and time-consuming, resulting in low development efficiency of on-board software.

Method used

By monitoring the CAN bus, new CAN data is obtained, data length is queried, packaged according to the set protocol format, and the packaged transparent data packet is transmitted to the system-level chip.

Benefits of technology

This greatly reduces the resources consumed during data transmission, improves the development efficiency of on-board software, and simplifies the development of transmissive protocols.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690879A_ABST
    Figure CN119690879A_ABST
Patent Text Reader

Abstract

The invention provides a data unvarnished transmission method and device, electronic equipment and a storage medium, and belongs to the field of data processing. The method comprises the following steps: monitoring a can bus to obtain new can data reported by the can bus; querying the data length of the new can data from a preset array, and obtaining the packaged length of the new can data based on the data length; packaging the new can data according to a set protocol format, putting a transparent transmission data segment obtained by packaging into a first cache, and writing the length after packaging into a second cache; when a reporting task is reached, obtaining an unvarnished transmission data packet according to all data in the second cache and the first cache; and transmitting the unvarnished transmission data packet to the system-on-chip. Therefore, when the reporting task is reached, the received can data are packaged into the same unvarnished transmission data packet to be unvarnished transmitted to the SOC, and a certain can signal under each can id does not need to be independently taken out, classified and reported to the SOC, so that the data unvarnished transmission efficiency is greatly improved, and the resource consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a data transparent transmission method, device, electronic device and storage medium. Background Art

[0002] With the continuous update of the automobile industry, the appearance, interior, entertainment and information systems of automobiles are also rapidly updated. Among them, the CAN bus plays a pivotal role in the communication mode of automobiles. The CAN bus data brings great convenience to the data interaction between various controllers of the automobile.

[0003] At present, the information transparent transmission process between the microcontroller unit (MCU) and the system-on-chip (SOC) of the car includes: (1) SOC sends CAN data signals to MCU; (2) MCU reports CAN data signals to SOC. However, this existing data transparent transmission method between MCU and SOC consumes a lot of resources of MCU and SOC, and is time-consuming and labor-intensive, resulting in a significantly lower efficiency in the development of vehicle-mounted software. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a data transparent transmission method, device, electronic device and storage medium, which greatly reduces the resources consumed during data transparent transmission and helps to greatly improve the development efficiency of vehicle-mounted software.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

[0006] In a first aspect, the present invention provides a data transparent transmission method, which is applied to a controller, wherein the controller is respectively connected to a CAN bus and a system-level chip for communication, and the method comprises:

[0007] Monitor the CAN bus to obtain new CAN data reported by the CAN bus;

[0008] Querying the data length of the new CAN data from a preset array, and obtaining the encapsulated length of the new CAN data based on the data length;

[0009] According to the set protocol format, the new CAN data is encapsulated, the transparent transmission data segment obtained by encapsulation is placed in the first cache, and the encapsulated length is written into the second cache;

[0010] When the reporting task is reached, a transparent transmission data packet is obtained according to all the data in the second cache and the first cache;

[0011] The transparent transmission data packet is transparently transmitted to the system-level chip.

[0012] Optionally, after the step of monitoring the CAN bus to obtain new CAN data reported by the CAN bus and before the step of querying the data length of the new CAN data from a preset array, the method further includes:

[0013] Extracting backup CAN data having the same CAN ID as the new CAN data from the backup library;

[0014] Comparing whether the backup CAN data and the new CAN data are the same;

[0015] If not, query the reporting method of the new CAN data from the method array;

[0016] When the reporting method is the first method, the new CAN data is updated to the backup library.

[0017] Optionally, after the step of querying the reporting mode of the CAN data from the mode array, the method further includes:

[0018] When the reporting mode is the second mode, obtaining the CAN ID of the new CAN data, and setting a change flag of the CAN ID;

[0019] When the reporting period of the second mode is reached, all CAN data corresponding to the CANID of the change flag are obtained from the CAN bus as the CAN data to be transparently transmitted;

[0020] Calculate the encapsulated length of each of the CAN data to be transparently transmitted, and encapsulate and splice each of the CAN data to be transparently transmitted according to the protocol format to obtain a transparent transmission data packet;

[0021] The transparent transmission data packet is transparently transmitted to the system-level chip, and the change flag of the can id is cleared.

[0022] Optionally, the step of obtaining a transparent transmission data packet according to all data in the second cache and the first cache includes:

[0023] Counting the total number of the encapsulated lengths in the second cache to obtain the number of transparently transmitted data;

[0024] The transparent transmission data segments in the first cache are concatenated according to the order in which they are put in, to obtain a transparent transmission data packet.

[0025] Optionally, after the step of monitoring the CAN bus to obtain new CAN data reported by the CAN bus, the method further includes:

[0026] When the time since the last time CAN data was received from the CAN bus exceeds the upper limit of the time, a transparent transmission data packet about the lost CAN ID is encapsulated according to the protocol format, and the transparent transmission data packet is transparently transmitted to the system-level chip.

[0027] Optionally, the method further comprises:

[0028] When receiving the CAN data sent by the system-level chip, the CAN data is parsed according to the protocol format to obtain the CAN channel number and data content;

[0029] Assign the data content to the sending buffer corresponding to the channel number;

[0030] When the sending state is met, the data content in the sending buffer is sent to the CAN channel corresponding to the CAN channel number in the CAN bus.

[0031] Optionally, the transparent transmission data segment includes a CAN ID presence flag, a CAN data length, a CAN channel number, a CAN ID and CAN data connected in sequence.

[0032] In a second aspect, the present invention provides a data transparent transmission device, which is applied to a controller, wherein the controller is respectively connected to a CAN bus and a system-level chip for communication, and the data transparent transmission device includes a monitoring module, a length acquisition module, a cache module, a splicing module and a transparent transmission module;

[0033] The monitoring module is used to monitor the CAN bus to obtain new CAN data reported by the CAN bus;

[0034] The length acquisition module is used to query the data length of the new CAN data from a preset array, and obtain the encapsulated length of the new CAN data based on the data length;

[0035] The cache module is used to encapsulate the new CAN data according to the set protocol format, put the encapsulated transparent data segment into the first cache, and write the encapsulated length into the second cache;

[0036] The splicing module is used to obtain a transparent transmission data packet according to all the data in the second cache and the first cache when a reporting task is reached;

[0037] The transparent transmission module is used to transparently transmit the transparent transmission data packet to the system-level chip.

[0038] In a third aspect, the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program that can be executed by the processor, and the processor can execute the computer program to implement the data transparent transmission method as described in the first aspect.

[0039] In a fourth aspect, the present invention provides a storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the data transparent transmission method as described in the first aspect.

[0040] The data transparent transmission method, device, electronic device and storage medium provided by the embodiment of the present invention include: monitoring the CAN bus to obtain new CAN data reported by the CAN bus; querying the data length of the new CAN data from a preset array, and obtaining the encapsulated length of the new CAN data based on the data length; encapsulating the new CAN data according to the set protocol format, putting the encapsulated transparent transmission data segment into the first cache, and writing the encapsulated length into the second cache; when the reporting task is reached, obtaining a transparent transmission data packet based on all the data in the second cache and the first cache; transparently transmitting the transparent transmission data packet to the system-level chip. In this way, when the reporting task is reached, the received CAN data are packaged into the same transparent transmission data packet and transparently transmitted to the SOC, without the need to separately take out and classify a certain CAN signal under each CAN ID and report it to the SOC, which greatly improves the efficiency of data transparent transmission and reduces resource consumption.

[0041] In addition, each CAN data can be reported in the first mode, the second mode, etc., which improves the flexibility of reporting CAN data content and helps to improve software development efficiency.

[0042] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0044] Figure 1 A block diagram of a data transparent transmission system provided by an embodiment of the present invention is shown.

[0045] Figure 2 A block diagram of an electronic device provided by an embodiment of the present invention is shown.

[0046] Figure 3One of the flow charts of the data transparent transmission method provided by an embodiment of the present invention is shown.

[0047] Figure 4 The second flowchart of the data transparent transmission method provided by the embodiment of the present invention is shown.

[0048] Figure 5 The third flowchart of the data transparent transmission method provided by the embodiment of the present invention is shown.

[0049] Figure 6 A fourth flow chart of the data transparent transmission method provided in an embodiment of the present invention is shown.

[0050] Figure 7 Shows Figure 3 and Figure 2 Schematic diagram of the process of some sub-steps of step 17.

[0051] Figure 8 The fifth flowchart of the data transparent transmission method provided in the embodiment of the present invention is shown.

[0052] Fig. 9 A block diagram of a data transparent transmission device provided by an embodiment of the present invention is output.

[0053] Explanation of the accompanying drawings: 10-data transparent transmission system; 110-controller; 120-can bus; 130-system-level chip; 140-functional subsystem; 20-electronic device; 210-memory; 220-processor; 230-communication module; 30-data transparent transmission device; 310-monitoring module; 320-length acquisition module; 330-cache module; 340-splicing module; 350-transparent transmission module. DETAILED DESCRIPTION

[0054] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0055] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0056] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0057] The data transparent transmission method provided in the embodiment of the present invention can be applied to Figure 1 In the data transmission system 10 shown, the data transmission system 10 includes a controller 110, a CAN bus 120 and a system-on-chip 130 (ie, SOC), and the controller 110 is connected to the CAN bus 120 and the system-on-chip 130 respectively.

[0058] The controller 110, the CAN bus 120 and the system-level chip 130 may be arranged on the same device (such as a car, etc.), and the controller 110 communicates with each functional subsystem 140 of the device through the CAN bus 120. For example, when the device is a vehicle, the controller 110 communicates with the battery management system, anti-lock braking system, electronic parking brake system, air conditioning system, instrument, airbag system, sensor, etc. of the vehicle through the CAN bus 120.

[0059] When a task of triggering data reporting (such as reaching a state feedback cycle, or complete control requiring feedback) is triggered, each functional subsystem 140 transmits the reported CAN data to the CAN bus 120, so that the controller 110 receives the CAN data from the CAN bus 120. When the system-level chip 130 triggers a task of sending (such as requiring real-time updates to reflect the current state of at least one functional subsystem 140 of the device, receiving a request of at least one functional subsystem 140 transparently transmitted by the controller 110), the system-level chip 130 sends the CAN data to the controller 110, so that the controller 110 sends the CAN data to the corresponding functional subsystem 140 through the CAN bus 120.

[0060] The controller 110 also pre-stores a can id array and a can id length array, which are arrays compiled according to a can matrix table.

[0061] The can id array (CanIdRevData[]) stores all can ids received by the controller 110, and the can ids are arranged in descending order.

[0062] The can id length array (CanIdRevDataLen[]) stores multiple data lengths, and each data length corresponds to the order of the can id array. The data length corresponding to the can id represents the data length of the can data with the can id received by the controller 110 from the can bus 120.

[0063] Among them, the controller 110 is used to implement the data transparent transmission method provided by the embodiment of the present invention, so as to transparently transmit the CAN data received from the CAN bus 120 to the system-level chip 130, and to send the CAN data sent by the system-level chip 130 to the corresponding functional subsystem 140.

[0064] It should be noted that the controller 110 may be an MCU.

[0065] Please refer to Figure 2 , is a block diagram of an electronic device 20, which may be Figure 1 The controller 110 in the data transparent transmission system 10 is shown. The electronic device 20 includes a memory 210, a processor 220 and a communication module 230. The memory 210, the processor 220 and the communication module 230 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0066] The memory 210 is used to store programs or data and can be, but not limited to, a random access memory, a read-only memory, a programmable read-only memory, an erasable read-only memory, an electrically erasable read-only memory, and the like.

[0067] The processor 220 is used to read / write data or programs stored in the memory 210 and execute corresponding functions. For example, Figure 1 In the data transparent transmission system 10 shown, the processor 220 of the controller 110 reads the computer program stored in the memory 210 to implement the data transparent transmission method provided by the embodiment of the present invention.

[0068] The communication module 230 is used to establish a communication connection between the electronic device 20 and other communication terminals, and to send and receive data. Figure 1 In the data transmission system 10 shown, the controller 110 can transmit and receive data with the CAN bus 120 and the system-level chip 130 respectively.

[0069] It should be understood that Figure 2 The structure shown is only a schematic diagram of the structure of the electronic device 20. The electronic device 20 may also include Figure 2 More or fewer components as shown, or with Figure 2 Different configurations are shown. Figure 2 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0070] In order to solve the problem that the existing data transmission between MCU and SOC consumes a lot of resources, is time-consuming and labor-intensive, and leads to low software development efficiency, refer to Figure 3 , the embodiment of the present invention provides a data transparent transmission method, comprising steps 11 to 17. Figure 1 In the data transparent transmission method shown, the processing device can Figure 2 The structure shown implements step 11 to step 19 when the processor 220 executes the computer program stored in the memory 210.

[0071] Step 11: monitor the CAN bus to obtain new CAN data reported by the CAN bus.

[0072] Step 13, query the data length of the new CAN data from the preset array, and obtain the encapsulated length of the new CAN data based on the data length.

[0073] Step 15, encapsulate the new CAN data according to the set protocol format, put the encapsulated transparent data segment into the first cache, and write the encapsulated length into the second cache.

[0074] Step 17, when the reporting task is reached, a transparent transmission data packet is obtained based on all the data in the second cache and the first cache.

[0075] Step 19, transparently transmit the transparent data packet to the system-level chip.

[0076] Among them, the first cache and the second cache both follow the first-in-first-out. The protocol format can be: CAN ID existence flag + CAN data length + CAN channel number + CAN ID + CAN data. Here, the CAN ID existence flag, CAN data length and CAN channel number are all 1 byte. If the CAN ID is 2 bytes, the encapsulated length = CAN data length + 5. It should be noted that the CAN ID existence flag, CAN data length, CAN channel number and CAN ID length are only examples, which vary with different application scenarios or format definitions. However, for the same protocol format, the CAN ID existence flag, CAN data length, CAN channel number and CAN ID length are fixed values. For example, when the total length of the CAN ID existence flag, CAN data length, CAN channel number and CAN ID is 5 bytes, if the length of the first CAN data is 8 and the length of the second CAN data is 16, the length of the first CAN data after encapsulation is 8+5=13 bytes, and the length of the second CAN data after encapsulation is 16+5=21 bytes.

[0077] For example, in combination Figure 1 In the data transparent transmission system 10 shown, the controller 110 monitors the CAN bus 120 in real time to obtain new CAN data reported by the CAN bus 120. When the controller 110 receives a new CAN data from the CAN bus 120, it performs a traversal query in the CAN ID array (i.e., the CanIdRevData array) according to the CAN ID of the new CAN data. When the same CAN ID is found, the data length pointed to by the index of the CAN ID in the CAN ID array is obtained from the CAN ID length array (i.e., the CanIdRevDataLen array), and the data length is used as the data length of the new CAN data.

[0078] Furthermore, the controller 110 obtains the newly added length during encapsulation according to the set protocol format, and then combines the data length to obtain the encapsulated length of the new CAN data. Next, the controller 110 puts the encapsulated length into the second cache, and encapsulates the new CAN data according to the set protocol format, and puts the encapsulated transparent data segment into the first cache. It should be understood that the length of the transparent data segment of the first cache is the encapsulated length of the transparent data segment in the second cache with the same position order. For example, the first encapsulation length in the second cache is 13 bytes, which means that the length of the first transparent data segment in the first cache is 13 bytes.

[0079] The controller 110 repeatedly executes the above two processes to prepare the cache of the CAN data received from the CAN bus 120 before transparent transmission.

[0080] When a reporting task is reached, such as a reporting period or a data upload request of the SoC 130, the controller 110 obtains a transparent data packet based on all data in the second cache and the first cache, and then transparently transmits the transparent data packet to the SoC 130 through the SPI interface.

[0081] In the existing data transparent transmission method between MCU and SOC, it is necessary to extract and classify a certain CAN signal under each CAN ID according to the requirement document and report it to SOC separately. For example, the signal of air conditioning control is combined by SOC with switch signals such as air volume control, temperature control, wind direction control, and air conditioning control on and off in one or more protocols. When the user sets a function of such signals, SOC sends all such signals to MCU, and MCU splits out such signals one by one and assigns them to the corresponding CAN signal and sends them to the CAN bus. After the corresponding controller feeds back the signal, MCU combines the air volume feedback, temperature feedback, wind direction feedback, air conditioning on and off feedback and other signals in one or more protocols and reports them to SOC, which displays the corresponding interface. This transparent transmission method consumes a lot of resources of SOC and MCU, which is time-consuming and labor-intensive. In addition, when developing software, it is necessary to develop multiple transparent transmission protocols, resulting in a long development cycle and low development efficiency.

[0082] In the above data transparent transmission method provided by the embodiment of the present invention, when the reporting task is achieved, the received CAN data is packaged into the same transparent transmission data packet and transparently transmitted to the SOC, and there is no need to separately extract and classify a certain CAN signal under each CAN ID and report it to the SOC, which reduces the amount of transparent transmission messages, greatly improves the efficiency of data transparent transmission, and reduces resource consumption. In addition, the transparent transmission protocol development in the development process can be optimized, thereby greatly shortening the development cycle and improving development efficiency.

[0083] In order to further reduce resource consumption and improve the flexibility of data transparent transmission, the data transparent transmission method provided in the embodiment of the present invention introduces the idea of ​​transparent transmission only when the can data changes. Figure 4 The data transparent transmission method includes steps 21 to 27. At this time, steps 21 to 27 are performed after step 11 and before step 13.

[0084] Step 21, extracting backup CAN data having the same CAN ID as the new CAN data from the backup library.

[0085] Step 23, compare the backup CAN data and the new CAN data to see if they are the same. If not, execute step 25, if not, discard the new CAN data, or do not process the new CAN data.

[0086] Step 25, query the new reporting method of CAN data from the method array.

[0087] Step 27: When the reporting method is the first method, the new CAN data is updated to the backup library.

[0088] It should be noted that the method array stores the reporting methods corresponding to each CAN ID created during the development process or after the product is launched, according to development requirements or user-defined methods. The backup library backs up the latest CAN data of each CAN ID (i.e. the last reported CAN data). In addition, the first method can be called event method, or any other name.

[0089] Through the above steps, when the reporting mode of the received new CAN data is the first mode and the new CAN data is different from the CAN data with the same CAN ID that was last transparently transmitted to the system-level chip 130, the new CAN data and the corresponding encapsulated length are respectively placed in the first cache and the second cache, so that when the reporting task is reached, they are encapsulated and spliced ​​with other CAN data to be transparently transmitted and then reported to the system-level chip 130. In this way, the consumption of resources such as the cache space of the first cache and the second cache, and the sending resources during transparent transmission reporting, is further reduced.

[0090] In order to further improve the flexibility of data transparent transmission and reduce resource consumption, the idea is to report only when the data introduced by data transparent transmission has changed and reaches the reporting cycle. Figure 5 , after the above step 25, steps 31 to 37 may also be included.

[0091] Step 31: When the reporting mode is the second mode, obtain the CAN ID of the new CAN data and set the change flag of the CANID.

[0092] Step 33, when the reporting cycle of the second mode is reached, all CAN data corresponding to the CAN ID of the change mark are obtained from the CAN bus as the CAN data to be transparently transmitted.

[0093] Step 35, calculate the encapsulated length of each CAN data to be transparently transmitted, and encapsulate and splice each CAN data to be transparently transmitted according to the protocol format to obtain a transparent transmission data packet.

[0094] Step 37, transparently transmit the transparent data packet to the system-level chip, and clear the change flag of the can id.

[0095] The reporting period of the second mode can be flexibly set, for example, it can be 50ms, 100ms, or 200ms, and its specific value is not limited.

[0096] It should be noted that the second method can also be called a cycle method, or any other name, and the name is not limited.

[0097] Through the above steps 31 to 37, when the reporting mode of the received new CAN data is the first mode, and the new CAN data is changed compared with the CAN data with the same CAN ID that was last transparently transmitted to the system-level chip 130, a change flag is set with the CAN ID of the new CAN data, so that when the reporting cycle of the second mode is reached, the CAN data corresponding to the CAN ID of each change flag is obtained from the CAN bus 120, and the CAN data are packaged and spliced ​​for combined reporting to the system-level chip 130. In this way, the consumption of resources such as the cache space of the first cache and the second cache, and the sending resources during transparent transmission reporting, is further reduced.

[0098] When adopting the above-mentioned reporting method of step 11 to step 19 (i.e., all new CAN data will be reported), the reporting method of step 21 to step 17 and step 11 to step 19 (i.e., only reporting CAN data with data changes) (i.e., the first method), and the reporting method of step 31 to step 37) (i.e., the second method), all CAN data to be reported are packaged and spliced, and then reported to the system-level chip 130 in a transparent transmission data packet. In addition, the same protocol format, i.e., the same message protocol, is adopted, so that when developing software, there is no need to develop multiple protocols, which reduces the complexity of development and effectively improves the development efficiency.

[0099] After receiving a new CAN message, in the packaging and splicing of the CAN message to be reported, multiple reporting methods all use the same protocol format to reduce development complexity. In order to further reduce development complexity and improve the transparent transmission efficiency between the controller 110 and the system-level chip 130, when the CAN ID is lost, the idea of ​​reporting the loss of the CAN ID to the system-level chip 130 in the same protocol format is introduced. Figure 6 The data transparent transmission method provided by the present invention also includes step 12 after step 11.

[0100] Step 12: When the time from the last time CAN data was received from the CAN bus exceeds the upper limit of the time, encapsulate the transparent transmission data packet about the lost CAN ID according to the protocol format, and transparently transmit the transparent transmission data packet to the system-level chip.

[0101] The upper limit of the duration may be a multiple of the reporting period, for example, 10 times, 5 times, etc. The upper limit of the duration may also be the reporting period itself.

[0102] It should be noted that the protocol format not only specifies the encapsulation format and splicing method when there is CAN data to be reported, but also specifies the encapsulation format when the CAN ID is lost.

[0103] In addition, one or more reporting modes may exist simultaneously in a data transparent transmission system 10. For example, different reporting modes may be configured for each CAN data according to different functional subsystems 140 or importance.

[0104] When there are multiple reporting methods in the data transmission system 10, it is very easy for a component such as the functional subsystem 140 to be damaged so that there is no CAN data of the component on the CAN bus 120 (that is, the CAN ID corresponding to the damaged component is lost), while other CAN data is received normally.

[0105] In order to enable the system-level chip 130 to know which CAN IDs are lost in time, different time limit values ​​can be set for different reporting methods (such as the reporting method of steps 11 to 19 alone, the second method and the first method, etc.). And for each reporting method, when the time length of the last CAN data corresponding to the reporting method is received from the CAN bus 120, it exceeds the time limit value of the reporting method, according to the protocol format, the transparent transmission data packet about the loss of the CAN ID of the reporting method is encapsulated, and the transparent transmission data packet is transparently transmitted to the system-level chip 130 through the SPI interface.

[0106] Among them, the encapsulated transparent data packet about the can id loss of this reporting method may contain information such as the flag of this reporting method.

[0107] Thus, when the system-on-chip 130 receives a transparent data packet with a CAN ID loss flag, it can quickly locate which CAN IDs are lost based on the reporting mode flag in the transparent data without affecting other normally transmitted and received CAN data.

[0108] Here, the setting of the protocol format can be flexibly selected. For example, all the CAN data to be transmitted can be spliced ​​in sequence and then packaged together, or the CAN data to be transmitted can be packaged and then spliced ​​in sequence. The above method is only an example, and its implementation method is not limited.

[0109] In addition, in order to further optimize the CAN message protocol to shorten the software development cycle and improve efficiency, and at the same time facilitate the system-level chip 130 to accurately parse the uploaded transparent transmission data packet, in the data transparent transmission method provided by the present invention, the protocol format stipulates that the encapsulated content of a CAN data is used as a transparent transmission data segment of the transparent transmission data packet, and each transparent transmission data segment includes a CAN ID existence flag, CAN data length, CAN channel number, CAN ID and CAN data connected in sequence.

[0110] Taking the can id existence flag including 0 (indicating can id does not exist) and 1 (indicating can id exists) as an example, when there are three can data to be uploaded, the overall content of the transparent transmission data packet is: can id existence flag 1 + can data length 1 + can channel number 1 + can id1 + can data 1 / can id existence flag 2 + can data length 2 + can channel number 2 + can id2 + can data 2 / can id existence flag 3 + can data length 3 + can channel number 3 + can id3 + can data 3. At this time, can id existence flag 1, can id existence flag 2 and can id existence flag 3 are all 1.

[0111] When no CAN data is received, and the time since the last CAN data was received from the CAN bus 120 exceeds the time limit, the controller 110 encapsulates the transparent data packet. At this time, the structure of each transparent data segment of the transparent data packet is also: CAN ID existence flag + CAN data length + CAN channel number + CAN ID + CAN data, but the CAN ID existence flag is 0, and the CAN data segment is empty, error data, or the last received CAN data. When the SOC receives and parses the transparent data packet, once the CAN ID existence flag is parsed to be 0, the CAN ID is parsed to determine the non-existent CAN ID, and the parsing is stopped, and the subsequent CAN data is no longer parsed.

[0112] By setting the above protocol format, when the CAN data and CAN ID of each reporting method are lost, the protocols of the transparent data packets assembled and reported are the same, which greatly reduces the development complexity, shortens the project development cycle, and accelerates the software development efficiency.

[0113] The process of obtaining the transparent transmission data packet in step 17 above is as follows: Figure 7 , may include steps 171 to 173.

[0114] Step 171, counting the total number of encapsulated lengths in the second cache to obtain the number of transparently transmitted data.

[0115] For example, if four encapsulated lengths are stored in the second cache, it means that there are four independent transparent transmission data segments in the subsequent transparent transmission data packet.

[0116] Step 173, in accordance with the order of placement, the transparent transmission data segments in the first cache are spliced ​​to obtain a transparent transmission data packet. After the above steps 171 to 173, in step 19, the controller first adds an SPI layer to the transparent transmission data packet, the SPI is written with the number of transparent transmission data, and the transparent transmission data packet with the added SPI layer is transparently transmitted to the system-level chip through the SPI interface. In this way, multiple Can ID data can be reported in one transparent transmission, which greatly improves the transmission rate of the Can data.

[0117] In order to further reduce the complexity of development, the protocol format (i.e., protocol) of the CAN data sent by the system-level chip 130 is set to be the same as the format of the transparent transmission data packet of the controller 110. Among them, since there is no CAN ID loss in the CAN data sent on the system-level chip 130 side, the CAN ID existence flag of the CAN data sent is set to a default value, which can be any value. For example, the default value can be 0xff or 1, which is not limited.

[0118] On the basis of the above, refer to Figure 8 The processing flow after the controller 110 receives the sent CAN data may include steps 41 to 45.

[0119] Step 41, when receiving the CAN data sent by the system-level chip, parse the sent CAN data according to the protocol format to obtain the CAN channel number and data content.

[0120] Step 43, assign the data content to the sending buffer corresponding to the channel number.

[0121] Step 45, when the sending state is met, the data content in the sending buffer is sent to the CAN channel corresponding to the CAN channel number in the CAN bus.

[0122] It should be noted that SOC will only send data related to one can ID at a time.

[0123] Through the above steps 41 to 45, when the MCU receives a whole package of CAN data sent by the SOC, the MCU first parses the sent CAN data according to the protocol format, that is, first take out the data length of the sent CAN data and store it in a variable (such as SocSendCanDataLen), then move back one byte to take out the CAN channel number, then move back one byte to take out the CAN ID (the CAN ID occupies 2 bytes), and then move back 2 bytes to take out the CAN data of the length corresponding to the SocSendCanDataLen variable. In this way, the content contained in the whole package of sent CAN data is parsed. Then, the MCU assigns the CAN data content of the corresponding CAN ID to the corresponding sending buffer according to the CAN channel number, and then the MCU's CAN driver code sends the CAN data to the CAN bus 120, and the CAN data can be forwarded.

[0124] Based on the same concept as the above data transparent transmission method, refer to Fig. 9 The embodiment of the present invention also provides a data transparent transmission device 30, which can be applied to Figure 1 The controller 110 of the data transparent transmission system 10 shown includes a monitoring module 310 , a length acquisition module 320 , a cache module 330 , a splicing module 340 and a transparent transmission module 350 .

[0125] The monitoring module 310 is used to monitor the CAN bus to obtain new CAN data reported by the CAN bus.

[0126] The length acquisition module 320 is used to query the data length of the new CAN data from the preset array, and obtain the encapsulated length of the new CAN data based on the data length.

[0127] The cache module 330 is used to encapsulate the new CAN data according to the set protocol format, put the encapsulated transparent data segment into the first cache, and write the encapsulated length into the second cache.

[0128] The splicing module 340 is used to obtain a transparent transmission data packet based on all the data in the second cache and the first cache when a reporting task is reached.

[0129] The transparent transmission module 350 is used to transparently transmit the transparent transmission data packet to the system-on-chip 130 .

[0130] Furthermore, the data transparent transmission device 30 also includes a backup module, a comparison module, a mode query module and a backup update module.

[0131] The backup module is used to extract backup CAN data having the same CAN ID as the new CAN data from the backup library.

[0132] The comparison module is used to compare whether the backup CAN data and the new CAN data are the same.

[0133] The method query module is used to query the new CAN data reporting method from the method array if they are different.

[0134] The backup update module is used to update the new CAN data to the backup library when the reporting method is the first method.

[0135] The data transparent transmission device 30 also includes a flag setting module and a data acquisition module.

[0136] The flag setting module is used to obtain the canid of the new can data and set the can id change flag when the reporting mode is the second mode.

[0137] The data acquisition module is used to acquire all CAN data corresponding to the CAN ID with the change mark from the CAN bus 120 when the reporting cycle of the second mode is reached, as the CAN data to be transparently transmitted.

[0138] The splicing module 340 is also used to calculate the encapsulated length of each CAN data to be transparently transmitted, and encapsulate and splice each CAN data to be transparently transmitted according to the protocol format to obtain a transparent transmission data packet.

[0139] The transparent transmission module 350 is further used to transparently transmit the transparent transmission data packet to the system-on-chip 130 and clear the change flag of the can id.

[0140] The splicing module 340 is also used to encapsulate the transparent transmission data packet about the loss of CAN ID according to the protocol format and transparently transmit the transparent transmission data packet to the system-level chip 130 when the time since the last CAN data was received from the CAN bus 120 exceeds the upper limit of the time.

[0141] In addition, the data transparent transmission device 30 also includes a parsing and sending module, which is used to: when receiving the sent CAN data from the system-level chip 130, parse the sent CAN data according to the protocol format to obtain the CAN channel number and data content; assign the data content to the sending buffer corresponding to the channel number; and when the sending status is met, send the data content in the sending buffer to the CAN channel corresponding to the CAN channel number in the CAN bus 120.

[0142] The above-mentioned data transparent transmission device 30, through the synergy of various modules, packs the received CAN data into the same transparent transmission data packet and transparently transmits it to the SOC when the reporting task is achieved. There is no need to separately extract and classify a CAN signal under each CAN ID and report it to the SOC, which greatly improves the efficiency of data transparent transmission and reduces resource consumption. In addition, each CAN data can be reported in the first mode, the second mode, etc., which improves the flexibility of reporting CAN data content and helps to improve software development efficiency.

[0143] The specific implementation and effect of the data transparent transmission device 30 can be found in the above description of the implementation of the data transparent transmission method, which will not be repeated here.

[0144] Each module of the above-mentioned data transparent transmission device 30 can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor 220 in the electronic device 20 in the form of hardware, or can be stored in the memory 210 of the electronic device 20 in the form of software, so that the processor 220 calls and executes the operations corresponding to the above modules to implement the data transparent transmission method provided above.

[0145] Based on the same inventive concept, an embodiment of the present invention further provides an electronic device 20, including a processor 220 and a memory 210, wherein the memory 210 stores a computer program that can be executed by the processor 220, and the processor 220 can execute the computer program to implement the data transparent transmission method provided above.

[0146] Based on the same inventive concept, an embodiment of the present invention further provides a storage medium on which a computer program is stored. When the computer program is executed by the processor 220, the data transparent transmission method provided above is implemented.

[0147] In summary, the data transparent transmission method, device, electronic device and storage medium provided by the embodiments of the present invention have at least the following beneficial effects:

[0148] (1) The transparent transmission data packet contains all the CAN information to be reported, without the need for classification, splitting and sorting, which saves the number of communication protocols between SOC and MCU, reduces resource consumption, and improves the data transmission rate;

[0149] (ii) There are multiple transparent transmission reporting methods, which can be selected according to project needs, greatly improving the flexibility of data transparent transmission;

[0150] (3) All types of CAN data use a unified protocol (i.e. protocol format), which simplifies development complexity, shortens project development cycle, and improves software development efficiency.

[0151] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0152] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0153] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk.

[0154] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data transparent transmission method, characterized in that: Applied to a controller, the controller is respectively connected to a CAN bus and a system-on-chip for communication, the method comprising: Monitor the CAN bus to obtain new CAN data reported by the CAN bus; Querying the data length of the new CAN data from a preset array, and obtaining the encapsulated length of the new CAN data based on the data length; According to the set protocol format, the new CAN data is encapsulated, the transparent transmission data segment obtained by encapsulation is placed in the first cache, and the encapsulated length is written into the second cache; When the reporting task is reached, a transparent transmission data packet is obtained according to all the data in the second cache and the first cache; The transparent transmission data packet is transparently transmitted to the system-level chip.

2. The data transparent transmission method according to claim 1, characterized in that: After the step of monitoring the CAN bus to obtain new CAN data reported by the CAN bus and before the step of querying the data length of the new CAN data from a preset array, the method further includes: Extracting backup CAN data having the same CAN ID as the new CAN data from the backup library; Comparing whether the backup CAN data and the new CAN data are the same; If not, query the reporting method of the new CAN data from the method array; When the reporting method is the first method, the new CAN data is updated to the backup library.

3. The data transparent transmission method according to claim 2, characterized in that: After the step of querying the reporting mode of the CAN data from the mode array, the method further includes: When the reporting mode is the second mode, obtaining the CAN ID of the new CAN data, and setting a change flag of the CAN ID; When the reporting period of the second mode is reached, all CAN data corresponding to the CAN ID of the change flag are obtained from the CAN bus as the CAN data to be transparently transmitted; Calculate the encapsulated length of each of the CAN data to be transparently transmitted, and encapsulate and splice each of the CAN data to be transparently transmitted according to the protocol format to obtain a transparent transmission data packet; The transparent transmission data packet is transparently transmitted to the system-level chip, and the change flag of the can id is cleared.

4. The data transparent transmission method according to any one of claims 1 to 3, characterized in that: The step of obtaining a transparent transmission data packet according to all the data in the second cache and the first cache comprises: Counting the total number of the encapsulated lengths in the second cache to obtain the number of transparently transmitted data; The transparent transmission data segments in the first cache are concatenated according to the order in which they are put in, to obtain a transparent transmission data packet.

5. The data transparent transmission method according to any one of claims 1 to 3, characterized in that: After the step of monitoring the CAN bus to obtain new CAN data reported by the CAN bus, the method further includes: When the time since the last time CAN data was received from the CAN bus exceeds the upper limit of the time, a transparent transmission data packet about the lost CAN ID is encapsulated according to the protocol format, and the transparent transmission data packet is transparently transmitted to the system-level chip.

6. The data transparent transmission method according to claim 1, characterized in that: The method further comprises: When receiving the CAN data sent by the system-level chip, the CAN data is parsed according to the protocol format to obtain the CAN channel number and data content; Assign the data content to the sending buffer corresponding to the channel number; When the sending state is met, the data content in the sending buffer is sent to the CAN channel corresponding to the CAN channel number in the CAN bus.

7. The data transparent transmission method according to claim 4, characterized in that: The transparent transmission data segment includes a CAN ID presence flag, a CAN data length, a CAN channel number, a CAN ID and CAN data connected in sequence.

8. A data transparent transmission device, characterized in that: Applied to a controller, the controller is respectively connected to a CAN bus and a system-level chip for communication, and the data transparent transmission device includes a monitoring module, a length acquisition module, a cache module, a splicing module and a transparent transmission module; The monitoring module is used to monitor the CAN bus to obtain new CAN data reported by the CAN bus; The length acquisition module is used to query the data length of the new CAN data from a preset array, and obtain the encapsulated length of the new CAN data based on the data length; The cache module is used to encapsulate the new CAN data according to the set protocol format, put the encapsulated transparent data segment into the first cache, and write the encapsulated length into the second cache; The splicing module is used to obtain a transparent transmission data packet according to all the data in the second cache and the first cache when a reporting task is reached; The transparent transmission module is used to transparently transmit the transparent transmission data packet to the system-level chip.

9. An electronic device, characterized in that: It comprises a processor and a memory, the memory stores a computer program that can be executed by the processor, and the processor can execute the computer program to implement the data transparent transmission method as described in any one of claims 1 to 7.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data transparent transmission method according to any one of claims 1 to 7 is implemented.