Network data processing method, storage medium and electronic device

By using the main MCU to process Ethernet packets in the combined MCU embedded system, multiple slave MCUs support data services, and interact with serial port mode, the problem of using fewer physical network card resources to process network data is solved, and high generality is achieved and scalability, suitable for a variety of MCU combinations, improving system stability and performance.

CN116232995BActive Publication Date: 2024-12-24GUANGZHOU ASENSING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310234638.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-10
Publication Date
2024-12-24
Estimated Expiration
2043-03-10

AI Technical Summary

Technical Problem

The prior art is difficult to use less physical network card resources to realize effective processing of network data in combination with MCU embedded systems. Especially in the demand for Ethernet services and real-time communication in autonomous driving equipment, traditional single-chip design is difficult to take into account stability and performance.

Method used

In the combined MCU embedded system, the main MCU is responsible for receiving and sending Ethernet data packets, and multiple slave MCUs support the corresponding Ethernet data processing services respectively. The data interaction is performed using a common serial port mode between the main MCU and the slave MCU. , ensure sufficient computing power and memory resources, and add verification flags at the end of the data packet to ensure data integrity.

Benefits of technology

It realizes the high versatility and expansion of the combined MCU embedded system, can process more and more complex network data, ensure sufficient computing power and sufficient memory resources, and is suitable for multiple types of MCU combinations, improving system flexibility and universality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116232995B_ABST
    Figure CN116232995B_ABST
Patent Text Reader

Abstract

The network data processing method, storage medium and electronic device provided in the embodiments of the present application relate to the field of network data technology. The combined MCU embedded system includes a main MCU and a slave MCU that are communicatively connected, and the IP address of each slave MCU is stored in the main MCU. The network data processing method of the main MCU includes: obtaining a data packet from Ethernet, the data packet containing data and a target IP address; according to the target IP address of the data packet, sending the data of the data packet to the slave MCU of the target IP address. The combined MCU embedded structure in which the main MCU is responsible for receiving and sending Ethernet data packets and one or more slave MCUs respectively support corresponding Ethernet data processing services can ensure sufficient computing power and memory resources. The master MCU and the slave MCU use a universal serial port mode for data exchange, so that the entire combined MCU embedded system has higher versatility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network data technology, and in particular to an Ethernet data processing method, a storage medium and an electronic device. Background Art

[0002] With the rapid development of autonomous driving and in-vehicle Ethernet technology, users have higher and higher requirements for the component performance and real-time performance of autonomous driving equipment ECU. Traditional single-chip designs often cannot take into account the long-term stability of Ethernet services and basic functions. Usually, multi-core chips or multiple MCUs are required to build a more powerful embedded system.

[0003] For embedded systems composed of combined MCUs, each MCU unit usually has Internet access requirements, such as over-the-air software upgrades (Firmware Over The Air, FOTA) of mobile terminals, third-party software development kit (Software Development Kit, SDK) integration (dependent on external network communication), real-time Ethernet communication, etc. Considering the cost of configuring Ethernet communication conditions for all MCUs and the complexity of the network architecture, the number of physical network cards in the entire embedded system is generally reduced as much as possible.

[0004] Therefore, how to use fewer physical network card resources to achieve effective network data processing of combined MCU embedded systems is a technical problem that needs to be solved. Summary of the invention

[0005] The purpose of this application is to provide a network data processing method, a storage medium and an electronic device to solve the technical problem in the prior art of how to use fewer physical network card resources to achieve effective processing of network data in a combined MCU embedded system.

[0006] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions.

[0007] In a first aspect, an embodiment of the present application provides a network data processing method, which is applied to a master MCU of a combined MCU embedded system, wherein the combined MCU embedded system includes a master MCU and a slave MCU that are communicatively connected, and the master MCU stores an IP address of each slave MCU; the network data processing method includes:

[0008] Obtain a data packet from the Ethernet, the data packet including data and a target IP address;

[0009] According to the target IP address of the data packet, the data of the data packet is sent to the slave MCU of the target IP address.

[0010] Optionally, according to the target IP address of the data packet, the step of sending the data of the data packet to the slave MCU of the target IP address includes:

[0011] According to the target IP address, determining whether the data packet is a broadcast packet;

[0012] If yes, the data of the packet is sent to all slave MCUs;

[0013] If not, the data of the data packet is sent to the slave MCU that can correspond to the target IP address.

[0014] Optionally, the step of sending the data of the data packet to a slave MCU corresponding to the target IP address includes:

[0015] The IP addresses of each slave MCU are compared with the target IP address one by one to determine whether they match. If a match is found, it is determined that the data packet is the IP address data packet of the slave MCU.

