Communication method, multi-core embedded MCU and communication device

By configuring the core communication peripherals in the multi-core embedded MCU and realizing data transmission, the problem of adapting a dedicated data communication interface when replacing the dual-core MCU is solved, reducing the cost of communication research and development and improving efficiency.

CN119557259APending Publication Date: 2025-03-04SHENZHEN SUPLET
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411632785.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

When the prior art replaces a single-core MCU with a dual-core MCU, it is necessary to adapt a dedicated data communication interface and re-edit the communication code, resulting in high communication research and development costs.

Method used

By configuring the communication peripherals of the first core and the second core in the multi-core embedded MCU, and connecting the data sending pin of the first communication peripheral to the data receiving pin of the second communication peripheral, data transmission between the cores is realized without the use of a dedicated data communication interface.

Benefits of technology

It reduces the communication R&D cost of multi-core embedded MCUs, reduces the time to redesign and edit communication codes, and improves the code reusability and communication R&D efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557259A_ABST
    Figure CN119557259A_ABST
Patent Text Reader

Abstract

The invention discloses a communication method, a multi-core embedded MCU (Microprogrammed Control Unit) and a communication device. The scheme is applied to a multi-core embedded MCU, the multi-core embedded MCU at least comprises a first core and a second core, the first core is configured with a first communication peripheral, the second core is configured with a second communication peripheral, and a data sending pin of the first communication peripheral is connected with a data receiving pin of the second communication peripheral; and when the received data transmission direction indicates that the to-be-transmitted data is sent from the first core to the second core, the first core transmits the to-be-transmitted data to the first communication peripheral, and the first communication peripheral transmits the to-be-transmitted data to the second core through the second communication peripheral. According to the technical scheme, data transmission between the first core and the second core can be achieved without adopting a special data communication interface in the multi-core embedded MCU, the time for redesigning and editing communication codes is shortened, and the communication research and development cost of the multi-core embedded MCU is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of embedded technology, and in particular to a communication method, a multi-core embedded MCU and a communication device. Background Art

[0002] With the development of embedded technology, more and more embedded systems use dual-core or multi-core MCU chips (i.e. Microcontroller Unit) to implement algorithm control and protocol analysis, so as to improve the performance, reliability and flexibility of the system.

[0003] Taking a dual-core MCU as an example, a dedicated data communication interface (such as dual-port RAM, communication mailbox RAM, etc.) is integrated inside the chip of the dual-core MCU, and the master core and the slave core can realize data transmission between the two through the data communication interface. When the embedded system is replaced by a dual-core MCU from two single-core MCUs to realize algorithm control and protocol parsing, the dual-core MCU cannot use the existing communication code of the original two single-core MCUs for data transmission. It is necessary to adapt the dedicated data communication interface of the dual-core MCU and re-edit the communication code between the master core and the slave core; and in order to avoid the operation of the master core during data transmission to destroy the data of the slave core, the dedicated data communication interface of the dual-core MCU often adopts a very complex design, which causes R&D personnel to spend a lot of time redesigning and editing the communication code of the dual-core MCU, resulting in the problem of high communication R&D cost of the MCU. Summary of the invention

[0004] Based on the above problems, the present application provides a communication method, a multi-core embedded MCU and a communication device, the purpose of which is to reduce the communication R&D cost of the multi-core embedded MCU.

[0005] The embodiments of the present application disclose the following technical solutions:

[0006] In a first aspect of the present application, a communication method is provided, which is applied to a multi-core embedded MCU, wherein the multi-core embedded MCU includes at least a first core and a second core, the first core is configured with a first communication peripheral, the second core is configured with a second communication peripheral, the first communication peripheral is used to interact with the first core for data, the second communication peripheral is used to interact with the second core for data, the data sending pin of the first communication peripheral is connected to the data receiving pin of the second communication peripheral, and the method includes:

[0007] receiving a data transmission instruction; the data transmission instruction carries direction information, and the direction information is used to indicate the data transmission direction of the data to be transmitted;

[0008] If the data transmission direction is the first transmission direction, the first core transmits the data to be transmitted to the first communication peripheral, and the first communication peripheral transmits the data to be transmitted to the second core through the second communication peripheral; the first transmission direction is used to indicate that the data to be transmitted is sent from the first core to the second core.

[0009] In an optional implementation, a data transmission pin of the second communication peripheral device is connected to a data reception pin of the first communication peripheral device, and the communication method further includes:

[0010] If the data transmission direction is the second transmission direction, the second core transmits the data to be transmitted to the second communication peripheral, and the second communication peripheral transmits the data to be transmitted to the first core through the first communication peripheral; the second transmission direction is used to indicate that the data to be transmitted is sent from the second core to the first core.

