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

By dynamically configuring the data frame length in SPI data transmission, according to the data transmission requirements of the local and counter-end, the problems of low transmission efficiency and bandwidth waste caused by fixed data frame length in the prior art are solved, and more efficient data transmission is achieved.

CN119729398APending Publication Date: 2025-03-28FOSS (HANGZHOU) INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411751562.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the existing SPI data transmission method, the data frame length is fixed, which leads to the fixed length when the effective data volume is small, resulting in unnecessary waste of transmission time and bandwidth resources.

Method used

By obtaining the data transmission requirements of the local and peers on both available data channels, dynamically configure the data frame length. The specific method includes determining the data frame length based on the total amount of data to be transmitted and the data cache limit. If the total amount of data to be transmitted is less than or equal to the cache limit, a larger value is used as the frame length; if it exceeds, a cache limit is used as the frame length.

Benefits of technology

It realizes dynamic adjustment of data frame length based on actual data volume, improves data transmission efficiency, and avoids the waste of bandwidth resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119729398A_ABST
    Figure CN119729398A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data transmission method, device and system, electronic equipment and a storage medium, and relates to the technical field of communication, and the method comprises the steps: obtaining the data transmission demands of a home terminal and an opposite terminal on available data channels of the two parties; according to the obtained data transmission requirement, data transmission parameter configuration is carried out on available data channels of the two parties, and the parameters comprise the data frame length; and performing data transmission with the opposite terminal through the configured available data channel of the two parties. The embodiment of the invention can be applied to a scene of data transmission between the MCU and the SOC in the ECU in an automatic driving system, so as to solve the problems of low transmission efficiency and bandwidth resource waste caused by fixed data frame length in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the autonomous driving system, the ECU (Electronic Control Unit) is composed of an MCU (Microcontroller Unit) and a SOC (System on Chip) to process a variety of business data, including body signals, image data, and radar data. Among them, the MCU is responsible for processing body signals and radar data, while the SOC is responsible for processing image data. In order to achieve efficient data interaction between the MCU and the SOC, SPI (Serial Peripheral Interface) is usually used for data transmission. The SPI transmission method, due to its simple hardware design and low latency, can ensure stable and fast data flow between different modules, providing strong support for precise control and real-time response of autonomous driving.

[0003] However, in the existing SPI data transmission method, no matter how much data is actually transmitted, the data frame length is always set to the maximum frame length, so that even when the effective data volume is small, it is sent according to a fixed length. The extra padding data part not only takes up unnecessary transmission time, but also wastes bandwidth resources. Summary of the invention

[0004] In view of this, embodiments of the present invention provide a data transmission method, device, system, electronic device and storage medium to solve the problems of low transmission efficiency and waste of bandwidth resources caused by fixed data frame length in the prior art.

[0005] In a first aspect, an embodiment of the present invention provides a data transmission method, the method comprising: Obtain the data transmission requirements of the local end and the remote end on the available data channels of both parties; According to the acquired data transmission requirements, data transmission parameters are configured for the available data channels of both parties, wherein the parameters include the data frame length; Data is transmitted with the other end through the configured mutually available data channel.

[0006] Furthermore, the data transmission parameters are configured for the available data channels of both parties according to the acquired data transmission requirements, wherein the parameters include the data frame length, including: Determine and configure the data frame length of the data channel available to both parties based on the following: The total amount of data to be transmitted on the available data channels of both parties; The total amount of data to be transmitted by the other end on the available data channels of both parties; The data buffer limit of the data channel available to both parties.

[0007] Further, the determining and configuring the data frame length of the data channel available to both parties includes: If the total amount of data to be transmitted on the available data channels of both ends is less than or equal to the data buffer limit of the available data channels of both ends, then the data frame length of the available data channels of both ends is determined to be: the larger value of the total amount of data to be transmitted on the available data channels of both ends; If the total amount of data to be transmitted on the available data channel of both ends at at least one of the two ends is greater than the data buffer limit of the available data channel of both ends, the data frame length of the available data channel of both ends is determined to be: the data buffer limit of the available data channel of both ends.

[0008] Furthermore, before obtaining the data transmission demand of the opposite end on the mutually available data channel, the method further includes: establishing a connection with the opposite end based on the mutually available data channel; Obtaining the data transmission demand of the other end on the data channel available to both parties, including: after the connection is successfully established, triggering a data transmission request, and negotiating with the other end to obtain the data transmission demand of the other end on the data channel available to both parties.

[0009] Furthermore, there are multiple data channels available to both parties; The establishing of a connection with the other end based on the data channel available to both parties includes: Based on a data channel available to both parties, a connection is established with the other party, and other data channels available to both parties are negotiated during the connection process.

[0010] Furthermore, after negotiating other available data channels for both parties and before configuring data transmission parameters for the available data channels for both parties, the method further includes: Confirm the actual availability of the negotiated other mutually available data channels.

[0011] Furthermore, the local end is a slave end, and the opposite end is a master end; The triggering of the data transmission request includes: sending a data transmission request to the master end through a control channel; The negotiation with the other end to obtain the other end's data transmission requirements on the data channel available to both parties includes: receiving and participating in the data transmission requirement negotiation initiated by the master end according to the data transmission request through the negotiation channel, thereby obtaining the data transmission requirements of the master end on the data channel available to both parties.

[0012] Furthermore, after configuring the data transmission parameters for the available data channels of both parties and before transmitting data with the other end, the method further includes: According to the data transmission parameters configured for the available data channels of both parties, the following data preprocessing is performed: filling of the data to be transmitted at this end in the corresponding data frame; and cache application of the data to be transmitted at both ends.

[0013] Furthermore, the data transmission parameters also include data types; After the data transmission with the opposite end, the method further includes: processing the opposite end data according to the type of the received opposite end data.

[0014] In a second aspect, an embodiment of the present invention provides a data transmission device, the device comprising: a demand acquisition unit, configured to acquire data transmission demands of a local end and a peer end on data channels available to both parties; A channel configuration unit, used to configure data transmission parameters for the available data channels of both parties according to the acquired data transmission requirements, wherein the parameters include the data frame length; The data transmission unit is used to transmit data with the other end through the configured data channel available to both parties.

[0015] Furthermore, the channel configuration unit is specifically used to: Determine and configure the data frame length of the data channel available to both parties based on the following: The total amount of data to be transmitted on the available data channels of both parties; The total amount of data to be transmitted by the other end on the available data channels of both parties; The data buffer limit of the data channel available to both parties.

[0016] Furthermore, the channel configuration unit is specifically used to determine the data frame length of the data channel available to both parties, including: If the total amount of data to be transmitted on the available data channels of both ends is less than or equal to the data buffer limit of the available data channels of both ends, then the data frame length of the available data channels of both ends is determined to be: the larger value of the total amount of data to be transmitted on the available data channels of both ends; If the total amount of data to be transmitted on the available data channel of both ends at at least one of the two ends is greater than the data buffer limit of the available data channel of both ends, the data frame length of the available data channel of both ends is determined to be: the data buffer limit of the available data channel of both ends.

