SPI (Serial Peripheral Interface) rapid communication method, device and equipment based on Ethernet and medium

By using a combination of Ethernet and SPI in the vehicle infotainment system, the problems of low data interaction efficiency and security between the MCU and SOC are solved, achieving efficient and reliable data transmission, reducing development costs and improving system stability and real-time performance.

CN120909976APending Publication Date: 2025-11-07BEI DOU ZHI LIAN KE JI YOU XIAN GONG SI +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511094481.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-06
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

In existing technologies, the UART communication method between MCU and SOC has problems such as low data interaction efficiency, complex development, difficulty in ensuring security, and high cost.

Method used

The SPI fast communication method based on Ethernet is adopted. By combining the virtual network card with SPI, efficient data interaction between MCU and SOC is realized. Ethernet is used to handle complex data processing and SPI bus is used for low-level transmission, ensuring the reliability and orderliness of data transmission and reception.

Benefits of technology

It simplifies the software development process, reduces development costs, improves the communication stability and real-time performance of the vehicle system, and enhances the security of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909976A_ABST
    Figure CN120909976A_ABST
Patent Text Reader

Abstract

The invention provides an Ethernet-based SPI (Serial Peripheral Interface) rapid communication method, device and equipment and a medium, belongs to the technical field of in-vehicle central control system communication, and is applied to data interaction between an MCU (Microprogrammed Control Unit) and an SOC (System On Chip) in an in-vehicle central control system. Assigning a pre-created global variable and performing parameter configuration on the virtual network card; setting the created writing SPI thread and reading SPI thread to be in a working state; obtaining first data sent by an application program APP running on the SOC based on the SPI writing thread, and transmitting the obtained first data to the MCU through an SPI bus; and acquiring second data sent by the MCU based on the SPI reading thread, and transmitting the acquired second data to the APP running on the SOC through the SPI bus. Therefore, efficient data interaction between the MCU and the SOC in the in-vehicle machine central control system is realized through combination of the virtual network card and the SPI, reliable and orderly data receiving and transmitting are guaranteed, and the communication stability and real-time performance of the in-vehicle machine system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the communication technology field of car head unit system, in particular to an SPI fast communication method and device based on Ethernet, equipment and medium. BACKGROUND

[0002] In the design and implementation process of the car head unit system, the data interaction between the MCU and the SOC is crucial, which directly affects the overall performance, response speed, user experience of the system, and the safety and reliability of the vehicle.

[0003] In the prior art, the MCU and the SOC usually use Uart communication mode, which has the problems of low data interaction efficiency, complex development, difficult security guarantee, high cost, etc. For example, the Uart communication protocol is relatively simple, lacks rich application layer protocol support, resulting in a tedious software development process; its security features are insufficient, and data is prone to leakage or tampering during transmission; and developers often need to write communication protocols from scratch, which is time-consuming, and the cost of dedicated communication chips is high, which is not conducive to the overall cost of the control system. SUMMARY

[0004] Therefore, the purpose of the present application is to provide an SPI fast communication method and device based on Ethernet, which can realize efficient data interaction between the MCU and the SOC in the car head unit system by combining virtual network cards with SPI, guarantee reliable and orderly data transmission, and improve the stability and real-time performance of the car system communication.

[0005] The SPI fast communication method based on Ethernet provided by the present application is applied to the data interaction between the MCU and the SOC in the car head unit system, and the method comprises the following steps: When the upper daemon process responsible for managing the virtual network card opens the control interface of the virtual network card, the global variable created in advance is assigned a value and the virtual network card is configured with parameters; After the upper daemon process completes the parameter configuration of the virtual network card, the write SPI thread and the read SPI thread created are set to a working state; In the working state, based on the write SPI thread, the first data sent by the application program APP running on the SOC is obtained, and the obtained first data is transmitted to the MCU through the SPI bus; and based on the read SPI thread, the second data sent by the MCU is obtained, and the obtained second data is transmitted to the APP running on the SOC through the SPI bus.