[0011] In an optional implementation, the first communication peripheral and the second communication peripheral are communication peripherals of the same type; the types of the first communication peripheral and the second communication peripheral include: UART, I2C, I2S, CAN, LIN and SPI.

[0012] In a second aspect of the present application, a multi-core embedded MCU is provided, the multi-core embedded MCU comprising: a first core and a second core; a first communication peripheral is configured in the first core, and a second communication peripheral is configured in the second core, the first communication peripheral is used to interact with the first core for data, and the second communication peripheral is used to interact with the second core for data, and a data transmission pin of the first communication peripheral is connected to a data receiving pin of the second communication peripheral;

[0013] The first core is used to transfer the data to be transmitted to the first communication peripheral device when the data transmission direction of the data to be transmitted is a first transmission direction; the first transmission direction is used to indicate that the data to be transmitted is sent from the first core to the second core;

[0014] A first communication peripheral device, used for receiving the data to be transmitted sent by the first core, and sending the data to be transmitted to the second communication peripheral device;

[0015] The second communication peripheral is used to receive the data to be transmitted sent by the first communication peripheral, and transfer the data to be transmitted to the second core;

[0016] The second core is used to receive data to be transmitted from the second communication peripheral device.

[0017] In an optional implementation, a data transmission pin of the second communication peripheral device is connected to a data reception pin of the first communication peripheral device;

[0018] The second core is also used to transfer the data to be transmitted to the second communication peripheral device when the data transmission direction of the data to be transmitted is the second transmission direction; the second transmission direction is used to indicate that the data to be transmitted is sent from the second core to the first core;

[0019] The second communication peripheral device is also used to receive the data to be transmitted sent by the second core, and send the data to be transmitted to the first communication peripheral device;

[0020] The first communication peripheral device is also used to receive the data to be transmitted sent by the second communication peripheral device, and transfer the data to be transmitted to the first core;

[0021] The first core is also used to receive data to be transmitted from the first communication peripheral device.

[0022] In an optional implementation, the first communication peripheral and the second communication peripheral are communication peripherals of the same type; the types of the first communication peripheral and the second communication peripheral include: UART, I2C, I2S, CAN, LIN and SPI.

[0023] In an optional implementation, a data transmission pin of the first communication peripheral device is connected to a data reception pin of the second communication peripheral device in a short-circuit manner, and a data transmission pin of the second communication peripheral device is connected to a data reception pin of the first communication peripheral device in a short-circuit manner.

[0024] In a third aspect of the present application, a communication device is provided, which is applied to a multi-core embedded MCU, wherein the multi-core embedded MCU includes at least a first core and a second core, the first core is configured with a first communication peripheral, the second core is configured with a second communication peripheral, the first communication peripheral is used to interact with the first core for data, the second communication peripheral is used to interact with the second core for data, the data transmission pin of the first communication peripheral is connected to the data receiving pin of the second communication peripheral, and the device includes:

[0025] A receiving module, used for receiving a data transmission instruction; the data transmission instruction carries direction information, and the direction information is used for indicating the data transmission direction of the data to be transmitted;

[0026] The first data transmission module is used for, if the data transmission direction is the first transmission direction, the first core transmits the data to be transmitted to the first communication peripheral, and the first communication peripheral transmits the data to be transmitted to the second core through the second communication peripheral; the first transmission direction is used to indicate that the data to be transmitted is sent from the first core to the second core.

[0027] In an optional implementation, a data transmission pin of the second communication peripheral device is connected to a data reception pin of the first communication peripheral device, and the communication device further includes:

[0028] The second data transmission module is used to, if the data transmission direction is the second transmission direction, transmit the data to be transmitted to the second communication peripheral by the second core, and transmit the data to be transmitted to the first core by the second communication peripheral through the first communication peripheral; the second transmission direction is used to indicate that the data to be transmitted is sent from the second core to the first core.

[0029] In a fourth aspect of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a multi-core embedded MCU, the above-mentioned communication method is implemented.

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

[0031] In the technical solution of the present application, a multi-core embedded MCU includes at least a first core and a second core, a first communication peripheral is configured in the first core, and a second communication peripheral is configured in the second core, the first communication peripheral is used to interact with the first core for data, and the second communication peripheral is used to interact with the second core for data; since the data sending pin of the first communication peripheral is connected to the data receiving pin of the second communication peripheral, when the received data transmission direction indicates that the data to be transmitted is sent from the first core to the second core, the first core can directly transmit the data to be transmitted to the first communication peripheral, and the first communication peripheral can transmit the data to be transmitted to the second core through the second communication peripheral, without using the dedicated data communication interface in the multi-core embedded MCU, data transmission between the first core and the second core can be realized; therefore, there is no need to adapt the dedicated data communication interface of the multi-core embedded MCU, and re-edit the communication code between the master core and the slave core, which reduces the time for redesigning and editing the communication code, thereby reducing the communication research and development cost of the multi-core embedded MCU. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0033] Figure 1 A flow chart of a communication method provided in an embodiment of the present application;