[0017] Further, the device also includes: a connection establishing unit, configured to establish a connection with the opposite end based on the data channels available to both parties; The demand acquisition unit includes: a peer demand acquisition subunit, which is used to trigger a data transmission request after the connection is successfully established, and negotiate with the peer to obtain the data transmission demand of the peer on the data channel available to both parties.

[0018] Furthermore, there are multiple data channels available to both parties; The connection establishment unit is specifically used to establish a connection with the other end based on a data channel available to both parties, and negotiate other data channels available to both parties during the connection process.

[0019] Furthermore, the demand acquisition unit also includes: The channel confirmation subunit is used to confirm the actual availability of the negotiated other available data channels for both parties after the other end demand acquisition subunit negotiates other available data channels for both parties and before the data transmission unit configures data transmission parameters for the available data channels for both parties.

[0020] Furthermore, the local end is a slave end, and the opposite end is a master end; the opposite end demand acquisition subunit is specifically used for: After the connection is successful, a data transmission request is sent to the master through the control channel; Through the negotiation channel, receive and participate in the data transmission requirement negotiation initiated by the master based on the data transmission request, and obtain the data transmission requirement of the master on the available data channels of both parties.

[0021] Furthermore, the local end is a slave end, and the opposite end is a master end; the device further comprises a preprocessing unit, which is used for, after the channel configuration unit configures data transmission parameters for the available data channels of both parties, and before the data transmission unit performs data transmission with the opposite end: According to the data transmission parameters configured for the available data channels of both parties, the following data preprocessing is performed: filling of the data to be transmitted at this end in the corresponding data frame; and cache application of the data to be transmitted at both ends.

[0022] Furthermore, the data transmission parameters also include a data type; the device also includes: a data processing unit, which is used to process the peer data according to the type of the received peer data after the data transmission unit transmits data with the peer.

[0023] In a third aspect, an embodiment of the present invention provides a data transmission system, the system comprising a master end and at least one slave end, wherein: The master end includes the data transmission device described in the second aspect above, except that the present end is a slave end; The slave end includes the data transmission device described in the second aspect above.

[0024] Furthermore, the master end and the slave end are respectively a microcontroller unit MCU and a system-on-chip SOC in an electronic control unit ECU in an autonomous driving system, or vice versa.

[0025] In a fourth aspect, an embodiment of the present invention provides an electronic device, comprising: a shell, a processor, a memory, a circuit board and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the data transmission method described in the first aspect above.

[0026] In a fifth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the data transmission method described in the first aspect above.

[0027] The technical solution of the embodiment of the present invention provides a demand-oriented frame length dynamic configuration strategy. By collecting the data transmission requirements of the local end and the opposite end, the strategy can accurately understand the actual demand conditions of the two ends during the data transmission process. Based on this, the data frame length can be flexibly configured. Specifically, when performing a large amount of data transmission, a longer data frame can be used to reduce the number of data transmissions and greatly improve the transmission efficiency; when transmitting a small amount of data, a shorter data frame is used to avoid excessive occupation of bandwidth resources, thereby optimizing bandwidth utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0029] Figure 1 A flowchart of a data transmission method provided in Embodiment 1 of the present invention; Figure 2 A flowchart of a data transmission method provided in Embodiment 2 of the present invention; Figure 3 A flowchart of a data transmission method provided in Embodiment 3 of the present invention; Figure 4 A schematic diagram of a data transmission system architecture provided in Embodiment 4 of the present invention; Figure 5 A schematic diagram of a negotiation frame structure provided in Embodiment 4 of the present invention; Figure 6A schematic diagram of a data frame structure provided in Embodiment 4 of the present invention; Figure 7 A schematic diagram of a process of establishing a connection and reconnecting provided in Embodiment 4 of the present invention; Figure 8 A schematic diagram of a process for negotiating a data transmission preparation state provided in a fourth embodiment of the present invention; Fig. 9 A schematic diagram of the structure of a data transmission device provided in Embodiment 5 of the present invention; Fig.10 A schematic diagram of the structure of a data transmission device provided in Embodiment 6 of the present invention; Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0031] It should be clear that the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0032] The technical solution of the present invention is described in detail below through various embodiments.

[0033] Embodiment 1 This embodiment provides a data transmission method, which can be executed by a corresponding data transmission device on a master end or a slave end. Figure 1 The method specifically includes the following steps 101-103.

[0034] Step 101: Obtain data transmission requirements of the local end and the opposite end on data channels available to both parties.

[0035] In an embodiment of the present invention, the local end and the opposite end are two ends for data transmission, and can be master and slave ends to each other, such as the MCU and SOC in an autonomous driving system. One or more data channels are pre-created between the two ends (the local end and the opposite end), such as an SPI channel, an Ethernet link, or a controller area network link, and a connection is established based on the data channel. Typically, the data channel is an SPI channel, and each SPI channel is usually formed by connecting the SPI on the master end and the SPI on the slave end through four lines (a clock line, a data input line, a data output line, and a chip select line between the master device and the slave device).

[0036] In order to ensure that both ends can effectively and efficiently transmit data, it is necessary to clarify the data transmission requirements of both parties on the available data channels, which may specifically include the following sub-steps 1011-1013.

[0037] Sub-step 1011: Determine the available data channels for both parties.

[0038] This sub-step can be achieved in the following ways: Reading configuration files: You can determine the availability of one or more pre-created data channels by reading a preset configuration file; the configuration file records the status information of these data channels, including whether they are available, etc. Real-time detection: Using channel detection technology, all pre-created data channels can be detected in real time to determine which channels are currently available; this method can provide the latest channel status information, but consumes more resources; Bilateral negotiation: During the process of establishing a connection with the other end or after the connection is successfully established, the two parties can communicate with each other to negotiate and confirm which data channels can be used by both parties. Only when both parties recognize that a data channel is available, the channel is considered a truly available channel.

[0039] In the specific implementation, any one of the above methods can be selected, or a combination of multiple methods can be used. Regardless of which method is adopted, the core purpose is to ensure that the selected data channel can meet the data transmission needs of both parties while ensuring the quality and efficiency of communication. This embodiment does not strictly limit the specific method to be adopted, and the most appropriate solution can be flexibly selected according to the actual application scenario and needs. For example, in an environment with complex and changeable network conditions, the configuration file reading and real-time detection technology can be combined to dynamically adjust the selection of the data channel; in scenarios with higher security requirements, the availability of the data channel can be confirmed through negotiation between the two parties to ensure the security of communication.

[0040] Sub-step 1012: obtaining the data transmission requirements of the local end on the data channels available to both parties.

[0041] In the embodiment of the present invention, the data transmission requirements include business requirements, and optionally also include but are not limited to performance requirements and security requirements. Among them, the business requirements include data volume, such as the total amount of data to be transmitted, the amount of data in a single frame (or the length of a data frame), and optionally also include but are not limited to data type, transmission frequency, etc.

[0042] Preferably, the data volume in the service demand includes the total amount of data to be transmitted, but does not include the data volume of a single frame (or the length of a data frame).

