A handshake method for establishing single-line communication for MCU simulation debugging

By using a combination of custom encoding and Manchester encoding in MCU simulation debugging, multiple signal accuracy judgments are made, and the problems of lack of single-line communication handshake methods and inaccurate signal transmission are solved, and a high accuracy and reliability of single-line communication is achieved.

CN114741249BActive Publication Date: 2025-03-14JIANGSU JITRI INTELLIGENT INTEGRATED CIRCUIT DESIGN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210507312.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-11
Publication Date
2025-03-14
Estimated Expiration
2042-05-11

AI Technical Summary

Technical Problem

In the existing MCU simulation debugging, there is a lack of handshake methods for single-line communication, and there is poor signal transmission accuracy, which makes it easy to cause mishandshake problems.

Method used

Using a combination of custom encoding and Manchester encoding, we can ensure the accuracy of the transmitted signal through multiple signal accuracy judgments and avoid misshaking hands. Specific steps include resetting the MCU, sending custom encodings, establishing front-line communications, switching the encoding transmission rate and clock signals to ensure the accuracy of the handshake.

Benefits of technology

It effectively avoids the communication handshake problem caused by inaccurate signal transmission during the establishment of communication between the emulator and the MCU, and ensures the accuracy and reliability of single-line communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114741249B_ABST
    Figure CN114741249B_ABST
Patent Text Reader

Abstract

The invention discloses a handshake method for establishing single-line communication for MCU simulation debugging, which can realize the handshake of one-line communication between a single-chip microcomputer and an emulator, and can prevent the problem of wrong handshake in communication. The method is implemented based on emulator simulation debugging, and the emulation debugging adopts Manchester-coded one-line communication. The handshake method comprises: resetting the MCU; making the MCU enter a RECOVER mode and setting a first communication frequency at the same time; the emulator sends an instruction to establish one-line communication with the MCU; after receiving an ASCII code, the MCU sends a first return code to the emulator; the emulator determines whether the first return code is a third code; the emulator sends a fourth code, sets a second communication frequency, and the MCU sends a second return code to the emulator; the emulator determines whether the second return code is equal to the fourth code; the emulator calculates a clock signal and sends the same clock signal to the MCU; the MCU sends an ECHO to the emulator; the emulator determines whether the ECHO is the same as a preset signal, and if they are the same, the handshake is completed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of single-chip computer simulation debugging, in particular to a handshake method for establishing single-line communication for MCU simulation debugging. Background Art

[0002] MCU, also known as microcomputer or single-chip microcomputer, is a microcontroller that integrates multiple functional devices such as memory, counter, A / D converter, serial interface following UART protocol, DMA memory, and LCD driver circuit into a single chip. In the process of MCU chip design or manufacturing, in order to ensure that the MCU chip can work normally and meet the control requirements of the application, the MCU chip needs to be simulated and debugged.

[0003] At present, when using an emulator to simulate and debug an MCU, the emulator is mainly connected to the MCU chip through the JTAG interface or the SWD interface, and multiple pins are required to realize the communication function. The JTAG interface follows the JTAG protocol, which is an international standard test protocol mainly used for internal chip testing and system simulation and debugging. It requires at least three communication connection lines to realize communication. The SWD interface is a serial debugging interface. Compared with the JTAG interface, the SWD interface requires at least two communication lines: SWCLK (serial clock line) and SWDIO (serial data line) to realize communication, which reduces the GPIO port occupancy of the single-chip microcomputer, but still cannot meet the communication requirements of highly integrated and miniaturized MCU chips.

[0004] In the existing simulation debugging, a one-wire communication (i.e. single-line communication) method based on Manchester coding is provided. This method can realize the communication between the simulator and the MCU chip through a single line, further reducing the GPIO port occupancy of the single-chip microcomputer and meeting the requirements of high integration and miniaturization of the MCU chip. However, the handshake method commonly used for one-wire communication is relatively lacking, and the signal transmission accuracy is poor. The problem of incorrect handshake is prone to occur when establishing communication between the simulator and the MCU. Summary of the invention