[0034] Figure 2 A schematic diagram of an N-core embedded MCU provided in an embodiment of the present application;

[0035] Figure 3 A schematic diagram of a dual-core embedded MCU provided in an embodiment of the present application;

[0036] Figure 4 A schematic diagram of the structure of a communication device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0037] As described above, currently when the embedded system is replaced by two single-core MCUs with one dual-core MCU to implement algorithm control and protocol analysis, the dual-core MCU cannot use the existing communication codes of the original two single-core MCUs for data transmission, and needs to adapt the dedicated data communication interface of the dual-core MCU and re-edit the communication code between the master core and the slave core; and in order to avoid the operation of the master core during data transmission from destroying the data of the slave core, the dedicated data communication interface of the dual-core MCU often adopts a very complex design, which causes R&D personnel to spend a lot of time redesigning and editing the communication code of the dual-core MCU, resulting in the problem of high communication R&D costs of the MCU.

[0038] After research, the inventor has proposed a communication method, which is applied to a multi-core embedded MCU, wherein the multi-core embedded MCU includes at least a first core and a second core, the first core is configured with a first communication peripheral, the second core is configured with a second communication peripheral, the first communication peripheral is used to interact with the first core for data, and the second communication peripheral is used to interact with the second core for data; since the data sending pin of the first communication peripheral is connected to the data receiving pin of the second communication peripheral, when the received data transmission direction indicates that the data to be transmitted is sent from the first core to the second core, the first core can directly transmit the data to be transmitted to the first communication peripheral, and the first communication peripheral can transmit the data to be transmitted to the second core through the second communication peripheral, without using a dedicated data communication interface in the multi-core embedded MCU, data transmission between the first core and the second core can be realized; therefore, there is no need to adapt the dedicated data communication interface of the multi-core embedded MCU, and re-edit the communication code between the master core and the slave core, which reduces the time for redesigning and editing the communication code, thereby reducing the communication research and development cost of the multi-core embedded MCU.

[0039] In order to enable those skilled in the art to better understand the solution of the present application, 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. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0040] Keyword definitions:

[0041] MCU: Microcontroller Unit, also known as Single-Chip Microcomputer or MCU, is a chip-level computer that appropriately reduces the frequency and specifications of the central processing unit (CPU), and integrates peripheral interfaces such as memory, timer, USB, A / D conversion, UART, PLC, DMA, and even LCD drive circuits on a single chip to form a chip-level computer for different combination controls for different applications.

[0042] UART: The full name is Universal Asynchronous Receiver / Transmitter, which refers to a universal asynchronous receiver and transmitter. It is a universal serial data bus used for asynchronous communication. The bus communicates bidirectionally and can achieve full-duplex transmission and reception.

[0043] I2C: The full name is Inter-Integrated Circuit, which is a serial communication protocol used for short-distance communication between integrated circuits.

[0044] I2S: The full name is Inter-IC Sound, which is a digital audio interface standard used to transmit high-quality audio data between integrated circuits.

[0045] CAN: Controller Area Network, a serial communication protocol designed for real-time data transmission in automotive and other industrial applications.

[0046] SPI: The full name is Serial Peripheral Interface, which is a synchronous serial communication interface widely used in short-distance communication between microcontrollers and peripheral devices.

[0047] LIN: The full name is Local Interconnect Network. It is a low-cost serial communication network mainly used for communication between sensors and actuators in automotive and industrial control systems.

[0048] Method Embodiment

[0049] An embodiment of the present application provides an embodiment of a communication method. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0050] See also Figure 1, the figure is a flow chart of a communication method provided by an embodiment of the present application, the method is applied to a multi-core embedded MCU, wherein the multi-core embedded MCU includes at least a first core and a second core, the first core is configured with a first communication peripheral, the second core is configured with a second communication peripheral, the first communication peripheral is used to interact with the first core for data, the second communication peripheral is used to interact with the second core for data, the data sending pin of the first communication peripheral is connected to the data receiving pin of the second communication peripheral, the method comprises the following steps:

[0051] Step S101, receiving a data transmission instruction; the data transmission instruction carries direction information, and the direction information is used to indicate the data transmission direction of the data to be transmitted.

[0052] Step S102: If the data transmission direction is the first transmission direction, the first core transfers the data to be transmitted to the first communication peripheral device, and the first communication peripheral device transfers the data to be transmitted to the second core via the second communication peripheral device.

[0053] In the embodiment of the present application, the multi-core embedded MCU includes not only the first core and the second core, but also Figure 2 The Nth core shown in , N is greater than or equal to 3. The first communication peripheral is connected to the first core communication interface of the first core to implement data interaction with the first core; the second communication peripheral is connected to the second core communication interface of the second core to implement data interaction with the second core; the Nth communication peripheral is connected to the Nth core communication interface of the Nth core to implement data interaction with the Nth core.