[0043] To ensure that data transmission requirements are accurately obtained, multiple methods can be used to meet the needs of different scenarios. One method is to read preset configuration files, which usually contain detailed business requirement information. This method is suitable for scenarios where the requirements are relatively fixed and have been clearly defined in advance. Another method is to dynamically obtain data transmission requirements by interacting with other modules on the local side. The specific implementation can be carried out through internal API calls, message queues or other communication mechanisms. This method is suitable for scenarios where requirements change dynamically or need to be adjusted in real time, and can adapt to changing business needs more flexibly.

[0044] Sub-step 1013: Obtain the data transmission requirements of the other end on the data channel available to both parties.

[0045] In this sub-step, negotiation can be conducted with the other end to clarify the data transmission requirements of the other end on the data channel available to both parties. Specifically, after a data transmission request is triggered, based on a pre-created data channel available to both parties, the data transmission requirements of both parties on the data channel available to both parties can be negotiated with the other end during the process of establishing a connection with the other end. Alternatively, a connection is established with the other end based on a pre-created data channel available to both parties; after the connection is successful, a data transmission request is triggered, and based on the negotiation channel, the data transmission requirements of both parties on the data channel available to both parties are negotiated with the other end.

[0046] Exemplarily, when the data transmission requirement includes the data frame length but does not include the total amount of data to be transmitted, the negotiation with the other end on the data frame length on the data channel available to both parties includes: ① determining the maximum data frame length of the data channel available to both parties expected by the local end based on the total amount of data to be transmitted on the data channel available to both parties and the data cache limit of the data channel available to both parties; ② sending a negotiation frame carrying the maximum data frame length of the data channel available to both parties expected by the local end to the other end; ③ receiving the negotiation frame sent by the other end carrying the maximum data frame length of the data channel available to both parties expected by the other end. Wherein, when performing the operation ①, if the amount of data to be transmitted on the data channel available to both parties by the local end is less than or equal to the data cache limit of the data channel available to both parties, then the maximum data frame length of the data channel available to both parties expected by the local end is: the amount of data to be transmitted on the data channel available to both parties by the local end; otherwise, it is the data cache limit of the data channel available to both parties.

[0047] Of course, those skilled in the art should understand that the data transmission requirements of the other party on the data channel available to both parties can also be obtained by sharing the configuration file of the other party or calling the API interface provided by the other party. This embodiment does not limit this.

[0048] Step 102: According to the acquired data transmission requirements, data transmission parameters are configured for the available data channels of both parties, wherein the parameters include the data frame length.

[0049] In this step, the data transmission parameters of the data channel are various parameters used to describe and control the data transmission behavior in the data channel, which can be divided into two categories: basic characteristic parameters of the data and transmission status parameters. Among them, the basic characteristic parameters of the data are required, including at least the data frame length, and optionally the data type. The data transmission status parameters are optional, including but not limited to the channel buffer position, the amount of data to be transmitted / received, the amount of data transmitted / received, the number of data frames to be transmitted / received, and the number of data frames transmitted / received. These transmission status parameters will change dynamically as the data transmission process proceeds. The following is a detailed description of the data transmission parameter configuration of the data channels available to both parties.

[0050] (1) As an implementable manner, the data transmission requirement includes the total amount of data to be transmitted, but does not include the amount of data in a single frame (or the length of a data frame). Accordingly, according to the acquired data transmission requirement, the data frame length is configured for the available data channels of both parties, including: The data frame length of the available data channels of both parties is determined and configured according to the following contents: the total amount of data to be transmitted on the available data channels of both parties at the local end; the total amount of data to be transmitted on the available data channels of both parties at the other end; and the data cache limit of the available data channels of both parties.

[0051] Among them, the data cache limit refers to the maximum amount of data cache that can be accommodated during the data transmission process. The data cache limit of the data channel available to both parties refers to: the smaller value of the data cache limit of this end on the data channel available to both parties and the data cache limit of the other end on the data channel available to both parties, so as to ensure that data transmission failure or performance degradation will not occur due to insufficient cache limit of one end. Specifically, if the total amount of data to be transmitted on the data channel available to both parties is less than or equal to the data cache limit of the data channel available to both parties, then the data frame length of the data channel available to both parties is determined to be: the larger value of the total amount of data to be transmitted on the data channel available to both parties; if the total amount of data to be transmitted on the data channel available to both parties at least one of the two ends is greater than the data cache limit of the data channel available to both parties, then the data frame length of the data channel available to both parties is determined to be: the data cache limit of the data channel available to both parties. The following examples are provided for explanation.

[0052] Example 1: Assumptions: The data buffer limit of the local end on the mutually available data channel is 10MB; the data buffer limit of the other end on the mutually available data channel is 8MB; the total amount of data to be transmitted on the mutually available data channel of the local end is 5MB; the total amount of data to be transmitted on the mutually available data channel of the other end is 6MB; Calculation process: ① Data cache limit of the available data channels of both parties: the cache limit of this end is 10MB; the cache limit of the other end is 8MB; the smaller value is 8MB; ② The total amount of data to be transmitted: the total amount of data to be transmitted on this end is 5MB; the total amount of data to be transmitted on the other end is 6MB; the larger value is 6MB; ③ Determine the data frame length: the total amount of data to be transmitted on the available data channels of both ends is less than or equal to the data cache limit of the available data channels of both ends (5MB ≤ 8MB, 6MB ≤ 8MB). Therefore, the data frame length of the available data channels of both ends is the larger value of the total amount of data to be transmitted on both ends, that is, 6MB.

[0053] Example 2: Assumptions: The data buffer limit of this end on the mutually available data channel is 10MB; the data buffer limit of the other end on the mutually available data channel is 8MB; the total amount of data to be transmitted on this end on the mutually available data channel is 12MB; the total amount of data to be transmitted on the mutually available data channel of the other end is 6MB; Calculation process: ① Data cache limit of the available data channel for both parties: the cache limit of this end is 10MB; the cache limit of the other end is 8MB; the smaller value is 8MB; ② The total amount of data to be transmitted: the total amount of data to be transmitted on this end is 12MB; the total amount of data to be transmitted on the other end is 6MB; ③ Determine the data frame length: the total amount of data to be transmitted on at least one of the two ends is greater than the data cache limit of the available data channel for both parties (12MB>8MB). Therefore, the data frame length of the available data channel for both parties is the data cache limit of the available data channel for both parties, that is, 8MB.

[0054] (2) As another possible implementation method, the data transmission requirement includes the data frame length but does not include the total amount of data to be transmitted. Accordingly, according to the acquired data transmission requirement, the data frame length of the available data channels of both parties is configured, including: selecting the larger value of the maximum data frame lengths of the available data channels expected by both ends as the data frame length of the available data channels of both parties.

[0055] Step 103: Data is transmitted with the other end through the configured mutually available data channel.

[0056] After configuring the transmission parameters of the data channels available to both parties, data can be transmitted to the other party and data sent by the other party can be received through the data channels available to both parties.