[0005] In view of the above problems existing in the prior art, the present invention provides a handshake method for establishing single-line communication for MCU simulation debugging, which can realize the one-line communication handshake between the single-chip microcomputer and the simulator, and at the same time prevent the problem of communication error handshake.

[0006] To achieve the above object, the present invention adopts the following technical solution:

[0007] A handshake method for establishing single-line communication for MCU simulation debugging, the method is based on the simulation debugging of an emulator, the simulation debugging adopts one-line communication of Manchester coding, the one-line communication means that the MCU and the emulator communicate through a single-line connection, one end of the single-line is connected to the debugging port of the MCU, and the other end is connected to the communication pin of the emulator, characterized in that the custom coding includes: a first coding, a second coding, and a third coding, and the handshake method includes: S1, resetting the MCU through the emulator;

[0008] S2. When establishing communication, the simulator sends a first code to the MCU to make the MCU enter the RECOVER mode, and sets a code transmission rate, wherein the code transmission rate includes: a first communication frequency, which is the baud rate sent by the custom code, and the first communication frequency is less than the second communication frequency;

[0009] S3, setting the communication mode: the simulator sends a second code to the MCU, so that the simulator and the MCU establish the one-line communication;

[0010] S4, the simulator sends an ASCII code to the MCU, and after receiving the ASCII code, the MCU sends a first return code to the simulator;

[0011] S5, the simulator waits for and receives the first return code;

[0012] S6, the simulator determines whether the first return code is the third code, if so, proceeds to step S7, and continues the handshake operation, if not, the handshake fails, and exits;

[0013] S7, the emulator sends the fourth code of the one-line communication to the MCU, sets the second communication frequency in the code transmission rate, the second communication frequency is the transmission rate of the Manchester code, and after the MCU receives the fourth code, sends the second return code to the emulator;

[0014] S8, the simulator waits for and receives the second return code;

[0015] S9, the simulator determines whether the second return code is equal to the fourth code. If they are equal, the simulator enters step S10, continues the handshake, and switches the code transmission rate from the first communication frequency to the second communication frequency. If they are not equal, the handshake fails and the simulator exits.

[0016] S10, the simulator waits for and receives a communication clock signal sent by the MCU;

[0017] S11, the simulator calculates the clock signal and sends the same clock signal to the MCU;

[0018] S12, after receiving the clock signal returned by the emulator, the MCU switches the transmission signal to Manchester encoding, and sends a Manchester-encoded ECHO to the emulator;

[0019] S13, the simulator determines whether the ECHO is the same as the preset signal. If they are the same, the handshake is completed and the one-line communication is established. If they are not the same, the handshake fails and the simulator exits.

[0020] Its further characteristic is that

[0021] In step S2, the MCU enters the RECOVER mode after receiving the first code, where the first code is 0xAA code;

[0022] In step S2, the first communication frequency is 10kHz to 500kHz;

[0023] In step S3, after receiving the second code, the MCU starts to establish a one-line communication with the emulator, and the second code is 0x10 code;

[0024] In step S4, the ASCII code is "JSIC8009";

[0025] In step S5, the third code is 0xFF;

[0026] In step S7, the fourth code is 0x50, 0x55, 0x5A or 0x5F, and the fourth codes 0x50, 0x55, 0x5A, 0x5F correspond to the second communication frequencies 62.5kHz, 125kHz, 250kHz, 500kHz one by one;

[0027] In step S9, the fourth code is 0x50, 0x55, 0x5A, 0x5F;

[0028] In step S10, the number of the clock signals is 64.