[0054] In this embodiment, if Figure 2 As shown, the first core in the multi-core embedded MCU can realize data transmission between the first core and the second core by connecting the data sending pin of the first communication peripheral with the data receiving pin of the second communication peripheral, and can also realize data transmission between the first core and the Nth core by connecting the data sending pin of the first communication peripheral with the data receiving pin of the Nth communication peripheral; the second core in the multi-core embedded MCU can also realize data transmission between the first core and the Nth core by connecting the data sending pin of the second communication peripheral with the data receiving pin of the Nth communication peripheral.

[0055] Optionally, the first communication peripheral and the second communication peripheral are communication peripherals of the same type; the types of the first communication peripheral and the second communication peripheral include but are not limited to UART, I2C, I2S, CAN, LIN and SPI, which can be selected according to actual needs.

[0056] Optionally, in order to improve data transmission efficiency, in this embodiment, the data sending pin of the first communication peripheral device and the data receiving pin of the second communication peripheral device are connected in a short-circuit manner, and the data sending pin of the second communication peripheral device and the data receiving pin of the first communication peripheral device are connected in a short-circuit manner; in addition, the data sending pin of the first communication peripheral device and the data receiving pin of the Nth communication peripheral device are connected in a short-circuit manner; the data sending pin of the second communication peripheral device and the data receiving pin of the Nth communication peripheral device are connected in a short-circuit manner.

[0057] In this embodiment, the data transmission direction of the data to be transmitted is used to indicate the transmission direction of the data to be transmitted between the first core and the second core. For example, the first transmission direction indicates that the data to be transmitted is sent from the first core to the second core (i.e., the first transmission direction), or indicates that the data to be transmitted is sent from the second core to the first core. In addition, the data transmission direction can also be used to indicate the transmission direction of the data to be transmitted between the first core and the Nth core, and the transmission direction of the data to be transmitted between the second core and the Nth core.

[0058] In order to reduce the communication R&D cost of multi-core embedded MCU, in the present embodiment, a first communication peripheral is configured in the first core of the multi-core embedded MCU, and a second communication peripheral is configured in the second core, so that the first communication peripheral exchanges data with the first core, and the second communication peripheral exchanges data with the second core; since the data sending pin of the first communication peripheral is connected to the data receiving pin of the second communication peripheral, when the received data transmission direction indicates that the data to be transmitted is sent from the first core to the second core, the first core can directly transmit the data to be transmitted to the first communication peripheral, and the first communication peripheral can transmit the data to be transmitted to the second core through the second communication peripheral, without using the dedicated data communication interface in the multi-core embedded MCU, data transmission between the first core and the second core can be realized; therefore, there is no need to adapt the dedicated data communication interface of the multi-core embedded MCU, and re-edit the communication code between the master core and the slave core, which reduces the time for redesigning and editing the communication code and improves the reusability of the communication code.

[0059] Optionally, in this embodiment, the data sending pin of the second communication peripheral is connected to the data receiving pin of the first communication peripheral. If the data transmission direction is the second transmission direction, the second core transmits the data to be transmitted to the second communication peripheral, and the second communication peripheral transmits the data to be transmitted to the first core through the first communication peripheral; the second transmission direction is used to indicate that the data to be transmitted is sent from the second core to the first core.

[0060] In a scenario where the multi-core embedded MCU is a dual-core embedded MCU, and the communication peripherals of the main core (i.e., the first core) and the secondary core (i.e., the second core) are URAT peripherals, such as Figure 3 As shown, the main URAT peripheral configured in the main core is connected to the main core communication interface of the main core to realize data interaction with the main core; the sub-URAT peripheral configured in the sub-core is connected to the sub-core communication interface of the sub-core to realize data interaction with the sub-core; the TXD pin (i.e., data sending pin) of the main URAT peripheral is short-circuited with the RXD pin (i.e., data receiving pin) of the sub-UART peripheral, and the TXD pin of the sub-URAT peripheral is short-circuited with the RXD pin of the main UART peripheral; when the dual-core embedded MCU receives a data transmission instruction carrying a data transmission direction (i.e., direction information) for indicating the data to be transmitted, if the data transmission direction indicates that the data to be transmitted is sent from the main core to the sub-core, the main core directly transmits the data to be transmitted to the sub-core. The transmission data is transmitted to the main UART peripheral, and the main UART peripheral transmits the data to be transmitted to the slave core through the slave UART peripheral; if the data transmission direction indicates that the data to be transmitted is sent from the slave core to the main core, the slave core directly transmits the data to be transmitted to the slave UART peripheral, and the slave UART peripheral transmits the data to be transmitted to the main core through the main UART peripheral; data transmission between the main core and the slave core can be achieved without using the dedicated data communication interface in the multi-core embedded MCU; therefore, there is no need to adapt the dedicated data communication interface of the multi-core embedded MCU, and re-edit the communication code between the main core and the slave core, which reduces the time for redesigning and editing the communication code and reduces the communication research and development cost of the multi-core embedded MCU.