[0057] Optionally, the data transmission parameters in this embodiment also include data types, such as business data and clock synchronization data, and the business data can be further divided into single-frame data and long-frame data. Single-frame data does not exceed the data cache limit of the data channel available to both parties and can be sent at one time; long-frame data exceeds the data cache limit of the data channel available to both parties and needs to be divided into packets and sent multiple times.

[0058] Correspondingly, after data transmission with the peer end, it also includes: processing the peer end data according to the type of the received peer end data. Specifically, for business data, the received peer end data is put into the cache and waits for the business module to access; for time synchronization data, the received peer end data is directly notified to the time synchronization module. In this way, it can ensure that different types of data are properly managed and processed during the transmission and processing process, thereby ensuring the efficiency and accuracy of data transmission.

[0059] The following supplementary explanation is given to the data transmission scheme provided in this embodiment. The above steps 101-103 are only described in detail for a single bilaterally available data channel. In actual applications, multiple bilaterally available data channels are created between the two ends of data transmission to increase the transmission bandwidth. In this case, the above steps 101-103 can be performed separately for each bilaterally available data channel or a bilaterally available data channel whose priority meets the set conditions. In addition, when the two parties negotiate the available data channels and negotiate the data transmission requirements, the negotiation channel used can be the same channel as the data channel used when the two ends establish a connection, which can be any one of the multiple bilaterally available data channels created in advance, or the bilaterally available data channel with the highest priority selected according to the priority.

[0060] The technical solution provided in this embodiment can dynamically configure the data frame length of the transmission according to the actual transmission requirements of the two ends of the communication, avoiding the waste of bandwidth resources caused by the use of fixed data frame length. In the case of a fixed frame length, the transmission of a small amount of data may cause the frame to be idle, resulting in insufficient utilization of the bandwidth. After adopting dynamic configuration, the frame length can be adjusted according to the real-time data volume, thereby reducing the idle bandwidth and improving the overall transmission efficiency.

[0061] Embodiment 2 Based on the above-mentioned embodiment 1, this embodiment further optimizes the step of obtaining the data transmission requirements of the other end on the data channel available to both parties. This method can be executed by the corresponding data transmission device on the master end or the slave end. Figure 2 The method specifically includes the following steps 201-205.

[0062] Step 201: Establish a connection with the other end based on the available data channels of both parties.

[0063] In this step, this end can establish a connection with the other end through a pre-created data channel available to both parties. Typically, the data channel is an SPI channel. When this end and the other end are master-slave ends to each other, the master end actively initiates the connection with the slave end. The specific connection process can be implemented through a handshake mechanism of multiple connection state exchanges and confirmations. Exemplarily, the connection states include: Waiting for connection (WaitConnect), connecting (Connecting) and connection completed (Connected), and each connection state transition depends on the consistency of the connection state at both ends, which can ensure the stability and security of the connection. The specific implementation process may include: (1) After initialization is completed, jump to WaitConnect Local and remote ends: After initialization is completed, both local and remote ends enter the Waiting for Connection state (WaitConnect); (2) Send the current connection status The local end and the remote end: both send their current connection status to each other; In particular, the data channel is an SPI channel. When the local end and the opposite end are mutually master-slave, the master end triggers the connection establishment operation at first, and first sends its current connection status WaitConnect to the slave end; the slave end receives the connection status WaitConnect of the master end, and sends its current status WaitConnect to the master end; (3) If the current connection state of the other end is consistent with the current connection state of the local end, jump to the next connection state; otherwise, set the current connection state to WaitConnect Local and remote ends: If the current connection status received by the local and remote ends is consistent with their own current connection status, both will jump to the next connection status; otherwise, the current connection status will be set to WaitConnect; (4) Repeat the above steps (2) and (3) until the current connection status of both the local end and the remote end is Connected.

[0064] As a preferred implementation, when there are multiple mutually available data channels, a connection is established with the other end based on one mutually available data channel, and other mutually available data channels are negotiated during the connection process. Specifically, the information of other mutually available data channels known to the local end may be carried in the current connection state sent to the other end, including the identifiers of other mutually available data channels and whether they are available. The mutually available data channel used for connection establishment may be the mutually available data channel with the highest priority known to the local end.

[0065] Furthermore, after negotiating other available data channels for both parties and before configuring the data transmission parameters for the available data channels for both parties, it also includes: confirming the actual availability of the other negotiated available data channels for both parties. The specific confirmation process can be based on the negotiated other available data channels for both parties, exchanging test frames with the other end, and detecting the actual availability of the channel based on the interaction results. Correspondingly, in the above connection state, after the connection is completed (Connected), it can also include a channel detection state (ChannelCheck). Until the current connection states of both the local end and the other end are ChannelCheck, and the channel detection is completed, it is confirmed that the connection between the two ends is successful.

[0066] In addition, the connection status also includes: connection failure (Error). After the two ends are successfully connected, if the local end detects a connection failure or receives a connection failure status sent by the other end, reconnect.

[0067] Step 202: After the connection is successful, a data transmission request is triggered, and the data transmission requirement of the other end is obtained through negotiation with the other end on the data channel available to both parties.

[0068] After successfully establishing a connection with the other end, if the local end finds that it has data to transmit, it can trigger a data transmission request and negotiate with the other end to obtain the other end's data transmission requirements on the data channels available to both parties through negotiation. Typically, the data channel is an SPI channel. When the local end and the other end are master-slave ends, since the control of data transmission is in the master end, the opening of the data channel and when to start and end data transmission are all determined by the master end. Therefore, the slave end can send a data transmission request to the master end through other non-data channels when data transmission is required. After receiving the request, the master end starts data transmission and negotiates with the other end to obtain the other end's data transmission requirements on the data channels available to both parties.

[0069] Step 203: Obtain the data transmission requirements of the local end on the data channels available to both parties.

[0070] This step 203 is the same as the step 101 in the first embodiment above, which is to obtain the data transmission requirements of the local end on the data channels available to both parties, and will not be described in detail here.

[0071] Step 204: According to the acquired data transmission requirements, data transmission parameters are configured for the available data channels of both parties, wherein the parameters include the data frame length.

[0072] This step 204 is the same as step 102 in the above-mentioned embodiment 1, and will not be described again here.

[0073] Step 205: Data is transmitted with the other end through the configured mutually available data channel.

[0074] This step 205 is the same as step 103 in the above-mentioned embodiment 1, and will not be described again here.

[0075] The following is a further supplementary explanation of the data transmission scheme provided in this embodiment. In this embodiment, a unified format of negotiation frames may be used to establish a connection and negotiate the available data channels and data transmission requirements of both parties, wherein the frame data portion may include fields such as connection status, data channel status (channel identifier + whether it is available identifier), and data transmission requirement control. The data transmission requirement control field can be further divided into a data type field of the data to be transmitted + a total amount of data (or data frame length) field. A unified format of data frames may be used for available data channel detection and data transmission by both parties, wherein the frame data portion may include fields such as the identifier, length, and data of the data item to be transmitted. Typically, when a data frame is used as a test frame, the length of the data item is 0 and the data is empty. In this embodiment, the negotiation frame and the data frame are designed separately, and the negotiation frame is short, which can reduce the time spent on negotiation.