[0016] Optionally, before the step of sending the data of the data packet to the slave MCU of the target IP address according to the target IP address of the data packet, the network data processing method further includes:

[0017] A checksum flag is added at the end of the data packet to provide the receiver MCU with a basis for checking the integrity of the data packet.

[0018] Optionally, the check flag is a single-byte XOR checksum or a double-byte XOR checksum.

[0019] In a second aspect, an embodiment of the present application provides a network data processing method, which is applied to a slave MCU of a combined MCU embedded system, wherein the combined MCU embedded system includes the slave MCU and the master MCU in the network data processing method of the first aspect, and the master MCU is communicatively connected with the slave MCU; the network data processing method includes:

[0020] Acquire a data packet from the main MCU;

[0021] The check mark of the data packet is checked, and the data packets that fail the check are discarded.

[0022] Optionally, the network data processing method includes:

[0023] Process the data packets that pass the verification to obtain result data packets;

[0024] A result check flag is added at the end of the result data packet and sent to the main MCU.

[0025] Optionally, the result check flag is a single-byte XOR checksum or a double-byte XOR checksum.

[0026] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program or instructions are stored. When the computer program or instructions are executed by a computing device, the network data processing method of the first aspect or the second aspect is implemented.

[0027] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is electrically connected to the processor, an executable program is stored in the memory, and when the processor executes the executable program, the network data processing method of the first aspect or the second aspect is implemented.

[0028] Compared with the prior art, this application has the following beneficial effects:

[0029] The network data processing method provided in the embodiment of the present application can ensure sufficient computing power and memory resources through a combined MCU embedded structure in which a main MCU is responsible for receiving and sending Ethernet data packets and one or more slave MCUs respectively support corresponding Ethernet data processing services.

[0030] The master MCU and the slave MCU use a universal serial port mode for data exchange, so that almost all types of MCUs can be used as hosts and slaves, so that the communication between the master MCU and the slave MCU has more diverse combinations, and the entire combined MCU embedded system has higher versatility, that is, the embedded system can process more and larger amounts of network data. Therefore, it can be used as a network data processing method with more flexible combination, higher versatility and stronger scalability. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0032] Figure 1 A schematic diagram of an MCU in a combined MCU embedded system provided in an embodiment of the present application;

[0033] Figure 2 A flow chart of a network data processing method of a main MCU provided in an embodiment of the present application;

[0034] Figure 3A flow chart of a network data processing method with adding a check mark at the end of a data packet provided in an embodiment of the present application;

[0035] Figure 4 A schematic diagram of a network data processing method from an MCU provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. The described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described in the drawings here can be arranged and designed in various different configurations.

[0037] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application. In the absence of conflict, the following embodiments and features in the embodiments may be combined with each other.

[0038] In the description of this application, it should be noted that 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. The term "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium.

[0039] In existing embedded systems composed of combined MCUs, each MCU unit usually has Internet access requirements. Considering the cost of configuring Ethernet communication conditions for all MCUs and the complexity of the network architecture, the number of physical network cards in the entire embedded system is generally reduced as much as possible.

[0040] How to use fewer physical network card resources to achieve effective network data processing in a combined MCU embedded system is a technical problem that needs to be solved.

[0041] The processing method for MCU and Linux network can be based on the fact that MCU and SOC belong to multi-core heterogeneous mode, MCU and SOC are integrated on the same chip, and network data is interactively shared by core-to-core communication, thereby achieving the technical effect of meeting the Internet access needs of different types of processor cores through one physical network card.

[0042] Although this method can achieve the effect of network data intercommunication and sharing when multi-core heterogeneous chips are used as the core of embedded systems, this method is limited to multi-core heterogeneous chips. At the same time, the inter-core communication method is only applicable to a very small number of chips with shared memory hardware conditions, and its versatility is not high.

[0043] The above method is not applicable to a more flexible combination MCU embedded system in the form of one master and multiple slaves (one master MCU and multiple slave MCUs). When the computing power or resources of multi-core heterogeneous chips are insufficient, network data cannot be shared by using more MCUs, and the scalability is poor.

[0044] In order to overcome the above problems, an embodiment of the present application provides a network data processing method, which is applied to the main MCU in a combined MCU embedded system. The combined MCU embedded system includes the main MCU and slave MCUs that are communicatively connected, and the IP address of each slave MCU is stored in the main MCU.

[0045] The main MCU can refer to Figure 1 The main MCU 10 includes a memory 11 and a processor 12. The memory 11 and the processor 12 are electrically connected to each other directly or indirectly to achieve data transmission or interaction.