[0061] In an optional embodiment, if the embedded system only implements algorithm control through a single-core MCU without a communication function, and the algorithm control function is very complex, which uses more than 80% of the chip performance, and it is impossible to add a communication protocol processing function to this single-core MCU; when the customer requires the embedded system to be able to implement both algorithm control and communication functions, the embedded system can be replaced by a single-core MCU with a dual-core embedded MCU. However, when implementing the communication function, the dual-core embedded MCU of the prior art cannot use the existing communication code of the original MCU, and needs to adapt the dedicated data communication interface of the dual-core embedded MCU, re-edit the communication code between the master core and the slave core, and when the customer requires the embedded system to only implement algorithm control, it is necessary to re-edit the communication code adapted to the single-core MCU, resulting in high communication R&D costs, low communication R&D efficiency, and low code reusability.

[0062] In order to solve the above problems, in the embodiment of the present application, the main core of the dual-core embedded MCU is configured with a main communication peripheral (such as Figure 3The main UART peripheral in the main core), wherein the main communication peripheral is connected to the main core communication interface of the main core to achieve data interaction with the main core; the secondary core is configured with a secondary communication peripheral (for example Figure 3 The secondary UART peripheral in the secondary core) is connected to the secondary core communication interface of the secondary core to realize data interaction with the secondary core; the data sending pin of the main communication peripheral is short-circuited with the data receiving pin of the secondary communication peripheral, and the data sending pin of the secondary communication peripheral is short-circuited with the data receiving pin of the main communication peripheral; when the dual-core embedded MCU receives a data transmission instruction carrying a data transmission direction (i.e., direction information) for indicating the data to be transmitted, if the data transmission direction indicates that the data to be transmitted is sent from the main core to the secondary core, the main core directly transmits the data to be transmitted to the main communication peripheral, and the main communication peripheral transmits the data to be transmitted to the secondary core through the secondary communication peripheral; if the data transmission direction indicates that the data to be transmitted is sent from the secondary core to the main core, the secondary core directly transmits the data to be transmitted to the secondary communication peripheral, and the secondary communication peripheral transmits the data to be transmitted to the main core through the main communication peripheral; data transmission between the main core and the secondary core can be realized without using a dedicated data communication interface in the multi-core embedded MCU.

[0063] Through the communication method provided in the embodiment of the present application, when the embedded system is replaced by two single-core MCUs with one multi-core MCU to realize algorithm control and protocol analysis, the multi-core MCU can use the existing communication code of the original two single-core MCUs for data transmission, without adapting the dedicated data communication interface of the multi-core MCU and re-editing the communication code between the master core and the slave core, thereby improving the reusability of the code, reducing the time for redesigning and editing the communication code, reducing the communication R&D cost of the multi-core embedded MCU, and improving the communication R&D efficiency of the multi-core embedded MCU.

[0064] Device Embodiment

[0065] The embodiment of the present application provides a multi-core embedded MCU, wherein the multi-core embedded MCU includes: a first core and a second core; a first communication peripheral is configured in the first core, and a second communication peripheral is configured in the second core, the first communication peripheral is used to interact with the first core for data, and the second communication peripheral is used to interact with the second core for data, and the data sending pin of the first communication peripheral is connected to the data receiving pin of the second communication peripheral;

[0066] The first core is used to transfer the data to be transmitted to the first communication peripheral device when the data transmission direction of the data to be transmitted is the first transmission direction; the first transmission direction is used to indicate that the data to be transmitted is sent from the first core to the second core;

[0067] A first communication peripheral device, used for receiving the data to be transmitted sent by the first core, and sending the data to be transmitted to the second communication peripheral device;

[0068] The second communication peripheral is used to receive the data to be transmitted sent by the first communication peripheral, and transfer the data to be transmitted to the second core;

[0069] The second core is used to receive data to be transmitted from the second communication peripheral device.

[0070] In the embodiment of the present application, the multi-core embedded MCU includes not only the first core and the second core, but also Figure 2 The Nth core shown in , N is greater than or equal to 3. The first communication peripheral is connected to the first core communication interface of the first core to implement data interaction with the first core; the second communication peripheral is connected to the second core communication interface of the second core to implement data interaction with the second core; the Nth communication peripheral is connected to the Nth core communication interface of the Nth core to implement data interaction with the Nth core.