[0076] The technical solution provided in this embodiment establishes a connection in advance before requesting data transmission, thereby reducing the time delay required to temporarily establish a connection, enabling a faster response when data transmission is required, and more timely negotiation and transmission of data; and the established connection is relatively stable, which helps to improve the consistency and overall efficiency of data transmission.

[0077] Embodiment 3 Based on the above-mentioned embodiments 1 and 2, this embodiment adds a step in which the slave end requests data transmission in real time, which is applicable to the scenario where data transmission can only be initiated by the master end. The method can be executed by the corresponding data transmission device on the slave end. Figure 3 The method specifically includes the following steps 301-306.

[0078] Step 301: Establish a connection with the master end based on the available data channels of both parties.

[0079] In this step, the master end can actively initiate a connection with the slave end based on the available data channel of both parties, and the slave end receives and participates in the connection. Alternatively, the slave end sends a connection request to the master end through the control channel, and after the master end receives the connection request, it initiates a connection with the slave end based on the available data channel of both parties, and the slave end receives and participates in the connection. For the specific connection process, please refer to the relevant description in the above-mentioned embodiment 2, which will not be repeated here.

[0080] Step 302: After the connection is successful, obtain the data transmission requirements of the local end on the data channel available to both parties.

[0081] The data transmission requirement acquisition step in this step can refer to the relevant descriptions in the above-mentioned embodiment 1 and embodiment 2, and will not be repeated here.

[0082] Step 303: Send a data transmission request to the master end through the control channel.

[0083] In this step 303, when the slave terminal needs to transmit data, it can request the master terminal to start data transmission in real time through the control channel. After receiving the request, the master terminal first negotiates with the slave terminal the data transmission demand on the available data channel of both parties. Wherein, the control channel is other channels different from the data transmission channel, which can be a DTR (Data Transfer Request, data transmission request) signal line. This line is a GPIO (General Purpose Input / Output, general input and output port) physical link with a rising or falling edge detection function of the level. The master terminal judges whether the slave terminal has initiated a data transmission request by detecting the level change of the DTR signal line.

[0084] Step 304: Receive and participate in the data transmission requirement negotiation initiated by the master end according to the data transmission request through the negotiation channel, and obtain the data transmission requirement of the master end on the data channel available to both parties.

[0085] In this step 304, the negotiation channel is preferably a data channel available to both parties when establishing a connection. Of course, when there are multiple data channels available to both parties, it can also be other data channels available to both parties. Typically, for time-synchronized data transmission with high real-time requirements, the negotiation channel can directly use a control channel, and the control channel can be composed of multiple GPIO lines. The specific negotiation process can refer to the relevant descriptions in the above-mentioned embodiments 1 and 2, and will not be repeated here.

[0086] Step 305: According to the acquired data transmission requirements, data transmission parameters are configured for the available data channels of both parties, wherein the parameters include the data frame length.

[0087] This step 305 is the same as step 102 in the first embodiment and step 204 in the second embodiment, and will not be described again.

[0088] Step 306: Data is transmitted with the master end through the configured mutually available data channel.

[0089] This step 306 is the same as step 103 in the first embodiment and step 205 in the second embodiment, and will not be described again.

[0090] In the traditional way, when the master end has the control over data transmission, the data transmission process is usually initiated and dominated by the master end. The master end decides when to request data from the slave end or send data to the slave end according to a preset plan, algorithm or user instruction. The slave end is usually in a passive state of waiting to receive instructions during this process, and lacks a mechanism to actively express its own data transmission needs. The technical solution provided by this embodiment, even if the control of data transmission is in the master end, the slave end can still express its data transmission needs to the master end in real time through a specific control channel, and the master end quickly responds to these needs, avoiding the slave end from waiting silently for a long time, thereby further shortening the delay of data transmission.

[0091] Based on the above scheme, as a preferred implementation mode, after configuring the data transmission parameters of the available data channels of both parties and before performing data transmission with the master end, it also includes: According to the data transmission parameters configured for the available data channels of both parties, the following data preprocessing is performed: filling of the data to be transmitted at this end in the corresponding data frame; and cache application of the data to be transmitted at both ends.

[0092] In specific implementation, the data to be sent from the slave to the master is packetized and encapsulated according to the data frame format to construct at least one data frame, and a corresponding size of sending buffer is applied for these data frames. At the same time, based on the number of data frames to be transmitted from the master in the data transmission parameters, a corresponding size of receiving buffer is applied for each data frame to be transmitted from the master.

[0093] After the slave completes the preprocessing operation, it notifies the master that data transmission is ready. The master formally starts data transmission with the slave and begins transmitting data based on the available data channels of both parties.

[0094] In the above preferred manner, the slave performs cache pre-application and data pre-filling before data transmission, which can effectively prevent the situation where the slave is not ready for data and environment after the master starts transmission. This ensures the continuity of data transmission, avoids transmission interruption or delay caused by insufficient preparation of the slave, thereby reducing the time jitter of data transmission and making data transmission more stable and reliable.

[0095] Embodiment 4 This embodiment is based on all the above embodiments and provides a preferred embodiment. This embodiment can be applied to Figure 4The data transmission system shown in the figure, in which the local end and the opposite end are mutually the master and slave ends (Master and Slave), and a DTR signal line and (N+1) SPI channels are pre-created between the two ends: Spi0...SpiN. Where N is an integer greater than or equal to 0. Each SPI channel is formed by connecting the SPI on the master end and the SPI on the slave end through four lines (the chip select line CS between the master device and the slave device, the clock line CLK, the master end data input and the slave end data output MISO, the master end data output and the slave end data input MOSI). Among them, the chip select signal on the chip select line CS and the clock signal on the clock line CLK are both generated and controlled by the master end.

[0096] Based on the above data transmission system, this embodiment provides a data transmission method, which includes the following four stages: frame format definition, connection establishment, transmission preparation and data transmission. Each stage is described in detail below.

[0097] 1. Frame format definition (1) Negotiation frame format definition See also Figure 5 , the negotiation frame structure includes the following fields: ①Header: frame header, fixed value; ②Length: the total length of the frame, a fixed value; ③Status: Connection status 0: Uninitialized; 1: Initialized; 2: Waiting for connection (WaitConnect); 3: Connecting; 4: Connection completed (Connected); 5: Channel Check 6: Normal; 7: Normal state, request transmission (Normal_Request); 8: Normal state, accept the request (Normal_Accepted); 9: Normal state, ready to complete (Normal_Ready); 10: Connection failure (Error); 11: Reconnect; ④DataType: data type to be transmitted, for example: 0 business data frame, 1 time synchronization data frame, UDS frame; ⑤DataLength: the total amount of data to be transmitted, and / or the length of the data frame; ⑥ChannelStatus: Each bit represents the status of a data channel, 0 is busy, 1 is idle, the higher the bit, the higher the priority of the data channel; ⑦Crc32: frame end, data check value.

[0098] Among them, ②-⑥ are the frame data parts.