[0006] In some embodiments, when the upper layer daemon responsible for managing the virtual network card opens the control interface of the virtual network card, the pre-created global variable is assigned and the virtual network card is parameter configured, including the following steps: creating a global variable; polling the control interface file of the virtual network card managed by the upper layer daemon; after detecting that the control interface file is created, opening the control interface file and parameter configuring the virtual network card, and assigning the created global variable to find the virtual network card through the global variable.

[0007] In some embodiments, the parameter configuration includes basic function configuration, network identity configuration, and data path configuration; the basic function configuration includes configuring device type and Ethernet frame; the network identity configuration includes configuring IP and MAC address; and the data path configuration includes configuring routing rules.

[0008] In some embodiments, after the upper layer daemon completes parameter configuration of the virtual network card, the created write SPI thread and read SPI thread are put into working state, including the following steps: creating a write SPI thread and a read SPI thread; after the upper layer daemon completes parameter configuration of the virtual network card, sending a parameter configuration completion signal to the write SPI thread and the read SPI thread; in response to the received parameter configuration completion signal, switching the write SPI thread and the read SPI thread from a waiting state to a working state.

[0009] In some embodiments, based on the write SPI thread, first data sent by an application program APP running on a SOC is acquired, and the acquired first data is transmitted to an MCU through an SPI bus, including the following steps: sending first data sent by an application program APP running on a SOC to an MCU to a network protocol stack for packaging processing, and sending the generated first data packet to a sending buffer of a virtual network card; based on the write SPI thread, extracting the first data packet from the sending buffer and performing decompression processing, and transmitting the obtained first data to the MCU through the SPI bus.

[0010] In some embodiments, based on the read SPI thread, second data sent by the MCU is acquired, and the acquired second data is transmitted to the APP running on the SOC through the SPI bus, including the following steps: acquire, based on the read SPI thread, second data sent by the MCU to an application APP running on the SOC via the SPI bus; pack the second data, and send a generated second data packet to a sending buffer of the virtual network card, for extraction by the application APP running on the SOC.

[0011] In some embodiments, the method further comprises the following steps: initializing configuration of the SPI bus, including configuration of a communication mode and rate.

[0012] In some embodiments, an Ethernet-based SPI fast communication device is also provided, which is applied to data interaction between an MCU and a SOC in a car head control system, and the device comprises: a parameter configuration module, configured to assign values to a pre-created global variable and perform parameter configuration on the virtual network card when an upper-layer daemon process responsible for managing the virtual network card opens a control interface of the virtual network card; a wake-up module, configured to place a created write SPI thread and a read SPI thread in a working state when the upper-layer daemon process completes parameter configuration on the virtual network card; a transmission module, configured to, in the working state, acquire first data sent by an application APP running on the SOC based on the write SPI thread, and transmit the acquired first data to the MCU via the SPI bus; and acquire second data sent by the MCU based on the read SPI thread, and transmit the acquired second data to the application APP running on the SOC via the SPI bus.

[0013] In some embodiments, an electronic device is also provided, which comprises a processor, a memory, and a bus, the memory stores machine-readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate via the bus, and the machine-readable instructions are executed by the processor to perform the steps of any one of the above-described Ethernet-based SPI fast communication methods.

[0014] In some embodiments, a computer-readable storage medium is also provided, which stores a computer program, and the computer program is executed by a processor to perform the steps of any one of the above-described Ethernet-based SPI fast communication methods.