[0071] In this embodiment, if Figure 2 As shown, the first core in the multi-core embedded MCU can realize data transmission between the first core and the second core by connecting the data sending pin of the first communication peripheral with the data receiving pin of the second communication peripheral, and can also realize data transmission between the first core and the Nth core by connecting the data sending pin of the first communication peripheral with the data receiving pin of the Nth communication peripheral; the second core in the multi-core embedded MCU can also realize data transmission between the first core and the Nth core by connecting the data sending pin of the second communication peripheral with the data receiving pin of the Nth communication peripheral.

[0072] Optionally, the first communication peripheral and the second communication peripheral are communication peripherals of the same type; the types of the first communication peripheral and the second communication peripheral include but are not limited to UART, I2C, I2S, CAN, LIN and SPI, which can be selected according to actual needs.

[0073] In order to reduce the communication research and development cost of multi-core embedded MCU, in this embodiment, by configuring a first communication peripheral in the first core of the multi-core embedded MCU and configuring a second communication peripheral in the second core, the first communication peripheral can interact with the first core and the second communication peripheral can interact with the second core; by connecting the data sending pin of the first communication peripheral with the data receiving pin of the second communication peripheral, when the received data transmission direction indicates that the data to be transmitted is sent from the first core to the second core, the first core can directly transmit the data to be transmitted to the first communication peripheral, and the first communication peripheral can transmit the data to be transmitted to the second core through the second communication peripheral, without using the dedicated data communication interface in the multi-core embedded MCU, data transmission between the first core and the second core can be realized; therefore, there is no need to adapt the dedicated data communication interface of the multi-core embedded MCU and re-edit the communication code between the master core and the slave core, which reduces the time for redesigning and editing the communication code.

[0074] Optionally, the data transmission pin of the second communication peripheral device is connected to the data receiving pin of the first communication peripheral device; wherein the second core is further used to transfer the data to be transmitted to the second communication peripheral device when the data transmission direction of the data to be transmitted is the second transmission direction; the second transmission direction is used to indicate that the data to be transmitted is sent from the second core to the first core;

[0075] The second communication peripheral device is also used to receive the data to be transmitted sent by the second core, and send the data to be transmitted to the first communication peripheral device;

[0076] The first communication peripheral device is also used to receive the data to be transmitted sent by the second communication peripheral device, and transfer the data to be transmitted to the first core;

[0077] The first core is also used to receive data to be transmitted from the first communication peripheral device.

[0078] In a scenario where the multi-core embedded MCU is a dual-core embedded MCU, and the communication peripherals of the main core (i.e., the first core) and the secondary core (i.e., the second core) are URAT peripherals, such as Figure 2As shown, the main URAT peripheral configured in the main core is connected to the main core communication interface of the main core to realize data interaction with the main core; the sub-URAT peripheral configured in the sub-core is connected to the sub-core communication interface of the sub-core to realize data interaction with the sub-core; the TXD pin (i.e., data transmission pin) of the main URAT peripheral is short-circuited with the RXD pin of the sub-UART peripheral, and the TXD pin (i.e., data transmission pin) of the sub-URAT peripheral is short-circuited with the RXD pin of the main UART peripheral; when the dual-core embedded MCU receives a data transmission instruction carrying a data transmission direction (i.e., direction information) for indicating the data to be transmitted, if the data transmission direction indicates that the data to be transmitted is sent from the main core to the sub-core, the main core directly transmits the data to be transmitted to the sub-core. The transmission data is transmitted to the main UART peripheral, and the main UART peripheral transmits the data to be transmitted to the slave core through the slave UART peripheral; if the data transmission direction indicates that the data to be transmitted is sent from the slave core to the main core, the slave core directly transmits the data to be transmitted to the slave UART peripheral, and the slave UART peripheral transmits the data to be transmitted to the main core through the main UART peripheral; data transmission between the main core and the slave core can be achieved without using the dedicated data communication interface in the multi-core embedded MCU; therefore, there is no need to adapt the dedicated data communication interface of the multi-core embedded MCU, and re-edit the communication code between the main core and the slave core, which reduces the time for redesigning and editing the communication code and reduces the communication research and development cost of the multi-core embedded MCU.

[0079] In order to improve data transmission efficiency, in this embodiment, the data sending pin of the first communication peripheral device and the data receiving pin of the second communication peripheral device are connected in a short-circuit manner, and the data sending pin of the second communication peripheral device and the data receiving pin of the first communication peripheral device are connected in a short-circuit manner; in addition, the data sending pin of the first communication peripheral device and the data receiving pin of the Nth communication peripheral device are connected in a short-circuit manner; the data sending pin of the second communication peripheral device and the data receiving pin of the Nth communication peripheral device are connected in a short-circuit manner.