[0099] (2) Data frame format definition See also Figure 6 , the data frame structure includes the following fields: ①Header: frame header, fixed value, 0xAABB ②Length: The total length of the frame; in the ChannelCheck state, it is a fixed value and does not change with changes in data transmission requirements; ③Sn: 0 for single frame; index value after data packetization for long frame, starting from 0; in ChannelCheck state, it indicates SPI channel ID; ④ItemId: Id of the data item; in ChannelCheck state, it is a fixed value of 0xffff ⑤ItemLength: The length of the data item; in ChannelCheck state, it is a fixed value of 0 ⑥Data: data of the data item; in ChannelCheck state, it is empty; ⑦Crc32: frame end, data check value.

[0100] Among them, ②-⑥ are the frame data part. Different data items can correspond to different types of services in the service layer, and of course can also be time synchronization data.

[0101] 2. Connection establishment The master actively initiates a connection with the slave based on a known available SPI channel with the highest priority, and the slave receives and participates in the connection. During the connection process, both ends use negotiation frames to negotiate the availability of other SPIs. After the connection is successful, the master and slave detect the actual availability of the available SPI channels negotiated during the connection process by exchanging specific data frames. The connection status includes: Waiting for connection (WaitConnect), Connecting (Connecting), Connection completed (Connected), Channel detection status (ChannelCheck) and normal status (Normal). See Figure 7 The specific implementation process includes: (1) At the beginning, both the master and the slave go from the Uninitialized state to the Initialized state, and then jump to the WaitConnect state; (2) The master sends its current connection status to the slave; the slave receives the connection status of the master and sends its current status to the master; (3) If the current connection state received by the master and slave is consistent with their own current connection state, both jump to the next connection state; otherwise, the current connection state is set to WaitConnect; (4) Repeat the above steps (2) and (3) until the current connection status of both the local end and the remote end is Connected.

[0102] (5) The master and slave cooperate to perform communication detection on all SPI channels except the SPI channel with the highest priority to detect whether these SPI channels are available; if an SPI channel receives data error or does not receive data due to timeout, the master and slave determine that the SPI channel is unavailable; then, the master and slave jump to the Normal state; (6) After the connection status between the master and slave ends jumps to Normal, they wait for the trigger of data transmission; Furthermore, this embodiment also provides a reconnection mechanism, see Figure 7 ,include: (7) When the master and slave are in the Normal state and an Error occurs, they jump to the Error state; (8) The master sends its current connection status to the slave; the slave receives the connection status of the master and sends its current status to the master; (9) After the master and slave receive the Error status from each other, or their own status is Error, they jump to the Reconnect state; (10) Repeat operation (8) After the master and slave receive the Reconnect status from each other, they jump to the Connecting state, otherwise they remain unchanged; (11) Repeat operation (8) When the master and slave receive the same status as their own and both are Connecting, they jump to Connected state, otherwise they jump to WaitConnect state; (12) Repeat operation (8) When the master and slave receive the status of each other that is consistent with their own status and both are Connected, they jump to the Normal state, otherwise they jump to the WaitConnect state; (13) After the master and slave states jump to Normal, they wait for the trigger of data transmission.

[0103] 3. Transmission Preparation The data type to be transmitted is business data as an example. After the connection is successful, after the master detects that a data transmission request has been triggered (such as receiving a data transmission request sent by the slave based on the DTR signal line), it initiates negotiation of the data transmission preparation status to the slave for each available SPI channel; the slave receives and participates in the negotiation initiated by the master; during the negotiation, the master and slave confirm each other's data transmission request information on the available SPI channel, and complete the data transmission parameter configuration on the available SPI channel according to the confirmation result. In addition, the slave must also complete the data preprocessing on the available SPI channel, and finally the negotiation ends when both the master and slave know that each other has entered the data transmission preparation completion state. Among them, the data transmission preparation status includes: request transmission (NormalRequest), accept request (NormalAccepted) and readiness (NormalReady). The request transmission (NormalRequest) and / or accept request (NormalAccepted) negotiation frames carry data transmission requirement information. For a single available SPI channel, refer to the specific negotiation process of the data transmission preparation status. Figure 8 ,include: After detecting that a data transmission request has been triggered, the master sends a NormalRequest negotiation frame to the slave; After the slave receives the NormalRequest negotiation frame from the master, if it has no data to be transmitted, it will jump to NormalAccepted, otherwise it will jump to NormalRequest; The slave end sends its current data transmission preparation state NormalAccepted or NormalRequest negotiation frame to the master end (preferably, the slave end may generate the data transmission preparation state NormalAccepted negotiation frame and NormalRequest negotiation frame in advance, for example, before it sends a data transmission request to the master end based on the DTR signal line); The slave configures data transmission parameters and preprocesses data on the available SPI channel according to its own data transmission request on the available SPI channel and the data transmission request information of the master on the available SPI channel carried in the NormalRequest negotiation frame sent by the master. After the configuration and preprocessing are completed, the slave changes its state to NormalReady and informs the master. Correspondingly, after receiving the NormalAccepted or NormalRequest negotiation frame sent by the slave, the master end switches its own data transmission state to NormalAccepted; the master end configures the data transmission parameters of the available SPI channel according to its own data transmission request on the available SPI channel and the data transmission request information of the slave end on the available SPI channel carried in the NormalAccepted or NormalRequest negotiation frame sent by the slave end; after the configuration is completed, the master end adjusts its state to NormalReady and informs the slave end; Finally, after the master receives the NormalReady negotiation frame sent by the slave and its own data transmission status is also NormalReady, it enables the available SPI channel and starts transmitting data on this channel with the slave.

[0104] 4. Data transmission On the one hand, the master end sends data through the MOSI pin, and the slave end receives data through the MOSI pin, and these two pins constitute a transmission line in one direction of an available SPI channel. On the other hand, the slave end sends data through the MISO pin, and the master end receives data through the MISO pin, and these two pins constitute a transmission line in the other direction of an available SPI channel. In this embodiment, each SPI channel can be a full-duplex communication mode, a half-duplex communication mode, or a simplex communication mode. When a certain SPI channel is in simplex communication mode, there is only one data sender, and the transmission line in one direction of the available SPI channel does not work. When a certain SPI channel is in half-duplex communication mode, the transmission lines in two directions of the available SPI channel do not work at the same time.

[0105] Embodiment 5 This embodiment provides a data transmission device, which can be used to execute the data transmission method described in the embodiment of the present invention, can be implemented by software and / or hardware, and is applied to the master end or slave end of data transmission. Fig. 9 , the device specifically includes the following units: A demand acquisition unit 901 is used to acquire data transmission demands of the local end and the opposite end on data channels available to both parties; A channel configuration unit 902 is used to configure data transmission parameters for the available data channels of both parties according to the acquired data transmission requirements, wherein the parameters include the data frame length; The data transmission unit 903 is used to transmit data with the other end through the configured mutually available data channel.

[0106] Exemplarily, the channel configuration unit 902 is specifically configured to: The data frame length of the available data channels of both parties is determined and configured according to the following contents: the total amount of data to be transmitted on the available data channels of both parties at the local end; the total amount of data to be transmitted on the available data channels of both parties at the other end; and the data cache limit of the available data channels of both parties.