[0046] For example, the memory 11 and the processor 12 may be electrically connected to each other via one or more communication buses or signal lines. The memory 11 stores computer programs or instructions, and the processor 12 executes various functional applications and data processing by running the software programs and modules stored in the memory 11, that is, implementing the network data processing method in the embodiment of the present application.

[0047] Understandably, Figure 1 The structure shown is for illustration only. The electronic device 10 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0048] For data compatibility, a wired communication module may also be provided as an interface. The master MCU may include a physical network card module and may be connected to the slave MCU via a serial port.

[0049] refer to Figure 2 , the network data processing method of the main MCU of the embodiment of the present application includes:

[0050] S1. Get a data packet from Ethernet, which contains data and target IP address;

[0051] S2. According to the target IP address of the data packet, the data of the data packet is sent to the slave MCU of the target IP address.

[0052] The network data processing method provided in the embodiment of the present application can ensure sufficient computing power and memory resources through a combined MCU embedded structure in which the main MCU is responsible for receiving and sending Ethernet data packets and one or more slave MCUs respectively support corresponding Ethernet data processing services. The master MCU and the slave MCU use a universal serial port mode for data exchange, so that almost all types of MCUs can be used as hosts and slaves, so that the communication between the master MCU and the slave MCU has more diverse combinations, and the entire combined MCU embedded system has higher versatility, that is, the embedded system can universally process more and larger amounts of network data. Therefore, it can be used as a network data processing method with more flexible combination, higher versatility and stronger expansibility.

[0053] There may be multiple types of data packets. One type of data packet may be a data packet that needs to be sent to all slave MCUs, and another type of data packet is a data packet sent to a specified slave MCU. The specified slave MCU may be one or more.

[0054] In order to distinguish which of the above data packets are, step S2 may be set to include:

[0055] S2-1. According to the target IP address, determine whether the data packet is a broadcast packet; if so, execute step S2-2; if not, execute step S2-3;

[0056] S2-2. Send the data of the data packet to all slave MCUs;

[0057] S2-3. Send the data of the data packet to the slave MCU that can correspond to the target IP address.

[0058] In step S2-1, the target IP address for determining whether the data packet is a broadcast packet can be set to 255.255.255.255. If the target IP address of the Ethernet data packet is 255.255.255.255, the Ethernet data packet is determined to be a broadcast packet.

[0059] In the above step S2-3, in order to find a slave MCU that corresponds to the target IP address, the IP addresses of each slave MCU may be compared with the target IP address one by one to determine whether they match.

[0060] If a match is found, it is determined that the data packet is the IP address data packet of the slave MCU, that is, it should be sent to the slave MCU with the specified IP address. Then, according to the target IP address of the data packet, it can be sent to the slave MCU with the specified IP address.

[0061] The purpose of comparing the IP addresses of each slave MCU with the target IP address is to prevent omissions. The comparison can be performed one by one in a preset order, or the algorithm can be set according to the specific information of the data packet and the comparison can be performed in the order that the algorithm can produce.

[0062] To further ensure that accurate data information can be received from the MCU, you can set the following steps:

[0063] S3. Add a check mark at the end of the data packet to provide the receiver with a basis for checking the integrity of the data packet from the MCU. Figure 3 , step S3 can be set before step S2 or after step S1.

[0064] In order to reduce development time costs and computing resource consumption, and at the same time there is no need to consider security and encryption issues within the embedded system, the above-mentioned check flag can be a single-byte XOR checksum, and the above-mentioned check flag can also be a double-byte XOR checksum, which can realize the check function concisely and effectively.

[0065] If the data packet itself contains a check bit, the check flag bit may not be set and the original check bit method may be used.

[0066] Based on the above embodiments, the present application also provides a network data processing method for a slave MCU applied to a combined MCU embedded system. The structure of the slave MCU can also refer to Figure 1 , including memory and processor. At startup, all slave MCUs can start the serial communication function with the master MCU by initializing the serial communication function and Ethernet protocol stack. The initialized Ethernet protocol stack can parse the complete Ethernet data packet from the serial port into raw data and inject it into its own application layer service for processing.

[0067] The data packet received from the MCU may carry a check mark. In this case, the network data processing method from the MCU includes:

[0068] S10. Get data packets from the main MCU;

[0069] S20. Check the check flag of the data packet and discard the data packet that fails the check.

[0070] After the verification is passed, the complete Ethernet data packet minus the check bit is injected from the MCU into the Ethernet protocol stack, and then the complete original data is parsed and input into the service function of the application layer for processing.

[0071] Furthermore, the slave MCU can also have the function of uploading data to Ethernet, so if Figure 4 , the network data processing method from the MCU can also be set to:

[0072] S30. Process the data packet that passes the verification to obtain the result data packet;