[0080] In an optional embodiment, if the embedded system only implements algorithm control through a single-core MCU without a communication function, and the algorithm control function is very complex, it uses more than 80% of the chip performance, resulting in the inability to add a communication protocol processing function on this chip; when the customer requires the embedded system to be able to implement both algorithm control and communication functions, the embedded system can be replaced by a single-core MCU with a dual-core embedded MCU. However, when implementing the communication function, the dual-core embedded MCU of the prior art cannot use the existing communication code of the original MCU, and needs to adapt the dedicated data communication interface of the dual-core embedded MCU, re-edit the communication code between the master core and the slave core, and when the customer requires the embedded system to only implement algorithm control, it needs to re-edit the communication code adapted to the single-core MCU, resulting in the problems of high communication R&D cost, low communication R&D efficiency, and low code reusability.

[0081] In order to solve the above problems, in the embodiment of the present application, by configuring the main core of the dual-core embedded MCU with a main communication peripheral (for example Figure 3 The main UART peripheral in the main core), wherein the main communication peripheral is connected to the main core communication interface of the main core to achieve data interaction with the main core; the secondary core is configured with a secondary communication peripheral (for example Figure 3 The secondary UART peripheral in the secondary core) is connected to the secondary core communication interface of the secondary core to realize data interaction with the secondary core; the data sending pin of the main communication peripheral is short-circuited with the data receiving pin of the secondary communication peripheral, and the data sending pin of the secondary communication peripheral is short-circuited with the data receiving pin of the main communication peripheral; when the dual-core embedded MCU receives a data transmission instruction carrying a data transmission direction (i.e., direction information) for indicating the data to be transmitted, if the data transmission direction indicates that the data to be transmitted is sent from the main core to the secondary core, the main core directly transmits the data to be transmitted to the main communication peripheral, and the main communication peripheral transmits the data to be transmitted to the secondary core through the secondary communication peripheral; if the data transmission direction indicates that the data to be transmitted is sent from the secondary core to the main core, the secondary core directly transmits the data to be transmitted to the secondary communication peripheral, and the secondary communication peripheral transmits the data to be transmitted to the main core through the main communication peripheral; data transmission between the main core and the secondary core can be realized without using a dedicated data communication interface in the multi-core embedded MCU.

[0082] Device Embodiment

[0083] The embodiment of the present application provides a communication device, which is applied to a multi-core embedded MCU, wherein the multi-core embedded MCU includes at least a first core and a second core, the first core is configured with a first communication peripheral, the second core is configured with a second communication peripheral, the first communication peripheral is used to interact with the first core for data, the second communication peripheral is used to interact with the second core for data, and the data transmission pin of the first communication peripheral is connected to the data receiving pin of the second communication peripheral. Figure 4 , Figure 4 The structure diagram of a communication device provided in an embodiment of the present application includes: a receiving module 11 and a first data transmission module 12. Figure 4 You can see the connection relationship between several modules.

[0084] The receiving module 11 is used to receive a data transmission instruction; the data transmission instruction carries direction information, and the direction information is used to indicate the data transmission direction of the data to be transmitted;

[0085] The first data transmission module is used for, if the data transmission direction is the first transmission direction, the first core transmits the data to be transmitted to the first communication peripheral, and the first communication peripheral transmits the data to be transmitted to the second core through the second communication peripheral; the first transmission direction is used to indicate that the data to be transmitted is sent from the first core to the second core 12.

[0086] Optionally, a data transmission pin of the second communication peripheral device is connected to a data reception pin of the first communication peripheral device, and the communication device further includes:

[0087] The second data transmission module is used to, if the data transmission direction is the second transmission direction, transmit the data to be transmitted to the second communication peripheral by the second core, and transmit the data to be transmitted to the first core by the second communication peripheral through the first communication peripheral; the second transmission direction is used to indicate that the data to be transmitted is sent from the second core to the first core.

[0088] Storage Medium Embodiments

[0089] The embodiment of the present application provides a computer-readable storage medium, on which a program is stored, wherein the program, when executed by a multi-core embedded MCU, implements some or all of the steps in the communication method described in the aforementioned method embodiment of the present application. The storage medium can be a NOR Flash, NAND Flash, a read-only memory (ROM), a cache, or other medium that can store program codes.

[0090] It should be noted that each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and apparatus embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments. The device and apparatus embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components indicated as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. A person of ordinary skill in the art can understand and implement it without creative work.

[0091] The above is only a specific implementation 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 a person skilled in the art 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 communication method, characterized in that: The method is applied to a multi-core embedded MCU, wherein the multi-core embedded MCU includes at least a first core and a second core, the first core is configured with a first communication peripheral, the second core is configured with a second communication peripheral, the first communication peripheral is used to interact with the first core for data, the second communication peripheral is used to interact with the second core for data, the data transmission pin of the first communication peripheral is connected to the data receiving pin of the second communication peripheral, and the method includes: receiving a data transmission instruction; the data transmission instruction carries direction information, and the direction information is used to indicate the data transmission direction of the data to be transmitted; If the data transmission direction is the first transmission direction, the first core transmits the data to be transmitted to the first communication peripheral, and the first communication peripheral transmits the data to be transmitted to the second core through the second communication peripheral; the first transmission direction is used to indicate that the data to be transmitted is sent from the first core to the second core.