[0015] The application discloses an Ethernet-based SPI fast communication method, device, equipment and medium, which is applied to data interaction between an MCU and an SOC in a car machine central control system. When an upper layer daemon process responsible for managing a virtual network card opens a control interface of the virtual network card, a global variable created in advance is assigned a value, and the virtual network card is configured with parameters; after the upper layer daemon process completes the parameter configuration of the virtual network card, a created write SPI thread and a read SPI thread are set to a working state; in the working state, the write SPI thread is used to acquire first data sent by an application program APP running on the SOC, and the acquired first data is transmitted to the MCU through an SPI bus; and the read SPI thread is used to acquire second data sent by the MCU, and the acquired second data is transmitted to the APP running on the SOC through the SPI bus. Therefore, the MCU and the SOC in the car machine central control system are combined with the virtual network card and the SPI to realize efficient data interaction, so that data receiving and sending are reliable and orderly, and the communication stability and real-time performance of the car machine system are improved. BRIEF DESCRIPTION OF DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0017] Figure 1 A flow chart of the Ethernet-based SPI fast communication method according to the embodiments of the application is shown; Figure 2 A flow chart of assigning a value to a global variable created in advance and configuring parameters of the virtual network card according to the embodiments of the application is shown; Figure 3 A flow chart of data interaction between the MCU and the SOC in the car machine central control system according to the embodiments of the application is shown; Figure 4 A structural schematic diagram of the Ethernet-based SPI fast communication device according to the embodiments of the application is shown; Figure 5 A structural schematic diagram of the electronic equipment according to the embodiments of the application is shown. DETAILED DESCRIPTION

[0018] To make the purposes, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. It should be understood that the drawings in the present application serve only the purpose of description and illustration, and do not serve to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in the present application show the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowcharts can not be implemented in sequence, and the steps that have no logical contextual relationship can be reversed in sequence or implemented simultaneously. In addition, one or more other operations can be added to the flowcharts or one or more operations can be removed from the flowcharts under the guidance of the content of the present application.

[0019] In addition, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0020] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0021] In view of the technical problems raised in the background art, the present application provides an Ethernet-based SPI fast communication method, device, equipment, and medium, which can realize efficient data interaction between an MCU and an SOC in a car machine central control system by combining a virtual network card with an SPI, guarantee data transmission and reception to be reliable and orderly, and improve the communication stability and real-time performance of the car machine system.

[0022] Referring to the drawings in the description Figure 1 The present application provides an Ethernet-based SPI fast communication method, which is applied to data interaction between an MCU and an SOC (main chip of a car machine) in a car machine central control system. The method comprises the following steps: S1. When an upper layer daemon process responsible for managing a virtual network card opens a control interface of the virtual network card, a global variable created in advance is assigned a value, and the virtual network card is configured with parameters; S2. After the upper layer daemon process completes the parameter configuration of the virtual network card, the created write SPI thread and read SPI thread are set to a working state; S3, in the working state, based on the write SPI thread, first data transmitted by an application program APP running on the SOC is acquired, and the acquired first data is transmitted to the MCU through the SPI bus; and based on the read SPI thread, second data transmitted by the MCU is acquired, and the acquired second data is transmitted to the APP running on the SOC through the SPI bus.

[0023] Specifically, referring to the accompanying drawings Figure 2 When the upper layer daemon responsible for managing the virtual network card opens the control interface of the virtual network card, a global variable is assigned and the virtual network card is configured with parameters, including the following steps: S101, creating a global variable; S102, polling the control interface file of the virtual network card managed by the upper layer daemon through the control interface file of the virtual network card managed by the upper layer daemon; S103, after detecting that the control interface file is created, opening the control interface file and configuring the parameters of the virtual network card, and assigning the created global variable to find the virtual network card through the global variable.

[0024] In step S101, the creation of the global variable is directly declared in the kernel code by a variable definition statement. For example, it is defined by the statement struct tun_file = NULL, wherein struct tun_file is a virtual network card related data structure defined in the kernel, which indicates that it is a pointer to the structure, the g_ prefix indicates that it is a global variable, and the initial value is set to NULL (not associated with any device).

[0025] In step S102, the main operation is to poll the control interface file / dev / net / tun of the virtual network card managed by the upper layer daemon, that is, the upper layer daemon repeatedly checks whether the control interface file / dev / net / tun exists (such as checking every minute), until it is detected that the control interface file / dev / net / tun has been successfully generated, and then the polling is stopped and the subsequent parameter configuration operation is performed, thereby avoiding program errors caused by the fact that the control interface file / dev / net / tun has not been created, which is a basic step to ensure the reliable execution of the virtual network card initialization process.