[0073] S40. Add a result check flag at the end of the result data packet and send it to the main MCU.

[0074] The result checksum flag is a single-byte XOR checksum or a double-byte XOR checksum, which implements the checksum function concisely and effectively.

[0075] Based on the above embodiment, the embodiment of the present application further provides a computer-readable storage medium, in which a computer program or instruction is stored, and when the computer program or instruction is executed by a computing device, the network data processing method of the main MCU is implemented, that is, as a memory of the main MCU.

[0076] Based on the above embodiment, the embodiment of the present application further provides a computer-readable storage medium, in which a computer program or instruction is stored, and when the computer program or instruction is executed by a computing device, the above-mentioned network data processing method of the slave MCU is implemented, that is, as a memory of the slave MCU.

[0077] Based on the above embodiments, the embodiments of the present application also provide an electronic device, which includes a memory and a processor, the memory is electrically connected to the processor, an executable program is stored in the memory, and when the processor executes the executable program, the network data processing method of the above-mentioned main MCU is implemented, that is, the electronic device acts as the main MCU.

[0078] Based on the above embodiments, the embodiments of the present application also provide an electronic device, which includes a memory and a processor. The memory is electrically connected to the processor, and an executable program is stored in the memory. When the processor executes the executable program, the above-mentioned network data processing method of the slave MCU is implemented, that is, the electronic device acts as a slave MCU.

[0079] The above-described device and system embodiments are merely illustrative, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. A person skilled in the art may understand and implement the present embodiment without creative effort.

[0080] The above are only preferred specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A network data processing method, characterized in that: A master MCU applied to a combined MCU embedded system, wherein the combined MCU embedded system comprises the master MCU and slave MCUs that are communicatively connected, and the master MCU stores an IP address of each slave MCU; All slave MCUs can start the serial port communication function with the master MCU by initializing the serial port communication function and the Ethernet protocol stack. The initialized Ethernet protocol stack can parse the complete Ethernet data packet from the serial port into raw data and inject it into the service of its own application layer for processing; The network data processing method comprises: Obtain a data packet from the Ethernet, the data packet including data and a target IP address; A check mark is added at the end of the data packet to provide the receiver with a basis for checking the integrity of the data packet from the MCU. After the check is passed, the complete Ethernet data packet without the check mark is injected from the MCU into the Ethernet protocol stack, and then the complete original data is parsed and input into the service function of the application layer for processing; According to the target IP address of the data packet, the data of the data packet is sent to the slave MCU of the target IP address.

2. The network data processing method according to claim 1, characterized in that: According to the target IP address of the data packet, the step of sending the data of the data packet to the slave MCU of the target IP address comprises: According to the target IP address, determining whether the data packet is a broadcast packet; If yes, the data of the packet is sent to all slave MCUs; If not, the data of the data packet is sent to the slave MCU that can correspond to the target IP address.

3. The network data processing method according to claim 2, characterized in that: The steps of sending the data of the data packet to the slave MCU corresponding to the target IP address include: The IP addresses of each slave MCU are compared with the target IP address one by one to determine whether they match. If a match is found, it is determined that the data packet is the IP address data packet of the slave MCU.

4. The network data processing method according to claim 1, characterized in that: The check flag bit is a single-byte XOR checksum or a double-byte XOR checksum.

5. A network data processing method, characterized in that: A slave MCU applied to a combined MCU embedded system, the combined MCU embedded system comprising the slave MCU and the master MCU according to any one of claims 1 to 4, the master MCU being communicatively connected with the slave MCU; the slave MCU can start the serial port communication function with the master MCU by initializing the serial port communication function and the Ethernet protocol stack, and the initialized Ethernet protocol stack can parse the complete Ethernet data packet from the serial port into raw data, and inject it into the service of its own application layer for processing; The network data processing method comprises: Acquire a data packet from the main MCU; The check flag of the data packet is checked, and the data packets that fail the check are discarded. After the check passes, the complete Ethernet data packet without the check bit is injected into the Ethernet protocol stack, and then the complete original data is parsed and input into the service function of the application layer for processing.

6. The network data processing method according to claim 5, characterized in that: The network data processing method comprises: Process the data packets that pass the verification to obtain result data packets; A result check flag is added at the end of the result data packet and sent to the main MCU.

7. The network data processing method according to claim 6, characterized in that: The result check flag is a single-byte XOR checksum or a double-byte XOR checksum.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instruction. When the computer program or instruction is executed by a computing device, the network data processing method according to any one of claims 1 to 7 is implemented.

9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory is electrically connected to the processor, an executable program is stored in the memory, and when the processor executes the executable program, the network data processing method described in any one of claims 1-7 is implemented.