Data transmission method of vehicle-mounted system, electronic device and vehicle-mounted system
By introducing a data transmission method in the on-board system, the continuous reception of data transmission is achieved using the switching mechanism of the specified signal, the problem of poor data transmission stability in the on-board system is solved and the stability and reliability of the system are improved.
Patent Information
- Application Number
- CN202411552437.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-01
AI Technical Summary
In modern vehicle-mounted systems, the data transmission stability between electronic control units is poor, which is prone to interruption of data transmission, affecting the stability and reliability of the system.
By introducing a data transmission method in the on-board system, the first component sets its own signal as a designated signal to receive data when detecting a designated signal of the second component, and switches to continue receiving data when the designated signal is maintained.
The continuous reception of data transmitted by the first component of the second component is realized, and the efficiency of communication in the on-board system is improved, thereby improving the stability and reliability of the system.
Smart Images

Figure CN119484573A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a data transmission method and electronic device of an on-board system, and an on-board system. Background Art
[0002] In modern vehicle systems, there are a large number of electronic control units, each of which usually contains a microcontroller unit (MCU) and a system on chip (SOC). Efficient and real-time data communication is required between these components to ensure the coordinated operation of the entire system.
[0003] When the SOC, as the master control component, sends data to the slave control device, it usually uses the method of pulling up the sending signal to indicate the start of data transmission. Specifically, when sending data, the master control component will first pull up the sending signal. After the slave control component detects the master control component's pulling up the sending signal, it will pull up its own signal to indicate that it can receive data. In the related art, after the default data reception is completed, the slave control component will immediately consider that the data transmission has been completed and take corresponding operations to stop data reception.
[0004] The transmission scheme of the related technology has poor stability, and data transmission interruptions often occur, affecting the stability and reliability of the entire system. Summary of the invention
[0005] In view of the above problems, a data transmission method and an electronic device of an on-board system, and an on-board system are proposed to overcome the above problems or at least partially solve the above problems, including:
[0006] In a first aspect of the implementation of the present application, a data transmission method of a vehicle-mounted system is first provided, characterized in that the method comprises:
[0007] In the case where the second component sets the second signal as the designated signal, the first component sets the first signal as the designated signal to receive data sent by the second component, wherein the first signal is a signal sent by the first component, the second signal is a signal sent by the second component, and the second component is used to set the second signal as the designated signal when it is necessary to send data to the first component;
[0008] The first component switches the first signal from the designated signal to a non-designated signal after setting the first signal to the designated signal for a preset duration;
[0009] When detecting that the second signal remains the designated signal, the first component switches the first signal from the non-designated signal to the designated signal to continue receiving data sent by the second component.
[0010] Optionally, the method further includes:
[0011] When the first component has a need to send data to the second component, detecting the second signal of the second component;
[0012] The first component sends data to the second component when detecting that the second component sets the second signal to the designated signal; wherein the second component is further configured to set the second signal to the designated signal when data reception is required.
[0013] Optionally, the designated signal is a high-level signal, and the designated signal also indicates that the second component is in a data sending state or a data receiving state, and the non-designated signal is a low-level signal.
[0014] Optionally, the first component and the second component use a full-duplex synchronous serial communication protocol to transmit data, and after setting the first signal to a designated signal, the method further includes:
[0015] The first component sets the communication state of the full-duplex synchronous serial communication protocol to a non-idle state.
[0016] Optionally, after continuing to receive the data sent by the second component, the method further includes:
[0017] The first component parses the data according to a preset length to obtain first target data of the preset length and second target data in the data except the first target data;
[0018] The first component verifies the first target data;
[0019] If the verification passes, the first component parses the second target data.
[0020] Optionally, before the first component sets the first signal to the designated signal, the first component further includes:
[0021] The first component determines that it is in a non-active sending state at the interruption moment, the interruption moment is the moment when the first component detects that the second component sets the second signal to the designated signal, and the active sending state is the state in which the first component initiates data transmission as a sender.
[0022] Optionally, also include:
[0023] If the first component determines that it is in the active sending state at the interruption moment, the first component maintains the first signal as a non-specified signal after the data transmission is completed.
[0024] In a second aspect of the implementation of the present application, an electronic device is provided, comprising one or more processors; and one or more memories storing instructions thereon, wherein the instructions stored in the memories can be read, compiled and executed by the processors to implement the data transmission method of the vehicle-mounted system as described above.
[0025] In a third aspect of the implementation of the present application, there is provided a vehicle-mounted system, the vehicle-mounted system comprising a first component and a second component connected to the first component;
[0026] The first component is an electronic device as described above;
[0027] The second component is configured to set the emitted second signal as a designated signal when there is a need to send data to the first component, and to send data to the first component when it is detected that the first component sets the first signal to the designated signal.
[0028] Optionally, the second component is configured to send the data in the cache to the first component when detecting that the cache corresponding to the second component is not empty.
[0029] The embodiments of the present application have the following advantages:
[0030] When the second component sets the second signal to a designated signal, the first component sets the first signal to a designated signal to receive data sent by the second component, wherein the first signal is a signal sent by the first component, and the second signal is a signal sent by the second component. The second component is used to set the second signal to a designated signal when data needs to be sent to the first component. After setting the first signal to a designated signal for a preset period of time, the first component switches the first signal from a designated signal to a non-designated signal. When the first component detects that the second signal remains as a designated signal, the first component switches the first signal from a non-designated signal to a designated signal to continue receiving data sent by the second component, thereby enabling the first component to continuously receive data transmitted by the second component, thereby improving the efficiency of vehicle system communication, and thereby improving the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0032] Figure 1 It is a flowchart of a data transmission method of a vehicle-mounted system provided by an embodiment of the present application;
[0033] Figure 2 is a scheduling implementation flow chart provided by an embodiment of the present application;
[0034] Figure 3 is a structural schematic diagram of a vehicle-mounted system provided by an embodiment of the present application;
[0035] Figure 4 is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application;
[0036] Figure 5 It is a structural schematic diagram of a data transmission device of a vehicle-mounted system provided by one embodiment of the present application. DETAILED DESCRIPTION
[0037] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0038] In vehicle system communication, MCU is usually connected to the vehicle's controller area network. The controller area network is a communication protocol used to connect different electronic control units inside the car. It allows different electronic control units to exchange information to realize various functions of the vehicle. If the communication rate is too low at this time, it will cause data backlog, and eventually cause memory out of bounds, causing the program to crash. Therefore, a method with fast transmission rate and low processing resource usage is needed for communication. Using the SPI (Serial Peripheral Interface) communication protocol with a baud rate of 6.5Mbps, data can be sent completely within 10ms scheduling. DMA (Direct Memory Access) directly transmits data without going through the CPU. Therefore, using DMA for data transmission is undoubtedly the best choice, which not only meets real-time requirements, but also has high reliability. SPI is a synchronous serial communication protocol that allows full-duplex communication between two devices.
[0039] As the slave control component of SPI, MCU can receive and respond to data requests or instructions from SOC. In vehicle communications, SOC is usually connected to the vehicle's Ethernet network, which is used in cars for high-speed, large-capacity data transmission, especially when it is necessary to process multimedia content or interact with other vehicle systems (such as navigation systems, entertainment systems, etc.). As the master control component of SPI, SOC is responsible for initiating communication with MCU and can control the flow of data. In the architecture of TBOX (Telematics BOX, vehicle communication terminal), MCU and SOC communicate through SPI to exchange data. It can be understood that SPI is a high-speed, full-duplex, synchronous communication bus that works in a master-slave mode, that is, there is a master control component and one or more slave control components.
[0040] Reference Figure 1 , shows a flowchart of a data transmission method of a vehicle-mounted system provided by an embodiment of the present application, wherein the vehicle-mounted system is deployed with a first component and a second component, and specifically may include the following steps:
[0041] Step 101: When the second component sets the second signal to a designated signal, the first component sets the first signal to the designated signal to receive data sent by the second component, wherein the first signal is a signal sent by the first component, the second signal is a signal sent by the second component, and the second component is used to set the second signal to the designated signal when data needs to be sent to the first component.
[0042] Among them, the subject that executes the embodiment of the present application can be the first component, which can be but not limited to the microcontroller unit MCU in the vehicle, which is a small computer chip that integrates functions such as processor core, memory, input / output interface and timer. MCU receives data from sensors, processes these data, and controls actuators according to preset algorithms and programs, thereby realizing precise control of various systems of the vehicle. The second component can be but not limited to SOC (System on aChip, system on chip) integrated circuit, which integrates multiple functions such as processor, memory, input / output interface, communication module, etc. on a single chip. SOC chips are widely used in vehicles, especially in key areas such as advanced driver assistance systems, in-vehicle infotainment systems, and body control modules. MCU is responsible for the basic control tasks at the bottom layer to ensure the basic functions and safety performance of the vehicle; while SOC is responsible for the advanced functions and complex data processing at the upper layer, providing a smarter and richer user experience. SOC chips and MCU often work together to form a hierarchical control architecture. The communication between SOC and MCU is usually realized through a specific communication protocol and bus system. This communication process ensures data exchange and collaborative work between different functional modules, thereby realizing the overall control and management of the vehicle.
[0043] In some examples of this embodiment, the first signal may be a signal sent by the MCU_GPIO (General-Purpose Input / Output) pin corresponding to the first component MCU, and the second signal may be a signal sent by the NAD_GPIO (Network Attached Device General-Purpose Input / Output) pin corresponding to the second component SOC. Under normal circumstances, whether the MCU sends data to the SOC or the SOC sends data to the MCU, the party that actively sends the data will first set its own GPIO signal to the designated signal. Once the other party receiving the data detects that the other party's GPIO is set to the designated signal, it is considered that the other party has data to send to itself and needs to be prepared to receive the data. Therefore, the SOC sets the NAD_GPIO signal to the designated signal to indicate that the SOC has data to send. When the MCU detects that the NAD_GPIO is set to the designated signal, it will think that it needs to receive the data from the SOC. At this time, the MCU also sets the MCU_GPIO to the designated signal and feeds it back to the SOC, thereby notifying the SOC that it is ready to receive the data.
[0044] In the specific implementation, OSEK OS (Open Systems and the Corresponding Interfaces for Automotive Electronics Operating System) single-core multi-task scheduling is used, and RPC (Remote Procedure Call) communication is scheduled once every 10ms to detect whether the MCU or SOC has data to send. If it is first detected that the SOC sets NAD_GPIO to the specified signal, it means that the SOC has data to send to the MCU, and the MCU needs to receive the data at this time; it can be understood that if it is first detected that the MCU sets MCU_GPIO to the specified signal, it means that the MCU needs to send data to the SOC, and the SOC needs to receive the data at this time. Among them, OSEK is a set of open standards and specifications for automotive electronic control units, and RPC is a communication protocol that allows programs to execute code on different address spaces, just like calling local functions, simplifying communication in distributed systems.
[0045] In some embodiments of the present application, the designated signal is a high-level signal, and the designated signal also indicates that the second component is in a data sending state or a data receiving state, and the non-designated signal is a low-level signal.
[0046] In digital systems, signals are usually divided into two states: a high-level signal refers to a signal in which the voltage or current is at a higher state in a digital circuit, and a low-level signal refers to a signal in which the voltage or current is at a lower state in a digital circuit. High level and low level correspond to logic "1" and logic "0" respectively. In communication protocols, a high-level signal can represent a data bit "1" or a specific control signal.
[0047] In some examples of this embodiment, the designated signal is a high-level signal, and the non-designated signal corresponds to a low-level signal. However, those skilled in the art can understand that in some other examples, the low-level signal can also be used as the designated signal, and the high-level signal can be used as the non-designated signal.
[0048] In some examples of this embodiment, a suitable high-level designated signal can be determined according to the design of the system and the requirements of the communication protocol. It is understood that when the high-level signal is first sent out from the first component MCU, it indicates that the first component MCU is in a data sending state, and when the high-level signal is first sent out from the second component SOC, it indicates that the second component SOC is in a data sending state. Similarly, when the high-level signal is first sent out from the first component MCU (MCU sends data to SOC), the second component SOC will also switch the second signal to a high-level signal in order to indicate that it is ready to receive data. The designated state at this time indicates that the second component SOC is in a data receiving state; when the high-level signal is first sent out from the second component (SOC sends data to MCU), the first component MCU will also set the first signal to a high-level signal in order to indicate that it is ready to receive data. The designated high-level signal at this time indicates that the first component MCU is in a data receiving state. It should be understood that the high-level signal should be able to be accurately identified by the first component and the second component, and will not interfere with other parts of the system. Similarly, a suitable low-level signal can be determined as a non-specified signal according to the system design and the requirements of the communication protocol, and the non-specified signal indicates that the first component or the second component is in a stop receiving state.
[0049] The first component and the second component can both apply a designated signal or a non-designated signal to the signal line between the first component and the second component through their control circuits or special signal generating devices. The designated signal or the non-designated signal can be a constant voltage value or a voltage signal with a specific waveform or frequency, depending on the communication protocol and the recognition capabilities of the first component and the second component. The designated signal or the non-designated signal is then transmitted along the signal line between the first component and the second component. When the first component or the second component receives the designated signal or the non-designated signal, it will decode and identify the designated signal or the non-designated signal according to its internal circuit design and communication protocol. Once it is identified that this is a designated signal requesting to enter the data receiving state, the first component or the second component that receives the designated signal will perform corresponding preparations, such as initializing the data receiving buffer, configuring related hardware interfaces, etc.
[0050] It is understandable that when the first component MCU sends data, it will pull up MCU_GPIO. After the second component SOC detects the rising edge of MCU_GPIO, the second component SOC will pull up NAD_GPIO to indicate that the second component can receive data. However, there is a problem at this time. The action of the second component SOC pulling up NAD_GPIO will cause the first component MCU to detect that NAD_GPIO has a rising edge, and mistakenly believe that the second component SOC wants to send data. Therefore, after the 10ms scheduling is completed, the first component MCU will send the data, and after pulling down its own MCU_GPIO, it will immediately pull up MCU_GPIO to receive SOC data. In fact, at this time, the second component SOC does not need to send data, and performs unnecessary operations, which reduces system stability.
[0051] Therefore, in some embodiments of the present application, before "the first component sets the first signal as the designated signal" in step 101, the following steps may also be included:
[0052] S11: The first component determines that it is in a non-active sending state at the interruption time, where the interruption time is the time when the first component detects that the second component sets the second signal to a designated signal, and the active sending state is the state in which the first component initiates data transmission as a sender;
[0053] In order to ensure the correct communication between the first component and the second component, in a specific implementation, the MCU sending status flag of the first component can be set to indicate whether the first component is an active sender. For example, during the initialization process, the MCU sending status flag can be set to 0 to indicate that the first component is not an active sender; when the first component determines to send data outward, the MCU sending status flag is set to 1 to indicate that the first component is an active sender.
[0054] Therefore, when the first component detects that the second component sets the second signal to the designated signal, that is, when the first component MCU detects that the NAD_GPIO of the second component SOC generates a rising edge information, and before the first component sets the first signal to the designated signal, the first component needs to first determine whether it is in an active sending state at this moment.
[0055] If the first component is in a non-active sending state at this moment, which means that the first component is not the data sender, it means that NAD_GPIO is set to the specified state because the second component wants to send data. At this time, the step of setting the first signal to the specified signal and the subsequent step of receiving the data sent by the second component are executed.
[0056] In some embodiments of the present application, the following steps may also be included:
[0057] S21: If the first component determines that it is in an active sending state at the time of interruption, the first component maintains the first signal as a non-specified signal after the data transmission is completed;
[0058] From the above content, it can be seen that the interruption moment is the moment when the first component detects that the second component sets the second signal to the designated signal. If the first component determines that it is in an active sending state at the interruption moment, it can be determined that at this time, in the data transmission between the first component MCU and the second component SOC, the first component MCU is the sender sending data to the second component SOC. Then, after the data sending is completed, the first component keeps the first signal as a non-designated signal. That is to say, even if the first component MCU detects the NAD_GPIO rising edge generated by the second component SOC during the process of sending data to the outside (this NAD_GPIO is generated by the second component in response to the data sending request of the first component), it keeps the first signal at a low level and does not respond to it.
[0059] Through the execution of S41, when the first component MCU sends data to the second component SOC, even if the first component MCU detects the rising edge signal of the second component SOC, it can regard the rising edge signal of the second component SOC as invalid by combining whether the first component is in the active sending state, and no longer pull up MCU_GPIO, thereby avoiding unnecessary operations and further improving the stability of the system.
[0060] Based on the detection of the rising edge signal of NAD_GPIO of the second component, combined with the active sending status of the MCU of the first component, the initiator of the data transmission can be clearly identified when the signal switching is detected, which can further ensure the correct transmission of the data and whether the signal switching needs to be processed in time or accurately ignored.
[0061] In some embodiments of the present application, the first component and the second component use a full-duplex synchronous serial communication protocol to perform data transmission. After "the first component sets the first signal to a designated signal" in step 101, the following steps are also included:
[0062] S31: The first component sets the communication state of the full-duplex synchronous serial communication bus to a non-idle state.
[0063] If the communication state between the first component and the second component always remains in an idle state, other tasks or interrupts may mistakenly believe that the SPI interface is available during data transmission between the first component and the second component, thereby attempting to send or receive data, resulting in data conflict and transmission errors.
[0064] In some examples of this embodiment, in the process of the second component sending data to the first component MCU and calling the SPI interface for communication, the first component also needs to set the communication state of the SPI bus to a non-idle state after pulling up MCU_GPIO. Similarly, when the first component MCU sends data to the second component SOC and calls the SPI interface for communication, it is also necessary to set the communication state of the SPI bus to a non-idle state. Therefore, setting the communication state of the SPI bus to a non-idle state indicates that they are transmitting or processing data, which can avoid other tasks or interrupts trying to access the same SPI resources during data transmission, thereby reducing the risk of data conflicts and transmission errors.
[0065] Step 102: After setting the first signal to a designated signal for a preset duration, the first component switches the first signal from a designated signal to a non-designated signal.
[0066] Normally, when the first component MCU receives data sent by SOC from the SPI bus, the data buffer size for each communication is 2k. After one SPI communication is completed, an interrupt will be generated through DMA to notify the end of the communication and pull down the GPIO of the first component and the second component respectively. It can be understood that the SPI communication interface needs to be called once for each communication. After the sender sends the data, it waits for a confirmation signal (ACK) for up to 300ms; after receiving the confirmation signal, it can immediately request to send the next packet of data; if the waiting for the confirmation signal times out, the current message will be resent and retried up to 2 times.
[0067] In a specific implementation, the baud rate of the SPI bus is selectable, for example, 500kbps, 6.5Mbps or 13Mbps, etc. Assuming 6.5Mbps is used, the amount of data transmitted in 1ms is 6500 / 8 bytes. If 10ms scheduling is used, the amount of data that can be transmitted in 10ms is 6500 / 8*10=8125 (bytes), 8125 bytes>2k bytes, so usually, at the end of 10ms scheduling, the data transmission is considered completed, and the first component and the second component will pull down their own GPIO signals.
[0068] Step 103: When the first component detects that the second signal remains the designated signal, the first component switches the first signal from a non-designated signal to a designated signal to continue receiving data sent by the second component.
[0069] From the above content, it can be seen that the data transmission is completed by default after the 10ms scheduling is completed. The first component and the second component will both pull down their own GPIO signals. However, in some examples, the second component SOC may need to transmit more data to the MCU. At this time, the second component SOC can continue to fill the data into the cache during the transmission process, and the second component SOC will not pull down NAD_GPIO.
[0070] Based on the operation that the second component continues to fill data into the cache and does not pull down NAD_GPIO, the first component MCU will continue to detect the signal status of NAD_GPIO while pulling down NAD_GPIO after receiving 10ms of data. When it is detected that NAD_GPIO remains as the designated signal, it indicates that the second component still needs to transmit data. At this time, the first component MCU will again switch the first signal MCU_GPIO from a non-designated signal to a designated signal, thereby notifying the first component that the second component can continue to receive data sent by the second component and continue to prepare for the second reception.
[0071] In some embodiments of the present application, the following steps may also be included:
[0072] S41: When the first component has a need to send data to the second component, detecting a second signal of the second component;
[0073] S42: The first component sends data to the second component when detecting that the second component sets the second signal as the designated signal; wherein the second component is further configured to set the second signal as the designated signal when data needs to be received.
[0074] From the above content, it can be seen that there are different communication requirements between MCU and SOC, so there may be a situation where SOC sends data to MCU, and there may also be a situation where MCU sends data to SOC, so the execution steps of S41-S42 can be before step 101 or after step 103.
[0075] If the first component MCU sends data to the second component SOC, the first component MCU will first set its own first signal to a specified state to indicate that it has data to send out. When the second component SOC receives that MCU_GPIO is set to a specified signal, it will also set NAD_GPIO to a specified signal. Therefore, the first component MCU needs to detect the second signal of the second component SOC. When it is detected that the second component sets the second signal to a specified signal, it can be determined that the SOC is ready to receive data, and data is sent to the second component SOC at this time.
[0076] Normally, when the first component MCU sends data to the second component SOC, the default maximum data amount is 2k. Therefore, during the 10ms scheduling process, the first component MCU will definitely send all 2k of data, and the second component SOC will receive it at the same time.
[0077] In the specific implementation, the SPI driver layer of the second component SOC will add 0x5A xx higt_len low_len 4 bytes. The addition of these 4 bytes can filter invalid transmission and reception. Correspondingly, the first component MCU will parse the received data packet only when it detects the presence of these 4 bytes in the data packet. Therefore, the first component MCU needs to remove these 4 bytes from the received data when unpacking, and also needs to add these 4 bytes when assembling, so that the first component and the second component can communicate accurately and efficiently. When the sender sends the payload data (payload) once, the receiver only needs to reply with an acknowledgment signal ack.
[0078] In a specific implementation, when data is transmitted between the first component and the second component, the transmitted data may be specifically a data message, which is a basic unit for transmitting data in data communication. The message format defines the structure of the data packet, including the order and meaning of each field. For example, the data message may include synchronization data (1), synchronization data (2), Packet Length (1), Packet Length (2), sequence number / packet number, source module, destination module, Playload1Length (1), Playload 1Length (2), Payload1 data (for ACK and NACK type data packets, the Payload field is not required), ProcID (2 bytes) (of the payload1 part), UserData (of the payload1 part), Playload2Length (1), Playload 2Length (2), Payload2 data (Payload is not required for data packets of the ACK and NACK type), ProcID (2 bytes) (of the payload2 part), UserData (of the payload2 part), and Checksum. Among them, Packet Length (1) represents the length 1 of the data packet, Packet Length (2) represents the length 2 of the data packet, Payload1 data represents the payload data 1, Playload 1Length (1) represents the length 1 of the payload data 1, Playload 1Length (2) represents the length 2 of the payload data 1, ProcID in the Playload 1 part represents the service identifier corresponding to the payload data 1, UserData represents the data actually transmitted by the payload data 1, Payload2 data represents the payload data 2, Playload2Length (1) represents the length 1 of the payload data 2, Playload 2Length (2) represents the length 2 of the payload data 2, ProcID (2 bytes) corresponding to the Payload2 data and UserData corresponding to the Payload2 data represent the service identifier and the actually transmitted data corresponding to the payload data 2 respectively, and Checksum represents the checksum field. It should be noted that Playload2Length (1), Playload 2Length (2), Payload2 data field, ProcID (2 bytes) corresponding to the Payload2 data, and UserData corresponding to the Payload2 data are optional fields.
[0079] Among them, the synchronization data (1) can be specifically 0xCD, the synchronization data (2) can be specifically 0x55, PacketLength is the total length of a single RPC protocol message, that is, the length of Byte0-ByteM, using little endian byte order, total length = Length (1) + Length (2) * 256, Length (1): the value range is 0 to 255; Length (2): an integer multiple of 256 bytes, representing the number of 256 bytes. The sequence number / packet number represents the number of packets sent, 1 to 255 are used cyclically, and the sequence number / packet number can be used to determine whether the data frame is lost. Source module / destination module: represents the module ID (MCU&NAD global unique ID) that sends / receives the message. The specific definition is shown in Table 1. 0x00 represents that it is sent by the first component MCU, 0x01 represents that it is sent by the second component SOC, and 0x02 represents that it is sent by AP (Application Processor).
[0080] Table 1
[0081] type Value MCU 0x00 NAD 0x01 AP 0x02
[0082] Playload len: One frame of data (2k) can contain one or more Playloads, Playload len = Playload len1 + Playload len2 * 256, excluding the 2-byte length of Playload len1 and Playload len2, that is, only procID len + userData len. Checksum: Set the value obtained by XOR processing the data from Byte 2 to ByteM-1. Checksum is used for data consistency verification. By reasonably defining and using these fields, the embodiments of the present application can achieve efficient and reliable data transmission between the first component MCU and the second component SOC.
[0083] In some embodiments of the present application, the following steps may be further included after step 103:
[0084] The first component parses the data according to a preset length to obtain first target data of the preset length and second target data in the data except the first target data;
[0085] The first component verifies the first target data;
[0086] If the verification passes, the first component parses the second target data.
[0087] In a specific implementation, the preset length can be but is not limited to 4 bytes, and the preset length can be pre-agreed based on the communication requirements of the first component and the second component. After the first component completes data reception, it first intercepts the data to obtain the first 4 bytes of the first target data, and intercepts the second target data outside the first target data. Specifically, it is also necessary to verify the first 4 bytes of the first target data. If the verification passes, it means that the second target data is valid data between the first component MCU and the second component SOC; in a specific implementation, the second target data can be further verified, for example, the packlen, check code, and payload len in the second target data can be calculated. If the calculated check code is consistent with the check code in the data, it means that the received frame data is valid, and then parse the procID and data from the received data frame; determine what service the application layer is based on the procID, and then execute it. For example, the procID in the data sent by the second component SOC to the first component MCU is 0x0606 (assuming that the procID range corresponding to the SOC to MCU upgrade service is 0x0600~0x06FF), indicating that the second component SOC notifies the first component MCU to prepare for the upgrade. The first component MCU receives the request, knows the amount of data that needs to be upgraded from the data, and responds with 0x8603 to notify the second component SOC that it can be upgraded (assuming that the corresponding procID range when the first component MCU feeds back to the second component SOC that it can be upgraded is 0x8600~0x86FF), allowing the second component to start sending upgrade package data. For example, the service procID can be as shown in Table 2, where xCALL is an extended call, and the xCALL extended call refers to a mechanism for calling specific functions or services in the vehicle system. This call is usually used for cross-module or cross-process communication to achieve collaboration between different functional modules.
[0088] Table 2
[0089]
[0090] like Figure 2As shown, it is a scheduling implementation flow chart provided by some embodiments of the present application. First, the vehicle-mounted system is initialized. The initialization of the vehicle-mounted system can be specifically to set the initial scheduling state of the vehicle-mounted system to idle 1, and set the MCU active sending state to 0 to indicate the non-MCU active sending state. After the initialization is completed, the system scheduling starts every 10ms. First, it is determined whether the bus state is idle. If it is idle, it is detected whether the second component SOC has pulled up its own NAD_GPIO signal. If so, it means that the SOC needs to send data to the MCU, then the bus state is modified to non-idle, and the next 10ms scheduling is continued; if the second component SOC is not detected to pull up its own NAD_GPIO, then it is determined whether the MCU has data to send. If the MCU has data to send, the MCU_GPIO signal is first pulled high, and then the bus state is modified to non-idle. Finally, the state information corresponding to the first component MCU is changed to active sending state 1, and the next 10ms scheduling is entered.
[0091] During the 10ms system scheduling process, if the bus state is judged to be non-idle, it means that there is data to be transmitted, and then wait for DMA to communicate for data transmission. When the time reaches 10ms, first pull down the MCU_GPIO of the first component. At this time, it is necessary to judge whether this data transmission is actively sent by the MCU end of the first component. If not, it means that the SOC end sends data. At this time, it is necessary to judge whether the NAD_GPIO of the SOC end is continuously high. If it is still high, it means that the SOC still has data to send. At this time, the MCU needs to pull up the MCU_GPIO to continue scheduling and receive the data continuously sent by the SOC. In addition, if it is judged that this data transmission is actively sent by the MCU end of the first component, it means that the SOC has no data to send. After the first component MCU completes the data transmission, it needs to ignore the first signal pulled up by the second component SOC when it determines that data can be transmitted, that is, the high signal of the second component SOC is considered invalid. Whether the first component transmits data to the second component, or the second component transmits data to the first component, after the data transmission is completed, the scheduling state is modified to idle 1, and the data packet is decoded, and the corresponding business logic is executed according to the business identifier in the data packet.
[0092] The embodiments of the present application have the following advantages:
[0093] When the second component sets the second signal to a designated signal, the first component sets the first signal to a designated signal to receive data sent by the second component, wherein the first signal is a signal sent by the first component, and the second signal is a signal sent by the second component. The second component is used to set the second signal to a designated signal when data needs to be sent to the first component. After setting the first signal to a designated signal for a preset period of time, the first component switches the first signal from a designated signal to a non-designated signal. When the first component detects that the second signal remains as a designated signal, the first component switches the first signal from a non-designated signal to a designated signal to continue receiving data sent by the second component, thereby enabling the first component to continuously receive data transmitted by the second component, thereby improving the efficiency of communication of the vehicle system, thereby improving the stability and reliability of the vehicle system.
[0094] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0095] Reference Figure 3 , shows an electronic device provided by an embodiment of the present application, the electronic device includes one or more processors 301; and one or more memories 302 storing instructions thereon, wherein the instructions stored in the memories 302 can be read, compiled and executed by the processors 301, thereby realizing the data transmission method of the vehicle-mounted system as described above.
[0096] Reference Figure 4 , shows a schematic diagram of the structure of a vehicle-mounted system provided by an embodiment of the present application, the vehicle-mounted system includes a first component 401 and a second component 402 connected to the first component;
[0097] The first component 401 is an electronic device as described above;
[0098] The second component 402 is configured to set the emitted second signal as a designated signal when there is a need to send data to the first component, and to send data to the first component when it is detected that the first component sets the first signal as the designated signal.
[0099] In some embodiments of the present application, the second component 402 is configured to send the data in the cache to the first component 401 when it detects that the cache corresponding to itself is not empty.
[0100] In some examples of the present application, in the vehicle system, as long as there is data in the BUFFER (buffer) corresponding to the SOC end of the second component, the second component can keep NAD_GPIO as a specified signal to continuously send data to the first component MCU, thereby satisfying the need of the second component SOC to send a large amount of data to the first component MCU. From the foregoing, it can be seen that the first component MCU first pulls up the corresponding first signal MCU_GPIO to receive the data sent by the SOC. After a preset period of time, the first component MCU first pulls down its own MCU_GPIO, but at this time the first component will further detect the NAD_GPIO of the second component. If it is detected that it is continuously pulled up, the first component will continue to pull up its own MCU_GPIO to continuously receive the data sent by the second component.
[0101] When the second component SOC needs to send data to the first component MCU, it will also add a target character of a preset length to the data. The preset length can be but is not limited to 4 bytes. The target character is a pre-agreed fixed character, and the target character can be adjusted according to actual communication needs. The first component receives the data sent by the second component SOC and parses it to obtain the pre-agreed fixed character, that is, when the preliminary verification passes, it will further parse the obtained data, otherwise the received data will be regarded as invalid data and discarded. Therefore, the target character of the preset length added by the second component to the sent data can realize accurate communication between the second component SOC and the first component MCU.
[0102] From the above content, it can be seen that the vehicle-mounted system in the embodiment of the present application realizes the continuous and accurate reception of data transmitted by the first component to the second component, improves the efficiency of vehicle-mounted system communication, and thus improves the stability and reliability of the system.
[0103] Reference Figure 5 , shows a schematic diagram of the structure of a data transmission device of an in-vehicle system provided by an embodiment of the present application, wherein the in-vehicle system includes a first component and a second component connected to the first component, and specifically may include the following modules:
[0104] A first receiving module 501 is configured to, when the second component sets the second signal to a designated signal, set the first signal to the designated signal by the first component to receive data sent by the second component, wherein the first signal is a signal sent by the first component, the second signal is a signal sent by the second component, and the second component is used to set the second signal to the designated signal when data needs to be sent to the first component;
[0105] A first switching module 502 is configured to switch the first signal from the designated signal to a non-designated signal after the first component sets the first signal to the designated signal for a preset duration;
[0106] The first continuous receiving module 503 is configured such that when the first component detects that the second signal remains as the designated signal, the first signal is switched from the non-designated signal to the designated signal to continue receiving data sent by the second component.
[0107] In an optional embodiment of the present application, the device further includes:
[0108] A second detection module is configured to detect the second signal of the second component when the first component has a demand to send data to the second component;
[0109] The second sending module is configured to send data to the second component when the first component detects that the second component sets the second signal to the designated signal; wherein the second component is also used to set the second signal to the designated signal when data needs to be received.
[0110] In an optional embodiment of the present application, the designated signal is a high-level signal, the designated signal also indicates that the second component is in a data sending state or a data receiving state, and the non-designated signal is a low-level signal.
[0111] In an optional embodiment of the present application, the first component and the second component use a full-duplex synchronous serial communication protocol to perform data transmission, and the device further includes:
[0112] The first component sets the communication state of the full-duplex synchronous serial communication bus to a non-idle state.
[0113] In an optional embodiment of the present application, the device further includes:
[0114] A first parsing module is configured to parse the data according to a preset length by the first component to obtain first target data of the preset length and second target data in the data except the first target data;
[0115] a first verification module, configured to verify the first target data for the first component;
[0116] The second parsing module is configured to parse the second target data by the first component if the verification passes.
[0117] In an optional embodiment of the present application, the first receiving module 501 further includes:
[0118] The first execution submodule is configured such that the first component determines that it is in a non-active sending state at the moment of interruption, wherein the interruption moment is the moment when the first component detects that the second component sets the second signal to the specified signal, and the active sending state is the state in which the first component initiates data transmission as a sending end.
[0119] In an optional embodiment of the present application, the first receiving module 501 further includes:
[0120] The second holding submodule is configured to keep the first signal as a non-specified signal after the data transmission is completed if the first component determines that it is in the active sending state at the interruption moment.
[0121] The embodiments of the present application have the following advantages:
[0122] When it is detected that the second component sets the second signal to a designated signal, the first component sets the first signal to a designated signal to receive data sent by the second component, wherein the first signal is a signal sent by the first component, and the second signal is a signal sent by the second component. The second component is used to set the second signal to a designated signal when data needs to be sent. After setting the first signal to a designated signal for a preset period of time, the first component switches the first signal from a designated signal to a non-designated signal. When it is detected that the second signal remains as a designated signal, the first component switches the first signal from a non-designated signal to a designated signal to continue receiving data sent by the second component, thereby enabling the first component to continuously receive data transmitted by the second component, thereby improving the efficiency of communication of the vehicle system, thereby improving the stability and reliability of the vehicle system.
[0123] As 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.
[0124] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0125] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0126] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0127] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0128] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0130] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0131] Finally, 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 terminal 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 terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the above elements.
[0132] The data transmission method, electronic devices and vehicle-mounted system of the provided vehicle-mounted system are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data transmission method for a vehicle-mounted system, characterized in that: The vehicle-mounted system includes a first component and a second component connected to the first component, and the method includes: In the case where the second component sets the second signal as the designated signal, the first component sets the first signal as the designated signal to receive data sent by the second component, wherein the first signal is a signal sent by the first component, the second signal is a signal sent by the second component, and the second component is used to set the second signal as the designated signal when it is necessary to send data to the first component; The first component switches the first signal from the designated signal to a non-designated signal after setting the first signal to the designated signal for a preset duration; When detecting that the second signal remains the designated signal, the first component switches the first signal from the non-designated signal to the designated signal to continue receiving data sent by the second component.
2. The method according to claim 1, characterized in that The method further comprises: When the first component has a need to send data to the second component, detecting the second signal of the second component; The first component sends data to the second component when detecting that the second component sets the second signal to the designated signal; wherein the second component is further configured to set the second signal to the designated signal when data reception is required.
3. The method according to claim 2, characterized in that The designated signal is a high-level signal, and the designated signal also indicates that the second component is in a data sending state or a data receiving state. The non-designated signal is a low-level signal.
4. The method according to claim 1, characterized in that: The first component and the second component use a full-duplex synchronous serial communication protocol to perform data transmission. After the first component sets the first signal to the designated signal, the first component further includes: The first component sets the communication state of the full-duplex synchronous serial communication bus to a non-idle state.
5. The method according to claim 1, characterized in that After continuing to receive the data sent by the second component, the method further includes: The first component parses the data according to a preset length to obtain first target data of the preset length and second target data in the data except the first target data; The first component verifies the first target data; If the verification passes, the first component parses the second target data.
6. The method according to any one of claims 1 to 5, characterized in that: Before the first component sets the first signal to the designated signal, the first component further includes: The first component determines that it is in a non-active sending state at the interruption moment, the interruption moment is the moment when the first component detects that the second component sets the second signal to the designated signal, and the active sending state is the state in which the first component initiates data transmission as a sender.
7. The method according to claim 6, characterized in that Also includes: If the first component determines that it is in the active sending state at the interruption moment, the first component maintains the first signal as a non-specified signal after the data transmission is completed.
8. An electronic device, characterized in that: include one or more processors; and One or more memories storing instructions, wherein the instructions stored in the memories can be read, compiled and executed by the processor to implement the data transmission method of the vehicle-mounted system as described in any one of claims 1-7.
9. A vehicle-mounted system, characterized in that: The vehicle-mounted system includes a first component and a second component connected to the first component; The first component is the electronic device as claimed in claim 8; The second component is configured to set the emitted second signal as a designated signal when there is a need to send data to the first component, and to send data to the first component when it is detected that the first component sets the first signal to the designated signal.
10. The vehicle-mounted system according to claim 9, characterized in that: The second component is configured to send the data in the cache to the first component when detecting that the cache corresponding to the second component is not empty.
Citation Information
Patent Citations
SPI (Serial Peripheral Interface) interaction method and device for Slave end to actively output data and electronic equipment
CN116450561A
Data transmission method and device
CN118337552A
Data packet processing method and apparatus
WO2022120599A1