[0026] It should be noted that the control interface file of the virtual network card is a bridge for the upper layer daemon to interact with the virtual network card driver in the kernel, but this control interface file does not exist automatically after the system starts, and it is usually created after the kernel is loaded or the related driver is initialized, so there may be a case where the file has not been generated when the upper layer daemon starts.

[0027] In step S103, when the control interface file / dev / net / tun is opened, a struct tun_file type data recording the detailed information of the virtual network card (such as device status, data buffer address, etc.) is generated, and the data is assigned to g_tfile, which is used by other codes in the kernel (such as the write SPI thread and the read SPI thread created subsequently) to find all the information of the virtual network card through g_tfile. In addition, the control interface file is configured with parameters, including basic function configuration, network identity configuration, and data path configuration. For example, it is registered as an Ethernet type virtual network card, is given a MAC address, an IP address, and is specified to send data in a certain direction. Finally, the virtual network card is changed from an inactive state to a normally working communication node.

[0028] In step S2, when the write SPI thread and the read SPI thread are created, a working function is written for each thread to define the specific task to be executed. For example, the function static int wspi_thread_func is defined for the write SPI thread thread_wspi, and the function static int rspi_thread_func is defined for the read SPI thread thread_rspi. The function of the write SPI thread thread_wspi is to cyclically listen to the output data of the virtual network card, and once the data sent by the APP is received, the data is sent to the MCU through the SPI. The function of the read SPI thread thread_rspi is to cyclically listen to the input data of the SPI bus, and once the data sent by the MCU is received, the data is forwarded to the APP through the virtual network card. Then, the kernel function kthread_run() is called to create the write SPI thread and the read SPI thread.

[0029] It should be noted that after the write SPI thread thread_wspi and the read SPI thread thread_rspi are created, the two threads will not start working immediately, but will enter a waiting state until the upper daemon completes the parameter configuration of the virtual network card and sends a parameter configuration completion signal, and then the two threads will switch from the waiting state to the working state. For example, the completion quantity tap_create_done is used to synchronize the start of the two threads to receive and send data, so that the write SPI thread thread_wspi and the read SPI thread thread_rspi start working only after the virtual network card is ready, so as to avoid data errors caused by improper timing.

[0030] In step S3, the SPI bus is a high-speed, full-duplex, synchronous serial communication protocol, and the SPI driver itself does not make any modification to the data, but only performs data forwarding. Before the virtual network card is configured with parameters, or in parallel with the initialization and configuration of the SPI bus, the communication mode and rate are configured. The communication rate of the SPI refers to the speed of data transmission on the SPI bus, which is usually determined by the frequency of the clock signal (SCLK) generated by the master device, from several hundred kHz to tens of MHz, and 10 MHz is selected here. The communication mode of the SPI mainly refers to the configuration of the polarity (CPOL) and phase (CPHA) of the SPI, which specifies the working mode of the SPI, that is, the sampling time and idle level, as shown in Table 1.

[0031]

[0032] Table 1 Referring to the accompanying drawings Figure 3 In an embodiment, the configuration of the virtual network card TAP0 is as follows: IP address (192.168.10.100), MAC address (0A:BC:01:05:32:11), and the TAP0 interface is specified to send data packets to the MCU network card (192.168.10.88) with this IP address. When an application APP (such as a navigation App or a vehicle status monitoring App) running on the SOC has data to send to the MCU, the data is sent to the kernel network protocol stack through the network socket for packaging processing. The processed data includes the data sent to the transmission buffer (tx_buf linked list) of the virtual network card tap0. Then, the SPI thread thread_wspi extracts the packaged data packet (sk_buf containing complete message information) from the transmission buffer (tx_buf linked list) of the virtual network card tap0, extracts the actual data therein, and sends the actual data to the MCU through the SPI bus. When the MCU has data to send to the application APP running on the SOC, the data message is transmitted to the SOC through the SPI bus. Then, the reading SPI thread thread_rspi receives the data, re-packages the data into a data packet (sk_buf) that meets the requirements according to the configuration of the virtual network card tap0, and places the data packet in the reception buffer (rx_buf linked list) of the virtual network card tap0, waiting to be transmitted to the App. The application APP running on the SOC takes the data sent by the MCU from the reception buffer of the virtual network card. This cycle is repeated, so that the upper-layer APP can use the Ethernet communication logic without modifying the APP code, and the SPI bus is adapted to the hardware bottom-layer communication, thereby realizing the bidirectional communication between the car machine software function (APP) and the hardware control (MCU).