[0107] The channel configuration unit 902 is specifically used to determine the data frame length of the data channel available to both parties, which may include: If the total amount of data to be transmitted on the available data channels of both ends is less than or equal to the data buffer limit of the available data channels of both ends, then the data frame length of the available data channels of both ends is determined to be: the larger value of the total amount of data to be transmitted on the available data channels of both ends; If the total amount of data to be transmitted on the available data channel of both ends at at least one of the two ends is greater than the data buffer limit of the available data channel of both ends, the data frame length of the available data channel of both ends is determined to be: the data buffer limit of the available data channel of both ends.

[0108] Furthermore, the device further includes: a connection establishment unit 900, which is used to establish a connection with the opposite end based on the data channel available to both parties. Correspondingly, the demand acquisition unit 901 includes: a counterpart demand acquisition subunit 9011, which is used to trigger a data transmission request after the connection is successfully established, and negotiate with the opposite end to obtain the data transmission demand of the opposite end on the data channel available to both parties.

[0109] Preferably, there are multiple data channels available to both parties. Accordingly, the connection establishment unit 900 is specifically used to: establish a connection with the other end based on one data channel available to both parties, and negotiate other data channels available to both parties during the connection process.

[0110] In addition, the demand acquisition unit 901 may also include: a channel confirmation subunit 9012, which is used to confirm the actual availability of the negotiated other data channels available to both parties after the other end demand acquisition subunit 9011 negotiates other data channels available to both parties and before the data transmission unit 903 configures data transmission parameters for the data channels available to both parties.

[0111] Optionally, the data transmission parameters also include a data type; the device also includes: a data processing unit 904, which is used to process the peer data according to the type of the received peer data after the data transmission unit 903 transmits data with the peer.

[0112] The data transmission device in this embodiment can implement the data transmission method described in the above-mentioned embodiment 1 and embodiment 2. The implementation principles and corresponding technical effects are basically the same and will not be repeated here.

[0113] Embodiment 6

[0114] This embodiment provides a data transmission device, which can be used to execute the data transmission method described in the embodiment of the present invention, can be implemented by software and / or hardware, and is applied to the slave end of data transmission. Fig.10 , the device specifically includes the following units: The demand acquisition unit 1001 is used to acquire the data transmission demand of the local end and the opposite end on the data channels available to both parties; The channel configuration unit 1002 is used to configure data transmission parameters for the available data channels of both parties according to the acquired data transmission requirements, wherein the parameters include the data frame length; The data transmission unit 1003 is used to transmit data with the other end through the configured mutually available data channel.

[0115] Exemplarily, the channel configuration unit 1002 is specifically configured to: The data frame length of the available data channels of both parties is determined and configured according to the following contents: the total amount of data to be transmitted on the available data channels of both parties at the local end; the total amount of data to be transmitted on the available data channels of both parties at the other end; and the data cache limit of the available data channels of both parties.

[0116] The channel configuration unit 1002 is specifically used to determine the data frame length of the data channel available to both parties, which may include: If the total amount of data to be transmitted on the available data channels of both ends is less than or equal to the data buffer limit of the available data channels of both ends, then the data frame length of the available data channels of both ends is determined to be: the larger value of the total amount of data to be transmitted on the available data channels of both ends; If the total amount of data to be transmitted on the available data channel of both ends at at least one of the two ends is greater than the data buffer limit of the available data channel of both ends, the data frame length of the available data channel of both ends is determined to be: the data buffer limit of the available data channel of both ends.

[0117] Furthermore, the device further includes: a connection establishment unit 1000, configured to establish a connection with a peer end based on a data channel available to both parties. Correspondingly, the demand acquisition unit 1001 includes: a peer end demand acquisition subunit 10011, configured to trigger a data transmission request after the connection is successfully established, and negotiate with the peer end to obtain the data transmission demand of the peer end on the data channel available to both parties.

[0118] Preferably, there are multiple data channels available to both parties. Accordingly, the connection establishment unit 1000 is specifically used to: establish a connection with the other end based on one data channel available to both parties, and negotiate other data channels available to both parties during the connection process.

[0119] In addition, the demand acquisition unit 1001 may also include: a channel confirmation subunit 10012, which is used to confirm the actual availability of the negotiated other data channels available to both parties after the other end demand acquisition subunit 10011 negotiates other data channels available to both parties and before the data transmission unit 1003 configures data transmission parameters for the data channels available to both parties.

[0120] Furthermore, the peer demand acquisition subunit 10011 is specifically used for: After the connection is successful, a data transmission request is sent to the master through the control channel; Through the negotiation channel, receive and participate in the data transmission requirement negotiation initiated by the master based on the data transmission request, and obtain the data transmission requirement of the master on the available data channels of both parties.

[0121] Furthermore, the device further includes a preprocessing unit 1004, which is used for, after the channel configuration unit 1002 configures data transmission parameters for the available data channels of both parties and before the data transmission unit 1003 performs data transmission with the opposite end: According to the data transmission parameters configured for the available data channels of both parties, the following data preprocessing is performed: filling of the data to be transmitted at this end in the corresponding data frame; and cache application of the data to be transmitted at both ends.

[0122] Optionally, the data transmission parameters also include a data type; the device also includes: a data processing unit 1005, which is used to process the peer data according to the type of the received peer data after the data transmission unit 1003 transmits data with the peer.

[0123] The data transmission device in this embodiment can implement the data transmission method described in any of the aforementioned embodiments, and its implementation principle and corresponding technical effects are basically the same, which will not be repeated here.

[0124] In addition, an embodiment of the present invention further provides a data transmission system, including a master end and at least one slave end, wherein: the master end includes the data transmission device described in the above embodiment five; the slave end includes the data transmission device described in the above embodiment six.

[0125] Furthermore, the master end is the microcontroller unit MCU in the electronic control unit ECU in the autonomous driving system, and the slave end is the system-level chip SOC in the electronic control unit ECU in the autonomous driving system. Alternatively, the slave end is the microcontroller unit MCU in the electronic control unit ECU in the autonomous driving system, and the master end is the system-level chip SOC in the electronic control unit ECU in the autonomous driving system.

[0126] Fig.11 FIG. 1 is a schematic diagram of the structure of an embodiment of an electronic device of the present invention, which can implement the process of the embodiment of the method of the present invention, such as Fig.11As shown, the above-mentioned electronic device may include: a shell 1101, a processor 1102, a memory 1103, a circuit board 1104 and a power supply circuit 1105, wherein the circuit board 1104 is arranged inside the space enclosed by the shell 1101, and the processor 1102 and the memory 1103 are arranged on the circuit board 1104; the power supply circuit 1105 is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory 1103 is used to store executable program codes; the processor 1102 runs a program corresponding to the executable program code by reading the executable program code stored in the memory 1103, so as to execute the data transmission method described in any of the aforementioned embodiments.

[0127] The specific execution process of the above steps by the processor 1102 and the steps further executed by the processor 1102 by running the executable program code can be found in the description of the method embodiment of the present invention, which will not be repeated here.