[0029] The above structure of the present invention can achieve the following beneficial effects: when the method of the present application is applied to the simulation test process of the MCU, when establishing the communication between the simulator and the MCU, that is, when the communication signal is established between the simulator and the MCU, the accuracy of the transmission signal is judged, and the simulator judges the accuracy of the signals transmitted by the MCU through steps S6, S9, and S12: the first return code, the second return code, and ECHO. Only when the first return code, the second return code, and ECHO are all accurate, that is, the first return code is equal to the corresponding third code, the second return code is equal to the corresponding return code, and ECHO is the same as the pre-set signal, can the simulator and the MCU achieve accurate communication handshake. At least three judgments on the accuracy of the signal during the transmission process ensure the accuracy of the transmission signal, and effectively avoid the problem of incorrect communication handshake caused by inaccurate signal transmission during the communication between the simulator and the MCU.

[0030] In addition, the clock of each MCU is slightly different. The emulator receives the clock signal sent by the MCU and sends the clock signal to the MCU at the same rate as the MCU clock signal. This helps the MCU to correctly receive the clock signal sent by the emulator, thereby ensuring the reliability of the one-line communication. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 is a flow chart of the method of the present invention;

[0032] Figure 2 Establishing a preliminary transmission signal simulation diagram for the single-line communication of the simulator of the present invention;

[0033] Figure 3 A later transmission signal simulation diagram is established for the present invention to simulate single-line communication. DETAILED DESCRIPTION

[0034] Different embodiments or examples are provided below to realize different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or reference letters in different examples, and this repetition is for the purpose of simplicity and clarity, which itself does not indicate the relationship between the various embodiments and / or settings discussed. In addition, the present invention provides various specific examples of processes and materials, but those of ordinary skill in the art can be aware of the application of other processes and / or the use of other materials.

[0035] In view of the fact that the handshake method for the commonly used one-line communication in the prior art is relatively lacking, the sending and receiving of signals between the emulator and the MCU are transmitted on one line (a single communication line, excluding the power line and the ground line). During the communication establishment process, the high transmission rate and Manchester encoding transmission signal method are directly used, which is prone to inaccurate transmission signals, resulting in the problem of incorrect handshake when the emulator and the MCU establish communication. In addition, there are no other auxiliary clock signal lines during the signal transmission process, but the clock of each MCU has a slight deviation, which is also easy to reduce the accuracy of signal transmission, resulting in the problem of incorrect handshake when the emulator and the MCU establish communication. The present invention provides a specific embodiment for establishing a single-line communication handshake for MCU simulation debugging, which is as follows:

[0036] This communication handshake method is based on the simulation debugging of the simulator. The simulation debugging uses custom coding and Manchester coding to establish a one-line communication. One-line communication means that the MCU and the simulator are connected through a single communication line to achieve communication. One end of the single line is connected to the debugging port of the MCU, and the other end is connected to the communication pin of the simulator. Figure 1 , the specific steps of handshake include:

[0037] S1. Send a low pulse to the reset pin of the MCU through the emulator to reset the MCU. In this embodiment, the low pulse is 100 microseconds.

[0038] S2. When establishing communication, the emulator sends the first code 0xAA to the MCU, notifying the MCU to enter the RECOVER mode (RECOVER mode refers to the simulation debugging mode), and sets the code transmission rate at the same time. The code transmission rate includes: the first communication frequency, the first communication frequency is the baud rate sent by the custom code, the first communication frequency is 10kHz~500kHZ, and 64kHz is preferred in this embodiment.

[0039] After receiving the first code, the MCU enters the RECOVER mode. The custom code format used by the communication data is shown in Table 1. The first code OxAA (hexadecimal), the second code Ox10 (hexadecimal), the third code OxFF (hexadecimal), the fourth code (hexadecimal), the ASCII code (hexadecimal), and the second return code are all custom code signal formats agreed upon by the emulator and the MCU. The signal format contains 1 start bit, 8 data bits, and 1 stop bit. The start bit is 0, the stop bit is 1, and D7 to D0 are 8-bit data, with the high bit first. When the emulator and the MCU use the above custom code format to transmit signals, they are sent and received in reverse code mode.

[0040]

[0041] S3, setting the communication mode: the emulator sends the second code 0x10 to the MCU, notifying the MCU that the emulator will establish a one-line communication with it; after receiving the second code, the MCU starts to establish a one-line communication with the emulator.