[0033] It can be seen that the SPI fast communication method based on Ethernet provided by the application, compared with the previous Uart communication, transfers the complex data processing to the Ethernet, and the underlying transmission is realized through the SPI bus. The SPI fast communication method based on Ethernet provided by the application can fully utilize the rich Ethernet application layer protocol to simplify the software development process, and utilize the security features provided by the Ethernet to ensure the security of data transmission in the network; the developers can also utilize the existing Ethernet library and tools for rapid development, and reduce the workload of writing the communication protocol from scratch. Meanwhile, the SOC is rich in SPI resources, compared with the dedicated Ethernet PHY chip, it is more economical and practical; and the SPI driver is relatively simple and stable, which is helpful to speed up the development progress of the whole system.

[0034] Based on the same inventive concept, the application also provides an SPI fast communication device based on Ethernet. Since the principle of the device for solving the problem is similar to the above-mentioned SPI fast communication method based on Ethernet, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described here.

[0035] As shown in the accompanying drawings Figure 4 The application also provides an SPI fast communication device based on Ethernet, which is applied to the data interaction between the MCU and the SOC in the car head control system. The device comprises: A parameter configuration module 401, configured to assign values to the pre-created global variable and perform parameter configuration on the virtual network card when an upper layer daemon responsible for managing the virtual network card opens the control interface of the virtual network card; A wake-up module 402, configured to set the created write SPI thread and read SPI thread to the working state when the upper layer daemon completes the parameter configuration on the virtual network card; A transmission module 403, configured to, in the working state, acquire first data sent by an application program APP running on the SOC based on the write SPI thread, and transmit the acquired first data to the MCU through the SPI bus; and acquire second data sent by the MCU based on the read SPI thread, and transmit the acquired second data to the APP running on the SOC through the SPI bus.

[0036] In an embodiment, the parameter configuration module 401 assigns a value to a pre-created global variable and configures parameters of the virtual network card when an upper layer daemon responsible for managing the virtual network card opens a control interface of the virtual network card, including: creating a global variable; polling a control interface file of the virtual network card managed by the upper layer daemon; after detecting that the control interface file is created, opening the control interface file and configuring parameters of the virtual network card, and assigning a value to the created global variable to find the virtual network card through the global variable. The parameter configuration includes basic function configuration, network identity configuration, and data path configuration. The basic function configuration includes configuring device type and Ethernet frame. The network identity configuration includes configuring IP and MAC addresses. The data path configuration includes configuring routing rules.

[0037] In an embodiment, the wake-up module 402 sets the created write SPI thread and read SPI thread to a working state after the upper layer daemon completes parameter configuration of the virtual network card, including: creating a write SPI thread and a read SPI thread; after the upper layer daemon completes parameter configuration of the virtual network card, sending a parameter configuration completion signal to the write SPI thread and the read SPI thread; in response to the received parameter configuration completion signal, switching the write SPI thread and the read SPI thread from a waiting state to a working state.

[0038] In an embodiment, the transmission module 403 acquires first data sent by an application program APP running on a SOC based on the write SPI thread, and transmits the acquired first data to an MCU through an SPI bus, including: sending first data sent by an application program APP running on a SOC to an MCU to a network protocol stack for packaging processing, and sending a generated first data packet to a sending buffer of a virtual network card; based on the write SPI thread, extracting the first data packet from the sending buffer and performing decompression processing, and transmitting the obtained first data to the MCU through the SPI bus.