[0128] This electronic device exists in many forms, including but not limited to: Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, manageability, etc. Other electronic equipment with data processing and communication functions.

[0129] Furthermore, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the data transmission method described in the aforementioned embodiment.

[0130] In summary, the technical solution provided by the embodiment of the present invention significantly improves the efficiency, bandwidth and flexibility of data transmission, and specifically includes the following advantages: (1) Variable length data frame, greatly improving effective bandwidth Problems of the existing solution: Fixed-length frames are used to transmit data. Even if the valid data is smaller than the fixed length, it is still sent according to the fixed length, resulting in a waste of bandwidth and time; Improvements of the embodiments of the present invention: Negotiation frame: A short negotiation frame is used to negotiate the data transmission requirements (data volume and data type, etc.) at both ends of the communication. Data frame: The data frame length is set according to the negotiation frame information. Only valid data is sent, and invalid data is reduced, thereby greatly improving the effective bandwidth and transmission efficiency. (2) Multiple data channels work simultaneously to increase the total transmission bandwidth Problems of existing solutions: single-channel transmission is adopted, and the bandwidth is limited to the bandwidth of the single channel; Improvement of the solution of the embodiment of the present invention: the data to be transmitted is transmitted simultaneously through multiple channels, and the total bandwidth is N times the bandwidth of a single channel, where N is the total number of available data channels, which significantly improves the total bandwidth of the transmission; (3) Both the master and slave can initiate data transmission requests Problems with existing solutions: The control of data transmission lies with the master end, and the slave end can only respond passively, lacking the ability to actively initiate data transmission; Improvements of the embodiments of the present invention: Bidirectional communication: Both the master and the slave can trigger data transmission. The slave can actively send a request when data transmission is needed, and the master responds to the request and then transmits the data. Real-time: This two-way communication mechanism improves the real-time and response speed of the system, ensuring the timeliness and effectiveness of data transmission; (4) The protocol has strong scalability and can meet the expansion of other existing protocols Problems with existing solutions: Fixed lengths lead to large data delays, complex processing, and failure to meet time characteristics requirements; Improvements of the embodiments of the present invention: Protocol extension: By extending the DataType field in the negotiation frame, specific proprietary frames can be defined to adapt to different protocol requirements, such as: Single frame: ordinary data frame, which is placed in the cache after receiving and waits for the business module to fetch data; Long frame: used to transmit longer data. After receiving, it is put into the cache and waits for the business module to fetch the data. Time synchronization frame: used for time synchronization. After receiving, it directly informs the time synchronization module for data processing.

[0131] It should be noted that, in this article, relational terms such as first and second, etc. are only used 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.

[0132] In the embodiments of the present invention, the term "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0133] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0134] In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0135] For the convenience of description, the above device is described by dividing the functions into various units / modules. Of course, when implementing the present invention, the functions of each unit / module can be implemented in the same or multiple software and / or hardware.

[0136] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0137] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A data transmission method, characterized in that: The method comprises: Obtain the data transmission requirements of the local end and the remote end on the available data channels of both parties; According to the acquired data transmission requirements, data transmission parameters are configured for the available data channels of both parties, wherein the parameters include the data frame length; Data is transmitted with the other end through the configured mutually available data channel.

2. The method according to claim 1, characterized in that The method configures data transmission parameters for the available data channels of both parties according to the acquired data transmission requirements, wherein the parameters include the data frame length, including: Determine and configure the data frame length of the data channel available to both parties: The total amount of data to be transmitted on the available data channels of both parties; The total amount of data to be transmitted by the other end on the available data channels of both parties; The data buffer limit of the data channel available to both parties.

3. The method according to claim 2, characterized in that The determining and configuring the data frame length of the data channel available to both parties includes: If the total amount of data to be transmitted on the available data channels of both ends is less than or equal to the data buffer limit of the available data channels of both ends, then the data frame length of the available data channels of both ends is determined to be: the larger value of the total amount of data to be transmitted on the available data channels of both ends; If the total amount of data to be transmitted on the available data channel of both ends at at least one of the two ends is greater than the data buffer limit of the available data channel of both ends, the data frame length of the available data channel of both ends is determined to be: the data buffer limit of the available data channel of both ends.

4. The method according to claim 1, characterized in that: Before obtaining the data transmission demand of the opposite end on the mutually available data channel, the method further includes: establishing a connection with the opposite end based on the mutually available data channel; Obtaining the data transmission demand of the other end on the data channel available to both parties, including: after the connection is successfully established, triggering a data transmission request, and negotiating with the other end to obtain the data transmission demand of the other end on the data channel available to both parties.

5. The method according to claim 4, characterized in that There are multiple data channels available for both parties; The establishing of a connection with the other end based on the data channel available to both parties includes: Based on a data channel available to both parties, a connection is established with the other party, and other data channels available to both parties are negotiated during the connection process.

6. The method according to claim 5, characterized in that After negotiating other available data channels for both parties and before configuring data transmission parameters for the available data channels for both parties, the method further includes: Confirm the actual availability of the negotiated other mutually available data channels.

7. The method according to claim 4, characterized in that The local end is a slave end, and the opposite end is a master end; The triggering of the data transmission request includes: sending a data transmission request to the master end through a control channel; The negotiation with the other end to obtain the other end's data transmission requirements on the data channel available to both parties includes: receiving and participating in the data transmission requirement negotiation initiated by the master end according to the data transmission request through the negotiation channel, thereby obtaining the data transmission requirements of the master end on the data channel available to both parties.

8. The method according to claim 7, characterized in that After configuring the data transmission parameters for the data channels available to both parties and before performing data transmission with the opposite end, the method further includes: According to the data transmission parameters configured for the available data channels of both parties, the following data preprocessing is performed: filling of the data to be transmitted at this end in the corresponding data frame; and cache application of the data to be transmitted at both ends.

9. The method according to claim 1, characterized in that: The data transmission parameters also include data type; After the data transmission with the opposite end, the method further includes: processing the opposite end data according to the type of the received opposite end data.

10. A data transmission device, characterized in that: The device comprises: A demand acquisition unit is used to acquire the data transmission demand of the local end and the opposite end on the data channels available to both parties; A channel configuration unit, used to configure data transmission parameters for the available data channels of both parties according to the acquired data transmission requirements, wherein the parameters include the data frame length; The data transmission unit is used to transmit data with the other end through the configured data channel available to both parties.

11. A data transmission system, characterized in that: The system comprises a master end and at least one slave end, wherein: The master end comprises a data transmission device as claimed in claim 10; The slave end includes another data transmission device as claimed in claim 10 above.

12. The system according to claim 11, characterized in that The master end and the slave end are respectively a microcontroller unit MCU and a system-on-chip SOC in an electronic control unit ECU in an autonomous driving system, or vice versa.

13. An electronic device, characterized in that: The electronic device comprises: a housing, a processor, a memory, a circuit board and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the housing, and the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program codes; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method described in any one of the preceding claims 1-9.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method described in any one of claims 1 to 9.