[0042] S4. The emulator sends an ASCII code to the MCU: "JSIC8009". After receiving the ASCII code, the MCU sends a first return code to the emulator.

[0043] S5. The simulator waits for and receives a first return code.

[0044] S6. The simulator determines whether the first return code is the third code: 0xFF. If so, it proceeds to step S7 to continue the handshake operation. If not, the handshake fails and the simulator exits.

[0045] S7. The emulator sends the fourth code of the one-line communication to the MCU and sets the second communication frequency. The first communication frequency is less than the second communication frequency. After receiving the fourth code, the MCU sends a second return code to the emulator. The fourth code includes 0x50, 0x55, 0x5A or 0x5F. The fourth codes 0x50, 0x55, 0x5A, 0x5F correspond to the second communication frequencies 62.5kHz, 125kHz, 250kHz, and 500kHz. In this embodiment, the fourth code of the one-line communication sent by the emulator to the MCU is 0x5F, so that the code transmission rate reaches 500kHz during subsequent communication, so as to improve the communication speed after the emulator and the MCU establish communication.

[0046] In the process of establishing communication between the emulator and the MCU, the present application sets two coding transmission rates: a first communication frequency and a second communication frequency. In the early stage of establishing communication, the first communication frequency with a smaller transmission rate is used to transmit the custom code, ensuring that there is sufficient time to judge the accuracy of the transmission signal during the transmission of the custom code, thereby ensuring the accuracy of the transmission signal and avoiding the problem of communication handshake errors caused by inaccurate signal transmission due to the communication frequency being too high and the transmission signal not being able to be judged in time during the communication between the emulator and the MCU using a single communication line.

[0047] S8. The simulator waits for and receives a second return code.

[0048] S9. The simulator determines whether the second return code is equal to the fourth code. If they are equal, it enters step S10 and continues the handshake while switching the transmission rate from the first communication frequency 64kHz to 500kHz. If they are not equal, the handshake fails and exits.

[0049] S10, the emulator waits for and receives the communication clock signal sent by the MCU. In this embodiment, the number of clock signals sent by the MCU is 64.

[0050] S11. The emulator sends the same clock signal to the MCU. The clock of each MCU is slightly different. The emulator receives the clock signal sent by the MCU, measures and calculates the clock signal sent by the MCU, and then sends the clock signal to the MCU at the same rate as the MCU clock signal. This helps the MCU to correctly receive the clock signal sent by the emulator, thereby ensuring the reliability of the first-line communication.

[0051] S12. After receiving the clock signal returned by the emulator, the MCU adds the clock signal to the custom code, so that the transmission signal between the emulator and the MCU is switched from the custom code to the Manchester code. At this time, the MCU sends a Manchester-coded ECHO (binary code) to the emulator. ECHO indicates that the MCU intends to transmit the signal in Manchester code after the communication is established.

[0052] S13, the simulator determines whether ECHO is the same as the preset signal. If so, the handshake is completed and one-line communication is established. If not, the handshake fails and the simulator exits.

[0053] The method of the present application is applied to the simulation test process of the MCU. When establishing communication between the simulator and the MCU, at least three signal accuracy judgments are performed to ensure the accuracy of the transmitted signal, effectively avoiding the problem of incorrect communication handshakes caused by inaccurate signal transmission during the communication between the simulator and the MCU. Figure 2 , Figure 3 The signal transmission simulation diagram of the simulator in the process of establishing single-line communication is given. Figure 2 This is a simulation diagram of the signal being transmitted at the first communication frequency in the early stage of communication establishment. Figure 3 In the later stage of communication establishment, the clock signal transmission between the simulator and the MCU and the simulation effect diagram after the transmission signal is switched to Manchester encoding, from Figure 2 , Figure 3 It can be seen that by adopting the handshake method of single-line communication of the present application, there is no interruption in the signal transmission process, and the accurate establishment of single-line communication between the emulator and the MCU can be achieved.