[0039] In an embodiment, the transmission module 403 acquires second data sent by an MCU based on the read SPI thread, and transmits the acquired second data to an application program APP running on a SOC through an SPI bus, including: based on the read SPI thread, acquiring second data sent by an MCU to an application program APP running on a SOC through an SPI bus; packaging the second data, and sending a generated second data packet to a sending buffer of a virtual network card for extraction by the application program APP running on the SOC.

[0040] In an embodiment, the apparatus further includes: The initialization module is configured to initialize the SPI bus, including configuring the communication mode and rate.

[0041] The Ethernet-based SPI fast communication device provided in the application is applied to data interaction between an MCU and an SOC in a car machine central control system, and when an upper layer daemon process responsible for managing a virtual network card opens a control interface of the virtual network card, a parameter configuration module assigns values to a global variable created in advance and performs parameter configuration on the virtual network card; when the upper layer daemon process completes parameter configuration on the virtual network card, a wake-up module sets a created write SPI thread and a read SPI thread to a working state; in the working state, based on the write SPI thread, the transmission module acquires first data sent by an application program APP running on the SOC, and transmits the acquired first data to the MCU through an SPI bus; and based on the read SPI thread, the transmission module acquires second data sent by the MCU, and transmits the acquired second data to the APP running on the SOC through the SPI bus. Thus, by combining the virtual network card with the SPI, efficient data interaction between the MCU and the SOC in the car machine central control system is realized, data receiving and sending are reliable and orderly, and the communication stability and real-time performance of the car machine system are improved.

[0042] Based on the same concept of the application, as shown in the description Figure 5 The electronic device 500 provided in the embodiment of the application includes at least one processor 501, at least one network interface 504 or other user interface 503, a memory 505, and at least one communication bus 502. The communication bus 502 is used to realize connection and communication between the components. The electronic device 500 can optionally include a user interface 503, including a display (for example, a touch screen, an LCD, a CRT, holographic imaging (Holographic), or a projector, etc.), a keyboard, or a clicking device (for example, a mouse, a trackball, a touchpad, or a touch screen, etc.).

[0043] The memory 505 can include a read-only memory and a random access memory, and provide instructions and data for the processor 501. A part of the memory 505 can also include a non-volatile random access memory (NVRAM).

[0044] In some embodiments, the memory 505 stores the following elements, executable modules or data structures, or a subset of them, or an extended set of them: An operating system 5051 includes various system programs, used to realize various basic services and process hardware-based tasks; The application program module 5052 includes various application programs, such as a desktop (launcher), a media player (MediaPlayer), a browser (Browser), and the like, for implementing various application services.

[0045] In the embodiment of the present application, the processor 501 is configured to execute the steps of the Ethernet-based SPI fast communication method by invoking the program or instruction stored in the memory 505.

[0046] The present application also provides a computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to perform the steps of the Ethernet-based SPI fast communication method.

[0047] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, and the like. When the computer program stored on the storage medium is executed, the virtual network card can be combined with the SPI to realize efficient data interaction between the MCU and the SOC in the in-vehicle infotainment system, guarantee reliable and orderly data transmission and reception, and improve the communication stability and real-time performance of the in-vehicle infotainment system.

[0048] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other manners. The described device embodiments are only schematic. For example, the division of the units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed coupling or direct coupling or communication connection between the units can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0049] The units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments.

[0050] In addition, each functional unit in the embodiments provided in the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0051] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts of the prior art that make contributions or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0052] Finally, it should be noted that: the above embodiments are only specific embodiments of the present application, which are used to illustrate the technical solutions of the present application, but not to limit them. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily think of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present application, or replace some technical features with equivalent ones. The modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. An Ethernet-based SPI fast communication method, characterized in that, The method is applied to data interaction between MCU and SOC in a car head unit system, and comprises the following steps: When an upper layer daemon responsible for managing a virtual network card opens a control interface of the virtual network card, a pre-created global variable is assigned and the virtual network card is configured with parameters; After the upper layer daemon completes the parameter configuration of the virtual network card, the created write SPI thread and read SPI thread are set to a working state; In the working state, first data sent by an application program (APP) running on the SOC is acquired based on the write SPI thread, and the acquired first data is transmitted to the MCU through an SPI bus; and second data sent by the MCU is acquired based on the read SPI thread, and the acquired second data is transmitted to the APP running on the SOC through the SPI bus.