2. The method according to claim 1, characterized in that: The data transmission pin of the second communication peripheral device is connected to the data reception pin of the first communication peripheral device, and the method further includes: If the data transmission direction is the second transmission direction, the second core transmits the data to be transmitted to the second communication peripheral, and the second communication peripheral transmits the data to be transmitted to the first core through the first communication peripheral; the second transmission direction is used to indicate that the data to be transmitted is sent from the second core to the first core.

3. The method according to claim 1, characterized in that The first communication peripheral device and the second communication peripheral device are communication peripheral devices of the same type; Types of the first communication peripheral and the second communication peripheral include: UART, I2C, I2S, CAN, LIN and SPI.

4. A multi-core embedded MCU, characterized in that: The multi-core embedded MCU comprises: a first core and a second core; a first communication peripheral is configured in the first core, a second communication peripheral is configured in the second core, the first communication peripheral is used to interact with the first core for data, the second communication peripheral is used to interact with the second core for data, and a data transmission pin of the first communication peripheral is connected to a data receiving pin of the second communication peripheral; The first core is used to transfer the data to be transmitted to the first communication peripheral device when the data transmission direction of the data to be transmitted is a first transmission direction; the first transmission direction is used to indicate that the data to be transmitted is sent from the first core to the second core; The first communication peripheral is used to receive the data to be transmitted sent by the first core, and send the data to be transmitted to the second communication peripheral; The second communication peripheral device is used to receive the data to be transmitted sent by the first communication peripheral device, and transfer the data to be transmitted to the second core; The second core is used to receive the data to be transmitted transmitted by the second communication peripheral device.

5. The multi-core embedded MCU according to claim 4, characterized in that: A data transmission pin of the second communication peripheral device is connected to a data reception pin of the first communication peripheral device; The second core is further configured to transfer the data to be transmitted to the second communication peripheral device when the data transmission direction of the data to be transmitted is the second transmission direction; The second transmission direction is used to indicate that the data to be transmitted is sent from the second core to the first core; The second communication peripheral device is further used to receive the data to be transmitted sent by the second core, and send the data to be transmitted to the first communication peripheral device; The first communication peripheral device is further used to receive the data to be transmitted sent by the second communication peripheral device, and transfer the data to be transmitted to the first core; The first core is also used to receive data to be transmitted from the first communication peripheral device.

6. The multi-core embedded MCU according to claim 4, characterized in that: The first communication peripheral device and the second communication peripheral device are communication peripheral devices of the same type; Types of the first communication peripheral and the second communication peripheral include: UART, I2C, I2S, CAN, LIN and SPI.

7. The multi-core embedded MCU according to claim 4, characterized in that: The data transmission pin of the first communication peripheral device is connected to the data reception pin of the second communication peripheral device in a short-circuit manner, and the data transmission pin of the second communication peripheral device is connected to the data reception pin of the first communication peripheral device in the short-circuit manner.

8. A communication device, characterized in that: The device is applied to a multi-core embedded MCU, wherein the multi-core embedded MCU includes at least a first core and a second core, the first core is configured with a first communication peripheral, the second core is configured with a second communication peripheral, the first communication peripheral is used to interact with the first core for data, the second communication peripheral is used to interact with the second core for data, the data transmission pin of the first communication peripheral is connected to the data receiving pin of the second communication peripheral, and the device includes: A receiving module, used for receiving a data transmission instruction; the data transmission instruction carries direction information, and the direction information is used for indicating the data transmission direction of the data to be transmitted; The first data transmission module is used for, if the data transmission direction is the first transmission direction, the first core transmits the data to be transmitted to the first communication peripheral, and the first communication peripheral transmits the data to be transmitted to the second core through the second communication peripheral; the first transmission direction is used to indicate that the data to be transmitted is sent from the first core to the second core.

9. The device according to claim 8, characterized in that The data transmission pin of the second communication peripheral device is connected to the data receiving pin of the first communication peripheral device, and the device further includes: A second data transmission module is used for, if the data transmission direction is the second transmission direction, the second core transmits the data to be transmitted to the second communication peripheral, and the second communication peripheral transmits the data to be transmitted to the first core through the first communication peripheral; the second transmission direction is used to indicate that the data to be transmitted is sent from the second core to the first core.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a multi-core embedded MCU, the communication method according to any one of claims 1 to 3 is implemented.