[0054] The above are only preferred embodiments of the present application, and the present invention is not limited to the above embodiments. It is understood that other improvements and changes directly derived or associated by those skilled in the art without departing from the spirit and concept of the present invention should be considered to be included in the protection scope of the present invention.

Claims

1. A handshake method for establishing single-line communication for MCU simulation debugging, the method is based on the simulation debugging of the simulator, the simulation debugging uses custom coding and Manchester coding to establish one-line communication, the one-line communication means that the MCU and the simulator communicate through a single-line connection, one end of the single line is connected to the debugging port of the MCU, and the other end is connected to the communication pin of the simulator, characterized in that: The custom code includes a first code, a second code, and a third code, and the handshake method includes: S1, resetting the MCU through an emulator; S2. When establishing communication, the simulator sends a first code to the MCU to make the MCU enter the RECOVER mode, and sets a code transmission rate, wherein the code transmission rate includes: a first communication frequency, which is the baud rate of the custom code; S3, setting the communication mode: the simulator sends a second code to the MCU, and the simulator issues an instruction to establish the one-line communication with the MCU; S4, the simulator sends an ASCII code to the MCU, and after receiving the ASCII code, the MCU sends a first return code to the simulator; S5, the simulator waits for and receives the first return code; S6, the simulator determines whether the first return code is the third code, if so, proceeds to step S7, and continues the handshake operation, if not, the handshake fails, and exits; S7, the emulator sends the fourth code of the one-line communication to the MCU, sets the second communication frequency in the code transmission rate, the second communication frequency is the transmission rate of the Manchester code, and after the MCU receives the fourth code, sends a second return code to the emulator; S8, the simulator waits for and receives the second return code; S9, the simulator determines whether the second return code is equal to the fourth code. If they are equal, the simulator enters step S10, continues the handshake, and switches the code transmission rate from the first communication frequency to the second communication frequency. If they are not equal, the handshake fails and the simulator exits. S10, the simulator waits for and receives a communication clock signal sent by the MCU; S11, the simulator calculates the clock signal and sends the same clock signal to the MCU; S12, after receiving the clock signal returned by the emulator, the MCU switches the transmission signal to Manchester encoding, and sends a Manchester-encoded ECHO to the emulator; S13, the simulator determines whether the ECHO is the same as the preset signal, if it is the same, the handshake is completed and the one-line communication is established, if it is not the same, the handshake fails and exits; In step S2, the MCU enters the RECOVER mode after receiving the first code, where the first code is 0xAA code; In step S3, after receiving the second code, the MCU starts to establish a one-line communication with the simulator, and the second code is 0x10 code; In step S4, the ASCII code is "JSIC8009".

2. The handshake method for establishing single-line communication for MCU simulation debugging according to claim 1, characterized in that: In step S2, the first communication frequency is 10kHz-500kHz, and the second communication frequency is 62.5kHz, 125kHz, 250kHz or 500kHz.

3. The handshake method for establishing single-line communication of MCU simulation debugging according to claim 1 is characterized in that: In step S5, the third code is 0xFF.

4. The handshake method for establishing single-line communication for MCU simulation debugging according to claim 3 is characterized in that: In step S7, the fourth code is 0x50, 0x55, 0x5A or 0x5F, and the fourth codes 0x50, 0x55, 0x5A, 0x5F correspond one-to-one to the second communication frequencies 62.5kHz, 125kHz, 250kHz, 500kHz.

5. The handshake method for establishing single-line communication for MCU simulation debugging according to claim 4 is characterized in that: In step S9, the fourth code is 0x50, 0x55, 0x5A, 0x5F.

6. The handshake method for establishing single-line communication for MCU simulation debugging according to claim 5, characterized in that: In step S10, the number of the clock signals is 64.

Citation Information

Patent Citations

  • Manchester code communication protocol adaptive method based on FPGA (Field Programmable Gate Array) and CPLD (Complex Programmable Logic Device)

    CN106982199A

  • Rapid communication method between FPGA and MCU

    CN111367850A