2. The Ethernet-based SPI fast communication method according to claim 1, wherein, When an upper layer daemon responsible for managing a virtual network card opens a control interface of the virtual network card, a pre-created global variable is assigned and the virtual network card is configured with parameters, comprising the following steps: A global variable is created; A control interface file of a virtual network card managed by an upper layer daemon is polled; After detecting that the control interface file is created, the control interface file is opened and the virtual network card is configured with parameters, and the created global variable is assigned to find the virtual network card through the global variable.

3. The Ethernet-based SPI fast communication method according to claim 2, characterized in that, Wherein, The parameter configuration includes basic function configuration, network identity configuration, and data path configuration; the basic function configuration includes configuration of device type and Ethernet frame; the network identity configuration includes configuration of IP and MAC address; and the data path configuration includes configuration of routing rules.

4. The Ethernet-based SPI fast communication method according to claim 1, wherein, After the upper layer daemon completes the parameter configuration of the virtual network card, the created write SPI thread and read SPI thread are set to a working state, comprising the following steps: The write SPI thread and the read SPI thread are created; After the upper layer daemon completes the parameter configuration of the virtual network card, a parameter configuration completion signal is sent to the write SPI thread and the read SPI thread; In response to the received parameter configuration completion signal, the write SPI thread and the read SPI thread are switched from a waiting state to a working state.

5. The Ethernet-based SPI fast communication method according to claim 1, wherein, The write SPI thread and the read SPI thread are created; The first data sent by the application program (APP) running on the SOC to the MCU is sent to a network protocol stack for packaging processing, and a generated first data packet is sent to a sending buffer of the virtual network card; The first data packet is extracted from the sending buffer based on the write SPI thread and is decompressed, and the obtained first data is transmitted to the MCU through the SPI bus.

6. The Ethernet-based SPI fast communication method according to claim 5, wherein, The read SPI thread acquires second data sent by the MCU, and transmits the acquired second data to the APP running on the SOC through the SPI bus, comprising the following steps: Based on the read SPI thread, second data sent by the MCU to an application APP running on the SOC through the SPI bus is acquired; The second data is packaged, and a generated second data packet is sent to a sending buffer of the virtual network card, for extraction by the application APP running on the SOC.

7. The Ethernet-based SPI fast communication method according to claim 1, wherein, The method further includes the following steps: The SPI bus is initialized and configured, including configuration of a communication mode and rate.

8. An Ethernet-based SPI fast communication device, characterized in that, The device is applied to data interaction between an MCU and a SOC in a car machine central control system, and includes: A parameter configuration module is configured to assign values to a pre-created global variable and perform parameter configuration on the virtual network card when an upper-layer daemon process responsible for managing the virtual network card opens a control interface of the virtual network card; A wake-up module is configured to place a created write SPI thread and a read SPI thread in a working state after the upper-layer daemon process completes parameter configuration on the virtual network card; A transmission module is configured to, in the working state, acquire first data sent by an application APP running on the SOC based on the write SPI thread, and transmit the acquired first data to the MCU through the SPI bus; and acquire second data sent by the MCU based on the read SPI thread, and transmit the acquired second data to the application APP running on the SOC through the SPI bus.

9. An electronic device, comprising: The device includes: A processor, a memory, and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating through the bus when the electronic device is running, the machine-readable instructions being executed by the processor to perform the steps of the SPI fast communication method based on Ethernet according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which is executed by the processor to perform the steps of the SPI fast communication method based on Ethernet according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Virtual private network based on any link of embedded ARM-Linux platforms

    CN104065556A

  • Image data transmission method, image processing method and related equipment

    CN117692595A

  • Data transmission method and device, vehicle-mounted terminal and storage medium

    CN118535510A

  • SPI-based data transmission method, chip, controller, and storage medium

    WO2024178923A1