A method for solving the problem of MCU AD data acquisition distortion caused by rpmsg communication under multi-core heterogeneity
By using soft interrupts instead of rpmsg framework in multi-core heterogeneous systems, the communication process between cores is simplified, the problem of distortion of AD data acquisition by MCU is solved, and the timely acquisition and accuracy of AD data is achieved, which is suitable for industrial AD data acquisition.
Patent Information
- Application Number
- CN202411469968.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2044-10-21
AI Technical Summary
In multi-core heterogeneous systems, rpmsg communication causes distortion in MCU's AD data acquisition. In the prior art, MCU performance is low, rpmsg framework programs are complex, and communication takes too long, resulting in untimely acquisition of AD data.
Soft interrupts are used to replace rpmsg framework for inter-core communication. The MCU module collects AD data on low-performance cores and caches them in shared memory. It notifies the Linux system to read through soft interrupts, simplifying the communication process.
It greatly reduces the time-consuming communication between cores, ensures timely collection of AD data, improves data accuracy, and provides a reliable solution for industrial AD data acquisition.
Smart Images

Figure CN119376978B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of multi-core heterogeneous technology, and in particular to a method for resolving distortion of AD data collected by an MCU caused by RPMSG communication in a multi-core heterogeneous environment. Background Art
[0002] In recent years, with the development of embedded chip technology, more and more embedded processors use multi-core heterogeneous designs. Multi-core heterogeneity means that there are multiple cores in a SOC (system on chip), and all cores are of different types (the architecture and instruction set are not the same), and the performance varies greatly: Take the Rockchip RK3562 chip as an example. Its four internal Cortex-A53 cores are specially designed for high-performance computing, while the other Cortex-M0 core is designed for simple computing and low power consumption; this design can better balance the overall performance and power consumption of the SOC.
[0003] Because AD data acquisition programs are not logically complex and require significant CPU time, heterogeneous multi-core systems tend to use low-performance, low-power cores for AD data acquisition. However, collected AD data often requires further processing, such as storage, display, and computational analysis. This requires an operating system, which typically operates on a high-performance core within the SoC. Communication between the high-performance and low-performance cores within the SoC is required to retrieve the AD data collected by the MCU.
[0004] The existing multi-core heterogeneous AD acquisition system, implemented on the Rockchip RK3562 platform, runs Linux on its four Cortex-A53 cores and a bare-metal program for collecting AD data on its Cortex-M0 core. Inter-core communication and interrupts are implemented using the rpmsg framework: the MCU collects AD data, caches it in shared memory, and initiates an rpmsg notification after collecting a specific sampling point. Upon receiving the rpmsg notification, the Linux system reads the AD data from shared memory and processes it. However, due to the low performance of the MCU and the complex program layers of the rpmsg framework, rpmsg is not suitable for low-performance cores. This results in long communication times when the MCU initiates an rpmsg notification, which interrupts the MCU's AD data collection for an extended period of time. This prevents the MCU from collecting AD data for the next sampling point in a timely manner, which can easily lead to distorted AD data collected by low-performance MCUs. Summary of the Invention
[0005] (1) Technical problems solved
[0006] In view of the deficiencies of the prior art, the present invention provides a method for solving the problem of distorted AD data acquisition by the MCU caused by rpmsg communication under multi-core heterogeneous conditions, which can solve the problem of distorted AD data acquisition by the MCU in a multi-core heterogeneous system.
[0007] (2) Technical solution
[0008] To solve the above technical problems, the present invention provides the following technical solution: A method for solving the problem of distorted AD data acquisition by the MCU caused by rpmsg communication under multi-core heterogeneous conditions, comprising the following steps:
[0009] S1. The MCU module acquires AD data; wherein, the MCU module runs on the first core;
[0010] S2. The MCU module caches the AD data in the shared memory;
[0011] S3. The MCU module sends a soft interrupt notification to the Linux system. After the soft interrupt notification is sent, the MCU module continues to acquire new AD data; wherein, the Linux system runs on the second core;
[0012] S4. The Linux system receives the soft interrupt notification;
[0013] S5. The Linux system reads the AD data from the shared memory.
[0014] Preferably, the MCU module includes an AD data acquisition unit; step S1 is specifically: the AD data acquisition unit acquires AD data from the AD sampling chip.
[0015] Preferably, the MCU module further includes a first shared memory management unit; step S2 is specifically: the AD data acquisition unit caches the AD data in the shared memory through the first shared memory management unit.
[0016] Preferably, the MCU module further includes a soft interrupt control unit; step S3 specifically includes: after the AD data acquisition unit acquires AD data of a specific number of sampling points, the soft interrupt control unit sends a soft interrupt notification to the Linux system through the interrupt controller.
[0017] Preferably, the Linux system includes a soft interrupt driver unit; step S4 is specifically: the soft interrupt driver unit receives the soft interrupt notification through the interrupt controller.
[0018] Preferably, the Linux system further includes a Linux application unit and a second shared memory management unit; step S5 is specifically: after the soft interrupt driver unit receives the soft interrupt notification, the Linux application unit drives the second shared memory management unit to read the AD data from the shared memory.
[0019] Preferably, after step S5, there is further included step S6: the Linux system processes the AD data.
[0020] Preferably, step S6 is specifically: the Linux system stores, displays, or calculates and analyzes the AD data.
[0021] (III) Advantageous Effects
[0022] Compared with the prior art, the present invention provides a method for solving the problem that rpmsg communication under multi-core heterogeneous causes the MCU to collect distorted AD data, and has the following advantageous effects: compared with the prior art that uses the rpmsg framework to implement inter-core communication and inter-core interrupts, the present invention uses a soft interrupt to replace the rpmsg inter-core interrupt function to achieve communication between cores. Compared with the relatively complex rpmsg framework at the program level, the soft interrupt can achieve inter-core interrupts with a simple program level. Therefore, the soft interrupt is suitable for running on low-performance cores. By using the soft interrupt, the present invention can greatly reduce the time consumption of the low-performance core in the multi-core heterogeneous system to initiate inter-core communication, enabling the MCU to timely collect the AD data of the next sampling point, thereby preferably solving the problem that the AD data collected by the MCU is distorted, ensuring the accuracy of the collected AD data, and providing a reliable MCU AD data collection solution under multi-core heterogeneous for industrial AD data collection application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 is a flowchart of a method for solving the problem that rpmsg communication under multi-core heterogeneous causes the MCU to collect distorted AD data according to the present invention;
[0024] Figure 2 is a schematic block diagram of a method for solving the problem that rpmsg communication under multi-core heterogeneous causes the MCU to collect distorted AD data according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0026] The present invention provides a method for solving the problem that rpmsg communication under multi-core heterogeneous causes the MCU to collect distorted AD data, including the following steps:
[0027] S1. The MCU module collects AD data.
[0028] Among them, the MCU (Microcontroller Unit) module runs on the first core.
[0029] Specifically, the MCU module includes an AD data acquisition unit; step S1 is specifically: the AD data acquisition unit acquires AD data from the AD sampling chip, where the AD data is digital signal data.
[0030] S2. The MCU module caches the AD data in the shared memory.
[0031] Preferably, the MCU module further includes a first shared memory management unit; step S2 is specifically: the AD data acquisition unit caches the AD data in the shared memory through the first shared memory management unit. The shared memory can specifically adopt DDR (Double Data Rate Synchronous Dynamic Random Access Memory).
[0032] S3. The MCU module sends a soft interrupt (Softirq) notification to the Linux system; after the soft interrupt notification is sent, the MCU module continues to acquire new AD data, that is, the MCU module continues to acquire the AD data of the next sampling point, and so on in a cycle.
[0033] Among them, the Linux system runs on the second core. Specifically, the above-mentioned first core is a low-performance power consumption core, and the second core is a high-performance core; the first core can specifically be a Cortex-M0 core, and the second core can specifically be a Cortex-A53 core. The first core and the second core can specifically exist in the multi-core heterogeneous system of the Rockchip RK3562 chip; of course, the first core and the second core can also adopt different types and different performance cores of other embedded processors in the prior art, and no more restrictions are made here.
[0034] The above-mentioned MCU module further includes a soft interrupt control unit; step S3 specifically includes: after the AD data acquisition unit acquires the AD data of a specific sampling point, the soft interrupt control unit sends a soft interrupt notification to the Linux system through the interrupt controller.
[0035] S4. The Linux system receives the soft interrupt notification.
[0036] Specifically, the Linux system includes a soft interrupt driver unit; step S4 is specifically: the soft interrupt driver unit receives the soft interrupt notification through the interrupt controller, that is, the Linux system waits to receive the soft interrupt notification through the soft interrupt driver unit.
[0037] S5. The Linux system reads the AD data from the shared memory.
[0038] Preferably, the Linux system further includes a Linux application unit and a second shared memory management unit; specifically, step S5 is as follows: after the soft interrupt driver unit receives a soft interrupt notification, the Linux application unit drives the second shared memory management unit to read the AD data from the shared memory.
[0039] Among them, when the Linux system receives a soft interrupt notification initiated by the MCU module, the Linux system immediately aborts the program it is running and transfers to the program event corresponding to processing the soft interrupt notification: that is, the Linux system reads the AD data from the shared memory.
[0040] It can be understood that in the MCU module (i.e., the MCU bare-metal program) of the present invention, by building a simple Softirq soft interrupt control code and combining it with shared memory to replace the rpmsg framework, communication with the Linux system is achieved. In the Linux system, a Softirq soft interrupt driver and a shared memory management program are built based on the character device framework, and in cooperation with the Linux application program, communication with the MCU bare-metal program is achieved. The above MCU module and Linux system correspond to the software layer, while the first core, the second core, the shared memory, the interrupt controller, and the AD sampling chip correspond to the hardware layer.
[0041] It should be understood that (1) at one end of the Cortex-M0 core, i.e., the first core (running the MCU bare-metal program): since only writing registers is required to initiate a Softirq soft interrupt, the control flow is simple; the present invention uses the Softirq soft interrupt method to replace the existing rpmsg for inter-core communication, which can avoid problems such as the need to apply for memory and the long code call chain in the relatively complex rpmsg communication process; (2) at one end of the Cortex-A53 core, i.e., the second core (running the Linux system): the soft interrupt driver unit consists of interrupt response code + code for notifying the application unit after responding to the interrupt, which can avoid the relatively complex process of interrupt + queuing to process data in the rpmsg communication process and reduce the time-consuming of inter-core communication. Considering the optimizations in the above (1) and (2) points, through actual measurement, it is obtained that the present invention using soft interrupts can reduce the inter-core communication time-consuming by about 100 μs compared with the prior art using the rpmsg framework.
[0042] Preferably, after the Linux system successfully completes the reading of the AD data, the Linux system can send a response result of the soft interrupt notification to the MCU module.
[0043] In addition, after step S5, there is also step S6: the Linux system processes the AD data; specifically, the Linux system performs processing operations such as storing, displaying, or calculating and analyzing the AD data.
[0044] Preferably, the above soft interrupt notification may include the specific cache address of the AD data in the shared memory, so that the Linux system can accurately read the AD data from the shared memory accordingly. Additionally, to better solve the problem of AD data distortion, the AD data acquisition unit of the MCU module may also be connected to the resource management unit of the third core. When the MCU module initiates the above soft interrupt notification, the resource management unit provides the idle resources of the third core to the AD data acquisition unit, so that the AD data acquisition unit can continuously and normally collect AD data from the AD sampling chip during the initiation of the soft interrupt notification; after the initiation of the soft interrupt notification is completed, the resource management unit terminates providing the idle resources of the third core to the AD data acquisition unit.
[0045] Compared with the prior art, the present invention provides a method for solving the problem of AD data distortion in MCU acquisition due to rpmsg communication under multi-core heterogeneous conditions, and has the following beneficial effects: Compared with the prior art that uses the rpmsg framework to implement inter-core communication and inter-core interrupts, the present invention uses a soft interrupt to replace the rpmsg inter-core interrupt function to achieve communication between cores. Compared with the relatively complex rpmsg framework at the program level, the soft interrupt can achieve inter-core interrupts with a simple program level. Therefore, the soft interrupt is suitable for low-performance cores to run. By using the soft interrupt, the present invention can significantly reduce the time consumption of the low-performance core in initiating inter-core communication in a multi-core heterogeneous system, enabling the MCU to timely collect the AD data of the next sampling point, thus better solving the problem of AD data distortion in the MCU acquisition, ensuring the accuracy of the collected AD data, and providing a reliable MCU AD data acquisition solution under multi-core heterogeneous conditions for industrial AD data acquisition application scenarios.
[0046] It should be noted that the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the said element.
[0047] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principle and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for solving the problem of distorted AD data acquisition by MCU caused by rpmsg communication under multi-core heterogeneous conditions, characterized in that, It includes the following steps: S1. The MCU module collects AD data; wherein, the MCU module runs on the first core; S2. The MCU module caches the AD data in the shared memory; S3. The MCU module sends a soft interrupt notification to the Linux system, and after the soft interrupt notification is sent, the MCU module continues to collect new AD data; wherein, the Linux system runs on the second core; S4. The Linux system receives the soft interrupt notification; S5. The Linux system reads the AD data from the shared memory; The MCU module includes an AD data acquisition unit; specifically, step S1 is: the AD data acquisition unit collects the AD data from the AD sampling chip; The AD data acquisition unit of the MCU module is connected to the resource management unit of the third core. When the MCU module sends the soft interrupt notification, the resource management unit provides the idle resources of the third core to the AD data acquisition unit; after the soft interrupt notification is sent, the resource management unit stops providing the idle resources of the third core to the AD data acquisition unit.
2. The method for solving the problem that MCU collects AD data with distortion caused by rpmsg communication under multi-core heterogeneity according to claim 1, wherein: The MCU module further includes a first shared memory management unit; specifically, step S2 is: the AD data acquisition unit caches the AD data in the shared memory through the first shared memory management unit.
3. The method for solving the distortion of MCU-acquired AD data caused by rpmsg communication under multi-core heterogeneity according to claim 2, wherein: The MCU module further includes a soft interrupt control unit; specifically, step S3 includes: after the AD data acquisition unit collects the AD data of a specific sampling point, the soft interrupt control unit sends the soft interrupt notification to the Linux system through the interrupt controller.
4. The method for solving the problem that the MCU collects distorted AD data due to rpmsg communication under multi-core heterogeneity according to claim 3, characterized in that: The Linux system includes a soft interrupt driver unit; specifically, step S4 is: the soft interrupt driver unit receives the soft interrupt notification through the interrupt controller.
5. The method for solving the problem that MCU collects AD data with distortion caused by rpmsg communication under multi-core heterogeneity according to claim 4, wherein: The Linux system further includes a Linux application unit and a second shared memory management unit; specifically, step S5 is: after the soft interrupt driver unit receives the soft interrupt notification, the Linux application unit drives the second shared memory management unit to read the AD data from the shared memory.
6. The method for solving the distortion of MCU - collected AD data caused by rpmsg communication under multi - core heterogeneity according to claim 1, characterized in that: After step S5, there is also step S6: the Linux system processes the AD data.
7. The method for solving the distortion of MCU - collected AD data caused by rpmsg communication under multi - core heterogeneity according to claim 6, characterized in that: Specifically, step S6 is: the Linux system stores, displays, or performs computational analysis on the AD data.
Citation Information
Patent Citations
PCI (Programmable Communication Interface) bus data synchronization method based on RTX (Real Time eXpert) real-time extending subsystem
CN104239250A
Multi-core communication system of ultrasonic radar and using method
CN113325398A