Serial communication control method and device and electronic equipment

Through the serial communication controller hardware, the transmission direction of half-duplex serial communication is automatically switched, which solves the problem of time difference in switching data transmission direction and improves the efficiency and reliability of data transmission.

CN119645916APending Publication Date: 2025-03-18FUZHOU ROCKCHIP SEMICON
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411734450.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

In half-duplex serial communication, there is a long time difference when switching the data transmission direction, which may lead to data loss, especially in cases of program or interrupt blocking.

Method used

The serial communication controller hardware automatically switches the transmission direction, and generates corresponding control signals to control the data transmission status of the target device, avoiding time difference at the application layer.

Benefits of technology

It improves the efficiency and reliability of data transmission, reduces the risk of data loss, and ensures the timeliness of switching data transmission directions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645916A_ABST
    Figure CN119645916A_ABST
Patent Text Reader

Abstract

The invention discloses a serial communication control method and device and electronic equipment. The method comprises the following steps: determining any one serial communication mode in a full-duplex mode and a half-duplex mode according to a data transmission instruction; generating a control signal corresponding to the serial communication mode through a serial communication controller; and controlling the data transmission state of the target equipment according to the control signal. The data transmission state of the serial communication mode does not need to be configured through an application program, control is directly achieved based on the serial communication controller, time difference existing in the process from command execution to actual data transmission control of an application layer is avoided, and the efficiency and reliability of data transmission are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of serial communication, and in particular to a serial communication control method and device, and electronic equipment. Background Art

[0002] Serial communication is a data exchange method in which information is sent one by one through a communication channel in sequential bits or bytes, i.e. data is transmitted sequentially through a single communication line. Serial communication is widely used in many electronic devices, such as those using technologies such as Universal Asynchronous Receiver / Transmitter (UART) and Serial Peripheral Interface (SPI).

[0003] Serial communication can adopt different working modes, including full-duplex and half-duplex. In full-duplex mode, data can be transmitted independently and simultaneously in two directions. The sender cannot perceive the communication status through the receiving ability of the receiver. In order to prevent the receiving buffer from overflowing, data flow control signals are needed to inform the sender of the status of the receiver, especially when the processing speed of the receiver cannot keep up with the receiving speed. In half-duplex mode, communication can only be carried out in one direction, so both parties can clearly know when to send and receive, without complex flow control, but control signals are needed to control the current transmission direction.

[0004] In half-duplex transmission, when switching the transmission direction of serial communication, the application usually switches the transmission direction of the bus, that is, when the master device needs to send data to the slave device, the bus direction is switched to the data sending direction, and after the data is sent, it is switched to the data receiving direction. Or combined with interrupts, the application switches the transmission direction. However, this method has a long time difference from executing commands at the application layer to actually switching the data transmission direction. If there is a program or interrupt blocking, the time difference will be more severe. The time difference will cause the data transmission direction to be switched untimely, and ultimately cause data loss. Summary of the invention

[0005] The present invention provides a serial communication control method and device, and electronic equipment, which can automatically switch the transmission direction of serial communication through hardware, thereby improving the efficiency and reliability of data transmission.

[0006] In one aspect of the present invention, a serial communication control method is provided. The method comprises: determining any one of a full-duplex mode and a half-duplex mode according to a data transmission instruction; generating a control signal corresponding to the serial communication mode by a serial communication controller; and controlling the data transmission state of a target device according to the control signal.

[0007] In another aspect of the present invention, a serial communication control device is provided. The device includes: a processor configured to determine any one of a full-duplex mode and a half-duplex mode of a serial communication mode according to a data transmission instruction; and a serial communication controller electrically coupled to the processor and a target device, and configured to generate a control signal corresponding to the serial communication mode, so that the data transmission state of the target device is controlled according to the control signal.

[0008] In another aspect of the present invention, an electronic device is provided, comprising a memory configured to store a computer program and a processor configured to execute the computer program to perform the above serial communication control method.

[0009] According to the technical solution of the present invention, after determining the serial communication mode of the current device according to the data transmission instruction, the corresponding control signal is directly generated through the serial communication controller to control the data transmission state of the target device. The present invention does not need to configure the data transmission state of the serial communication mode through the application program, but directly implements the control based on the hardware device of the serial communication controller, thereby avoiding the time difference existing in the process from executing the command to the actual data transmission control at the application layer, and effectively improving the efficiency and reliability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 is a flow chart of a serial communication control method according to an embodiment of the present invention;

[0011] Figure 2 A flowchart of a serial communication control method in full-duplex mode according to an embodiment of the present invention;

[0012] Figure 3 A waveform diagram of a data flow control signal according to an embodiment of the present invention;

[0013] Figure 4 A flowchart of a serial communication control method in a half-duplex mode according to an embodiment of the present invention;

[0014] Figure 5 A waveform diagram of a data direction control signal according to an embodiment of the present invention;

[0015] Figure 6 A schematic diagram of the structure of a serial communication control device according to an embodiment of the present invention;

[0016] Figure 7 A system block diagram of a serial communication control device in full-duplex mode according to an embodiment of the present invention;

[0017] Figure 8 A system block diagram of a serial communication control device in half-duplex mode according to an embodiment of the present invention;

[0018] Fig. 9 Schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0019] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in conjunction with the implementation modes and the accompanying drawings.

[0020] In the prior art, in half-duplex transmission, when switching the transmission direction of serial communication, the application is usually used to switch the transmission direction of the bus, that is, when the master device needs to send data to the slave device, the bus direction is switched to the data sending direction, and after the data is sent, it is switched to the data receiving direction. Or combined with interrupts, the application switches the transmission direction. However, this method has a long time difference from the execution of commands at the application layer to the actual switching of data transmission direction. If there is a program or interrupt blocking, the time difference will be more severe. The time difference will cause the data transmission direction to be switched untimely, and ultimately cause data loss.

[0021] In order to solve at least the above technical problems, the present disclosure provides a serial communication control method. According to the present disclosure, after receiving a data transmission instruction and determining the serial communication mode of the current device according to the data transmission instruction, a corresponding control signal is directly generated through a serial communication controller, thereby controlling the data transmission state of the target device. In this way, according to the embodiment of the present disclosure, there is no need to configure the data transmission state of the serial communication mode through an application program, but the control is directly implemented based on the hardware device of the serial communication controller, thereby avoiding the time difference existing in the process from executing the command to the actual data transmission control at the application layer, and effectively improving the efficiency and reliability of data transmission.

[0022] According to an embodiment of the present disclosure, the serial communication controller has both full-duplex and half-duplex transmission capabilities, and there is no need to divide the first / second interface. Based on the transmission characteristics of full-duplex and half-duplex, the serial communication controller provides different control signals, respectively, providing a data flow control signal for the full-duplex communication mode and a data direction control signal for the half-duplex communication mode. Since the full-duplex and half-duplex working modes are selected in the same application, the control signal only needs one set of IO resources, which not only improves the transmission efficiency but also saves transmission resources.

[0023] In order to simultaneously meet the requirements of full-duplex and half-duplex working modes in serial communication, as well as the control requirements of transmission signals, the control signals generated by the serial communication controller can be used to control the data flow of full-duplex or the direction of half-duplex, and a group of PAD ports, namely the target physical port, are used together to save IO resources. When the transmission mode is full-duplex, the PAD port is used for data flow control, and when the transmission mode is half-duplex, the PAD port is used for direction control. In addition to supporting the above hardware automatic switching mode, the serial communication controller also supports software configuration mode, and the control signal can be configured using the application according to the application scenario requirements.

[0024] According to an embodiment of the present disclosure, when the serial communication operates in full-duplex mode, if the amount of data received is less than the receiving threshold, the serial communication controller of the master device outputs a first state to inform the slave device to continue sending data. If the amount of data received is greater than the receiving threshold, the serial communication controller of the master device outputs a second state to inform the slave device to suspend sending data. In addition, when the serial communication operates in half-duplex mode, if there is data to be transmitted in the serial communication and the serial communication is ready to be transmitted, the serial communication controller of the master device outputs a first state to inform the half-duplex controller that the current working state is a sending state. If there is no data to be transmitted in the serial communication and the current data transmission is completed, the serial communication controller of the master device will output a second state to inform the half-duplex controller that the current working state is a receiving state. The half-duplex controller is generally a separate module, and the half-duplex controller can be used to realize data differential conversion. At this time, both ends are designed according to full-duplex, and the half-duplex controller is equivalent to a transfer interface. In some embodiments, when the serial communication controller is used, only one working mode can be controlled, that is, either full-duplex mode or half-duplex mode. Therefore, when using it, you need to specify the working mode. There is only one connection method on the PCB board. When working in full-duplex mode, there is no half-duplex controller.

[0025] Hereinafter, the technical solution according to the present disclosure will be described with reference to specific embodiments and in conjunction with the accompanying drawings.

[0026] Figure 1 1 is a flow chart showing a serial communication control method 100 according to an embodiment of the present disclosure. Figure 1 The method 100 includes the following steps 102 to 106.

[0027] In step 102, a serial communication mode, either a full-duplex mode or a half-duplex mode, is determined according to a data transmission instruction.

[0028] In step 104, a control signal corresponding to the serial communication mode is generated by a serial communication controller.

[0029] In some embodiments, if the serial communication mode is a full-duplex mode, a data flow control signal corresponding to the full-duplex mode is generated by the serial communication controller. In addition, if the serial communication mode is a half-duplex mode, a data direction control signal corresponding to the half-duplex mode is generated by the serial communication controller. In this way, if the serial communication mode of the device operates in the full-duplex mode, the serial communication controller generates a data flow control signal to indicate the current state of the device. If the serial communication mode of the device operates in the half-duplex mode, the serial communication controller generates a data direction control signal to control the current transmission direction. In this way, the control requirements of the serial communication mode in the full-duplex and half-duplex modes are compatible, ensuring the applicability of the device.

[0030] In some embodiments, generating a data flow control signal corresponding to the full-duplex mode through the serial communication controller includes: detecting whether the amount of data in the first memory for storing received data is greater than a preset storage threshold; if so, generating a stop data flow control signal through the serial communication controller; otherwise, generating a resume data flow control signal through the serial communication controller. In this way, by detecting the amount of data received by the first memory, it is determined whether there is an overflow risk in the current memory. If there is an overflow risk, the corresponding data flow control signal is directly generated through the serial communication controller, thereby controlling the data transmission state of the target device, avoiding data loss caused by data overflow, and effectively improving the reliability of data transmission.

[0031] In some embodiments, generating a data direction control signal corresponding to the half-duplex mode by the serial communication controller includes: detecting whether the amount of data in the second memory for storing the data to be transmitted is a null value; if the amount of data in the second memory is a null value, and a transmission end mark is detected in the target data of the current transmission, generating a receiving data direction control signal by the serial communication controller; if the amount of data in the second memory is not a null value, and a transmission start mark is detected in the target data of the current transmission, generating a sending data direction control signal by the serial communication controller. In this way, by detecting the amount of data to be transmitted in the second memory, it is determined whether there is data to be transmitted in the current serial communication. If there is data to be transmitted and there is a transmission start mark, it indicates that the data is ready to be transmitted; if there is no data to be transmitted and there is a transmission end mark, it indicates that the data transmission is over. For different transmission states, the corresponding data direction control signal is directly generated by the serial communication controller, so as to timely control the transmission direction of the data without the need for control by the application program, thereby avoiding the problem of untimely switching of the transmission direction due to the time difference, and effectively improving the efficiency and reliability of data transmission.

[0032] In step 106, the data transmission state of the target device is controlled according to the control signal.

[0033] In some embodiments, controlling the data transmission state of the target device according to the control signal includes: outputting the stop data flow control signal or the resume data flow control signal to the target device through a set target physical port, wherein the stop data flow control signal is used to instruct the target device to stop sending data, and the resume data flow control signal is used to instruct the target device to continue sending data. In this way, the control signal in full-duplex mode realizes the data flow control function.

[0034] In some embodiments, controlling the data transmission state of the target device according to the control signal includes: outputting the send data direction control signal or the receive data direction control signal through a set target physical port to control the data transmission state of the target device, the send data direction control signal is used to instruct the target device to send data, and the receive data direction control signal is used to instruct the target device to receive data. In this way, the control signal in half-duplex mode implements a data direction switching function.

[0035] In some embodiments, controlling the data transmission state of the target device according to the control signal includes: sending the sending data direction control signal or the receiving data direction control signal to a half-duplex controller, so that the half-duplex controller controls the target device to send data or receive data. In this way, the serial communication controller is able to output the data direction control signal.

[0036] In some embodiments, before the serial communication controller generates a control signal corresponding to the serial communication mode, the method may further include: if a signal configuration instruction is received, the serial communication controller is controlled to generate a control signal corresponding to the serial communication mode according to the signal configuration instruction, and the data transmission state of the target device is controlled according to the control signal. In this way, the serial communication controller can directly configure the control signal through the application according to the needs of the application scenario. Compared with directly controlling the data transmission direction through the application, the present invention configures the control signal of the serial communication controller through the application, avoids the process from the application executing the command to the actual switching, avoids the generation of time difference, and ensures the efficiency and reliability of data transmission. At the same time, because the control signal configured by the application is continuous and does not depend on the detection result, it can always maintain a data transmission state for a period of time, effectively preventing data flow interruption.

[0037] Figure 21 is a flow chart showing a serial communication control method 200 according to an embodiment of the present invention, wherein the method 200 is applied to a master device supporting serial communication, wherein the target device is a slave device that performs data transmission with the master device. The serial communication mode between the master and slave devices is a full-duplex mode, and the slave device is in a data transmission state. The method 200 includes the following steps 202 to 208.

[0038] In step 202, it is determined according to the data transmission instruction that the current serial communication mode is the full-duplex mode.

[0039] In step 204, it is detected whether the amount of data in the first memory of the master device for storing received data is greater than a preset storage threshold.

[0040] In step 206, if yes, the master device generates a stop data flow control signal through the serial communication controller, and outputs the stop data flow control signal to the slave device via the target physical port to instruct the slave device to stop sending data.

[0041] In step 208, if not, the master device generates a resume data flow control signal through the serial communication controller, and outputs the resume data flow control signal to the slave device via the target physical port to instruct the slave device to continue sending data.

[0042] In some embodiments, the stop data flow control signal and the resume data flow control signal represent different level states of the data flow control signal, wherein the stop data flow control signal is a low level signal and the resume data flow control signal is a high level signal, so as to enable the slave device to switch to different transmission states.

[0043] In some embodiments, the storage threshold of the receiving end of the serial device is configured by the processor of the master device. In some embodiments, the storage threshold is 32 bytes of data, and the master device detects the data amount of the memory of the receiving end in real time. When the data amount of the memory is less than or equal to 32 bytes, the serial communication controller outputs a high-level signal to allow the slave device to continue to send data. When the data amount of the memory is greater than 32 bytes, the serial communication controller outputs a low-level signal to prohibit the slave device from continuing to send data. After waiting for the data in the memory of the receiving end to be read, when the data amount of the memory is less than 32 bytes, the serial communication controller outputs a high-level state to allow the slave device to continue to send data.

[0044] Figure 3is a waveform diagram showing a data flow control signal. In some embodiments, in clock cycles 7 to 8, the data flow control signal is a high level signal, and the output signal is a continued transmission data flow control signal at this time, so the received data of the receiving end is synchronized with the transmitted data of the transmitting end (D0 and D1). In clock cycles 5 to 6, the data flow control signal is a low level signal, and the output signal is a stop data flow control signal at this time, so the receiving end ignores the transmitted data of the transmitting end (D2 and D3). In clock cycles 2 to 4, the data flow control signal is a high level signal, and the output signal is a continued transmission data flow control signal at this time, so the receiving end continues to receive the transmitted data of the transmitting end (D2, D3 and D4).

[0045] Figure 4 4 is a flow chart showing a serial communication control method 400 according to an embodiment of the present invention. The method 400 is applied to a master device supporting serial communication, and the target device is a slave device that performs data transmission with the master device. The master device and the slave device are electrically coupled through a half-duplex controller. The serial communication mode between the master and the slave device is a half-duplex mode. The method 400 includes the following steps 402 to 408.

[0046] In step 402, it is determined according to the data transmission instruction that the current serial communication mode is a half-duplex mode.

[0047] In step 404, it is detected whether the data amount of the second memory of the master device for storing the data to be sent is a null value.

[0048] In step 406, if the amount of data in the second memory is a null value, and a transmission end mark is detected in the target data of the current transmission, a receive data direction control signal is generated through the serial communication controller, and the receive data direction control signal is output to the half-duplex controller via the target physical port, so that the half-duplex controller controls the reception of data from the device.

[0049] It should be noted that if the data volume of the second memory is a null value and there is a transmission end mark in the target data of the current transmission, it indicates that there is no data to be transmitted in the current serial communication and the serial communication has completed the current data transmission.

[0050] In step 408, if the amount of data in the second memory is not a null value, and a transmission start mark is detected in the target data of the current transmission, a data transmission direction control signal is generated through the serial communication controller, and the data transmission direction control signal is output to the half-duplex controller via the target physical port, so that the half-duplex controller controls the transmission of data from the device.

[0051] It should be noted that if the data volume of the second memory is not a null value and there is a transmission start mark in the target data of the current transmission, it indicates that there is data to be transmitted in the current serial communication and the serial communication is ready for data transmission.

[0052] In some embodiments, the data transmission direction control signal and the data reception direction control signal represent different level states of the data direction control signal, wherein the data reception direction control signal is a low level signal and the data transmission direction control signal is a high level signal, so as to enable the half-duplex controller to switch to different transmission states.

[0053] In some embodiments, the serial communication controller outputs a high level signal to enable the transmitter in the half-duplex controller, thereby indicating that the current working state of the half-duplex controller is to send data. The serial communication controller outputs a low level signal to enable the receiver in the half-duplex controller, thereby indicating that the current working state of the half-duplex controller is to receive data.

[0054] Figure 5 is a waveform diagram showing a data direction control signal. In some embodiments, in clock cycles 7 to 10, the data direction control signal is a low level signal, and the output signal is a receive data direction control signal at this time, so the bus data is in a receive state. In clock cycles 2 to 6, the data direction control signal is a high level signal, and the output signal is a send data direction control signal at this time, so the bus data is in a send state.

[0055] In some embodiments, the control signal of the serial communication controller can be configured using an application according to the application scenario requirements. Specifically, if a signal configuration instruction is received, the serial communication controller is controlled to generate a control signal corresponding to the serial communication mode according to the signal configuration instruction, and the data transmission state of the target device is controlled according to the control signal. In some embodiments, if the signal configuration instruction configures the half-duplex controller to receive, the control signal continues to indicate a receiving state, and the hardware switching is not dependent on the amount of data in the memory, but the receiving capability is continuously maintained. If the signal configuration instruction configures the half-duplex controller to send, the control signal continues to indicate a sending state, that is, no data is received at any time. In some embodiments, the state of the control signal can be configured using an application according to the storage state of the system. If the system storage meets the transmission requirements or reaches the maximum capacity, the application can configure the control signal to a sending state, and the data is continuously transmitted to prevent data flow interruption.

[0056] According to another aspect of the present invention, Figure 6 is a schematic diagram showing the structure of a serial communication control device 600 according to an embodiment of the present invention. Figure 6The apparatus 600 includes a processor 602 and a serial communication controller 604, wherein the serial communication controller 604 is electrically coupled to the processor and the target device 700. The processor 602 is configured to determine any serial communication mode of the full-duplex mode and the half-duplex mode according to the data transmission instruction. The serial communication controller 604 is configured to generate a control signal corresponding to the serial communication mode, so that the data transmission state of the target device 700 is controlled according to the control signal.

[0057] In some embodiments, the apparatus 600 further includes a memory 606. The memory 606 is electrically coupled to the processor 602 and the target device 700, and is configured to store received data and data to be sent.

[0058] Figure 7 is a system block diagram showing a serial communication control device 600 in full-duplex mode. The serial communication control device 600 is a master device for data transmission, and the target device 700 is a slave device for data transmission. In some embodiments, the processor 602 is electrically coupled to the serial communication controller 604 and the memory 606, the serial communication controller 604 is electrically coupled to the processor of the target device 700, and the memory 606 is electrically coupled to the memory of the target device 700. In full-duplex mode, the serial communication controller 604 sends the control signal to the target device 700 to control the target device 700 to suspend or continue to send data according to the control signal.

[0059] Figure 8 is a system block diagram showing the serial communication control device 600 in half-duplex mode. Figure 8 As shown, the device 600 also includes a half-duplex controller 608. In some embodiments, the processor 602 is electrically coupled to the serial communication controller 604 and the memory 606 respectively, the serial communication controller 604 and the memory 606 are electrically coupled to the target device 700, and the target device 700 is also electrically coupled to the memory of the slave device for data transmission. In addition, the half-duplex controller 608 is electrically coupled between the serial communication controller 604 and the target device 700. The half-duplex controller 608 is configured to receive the control signal from the serial communication controller 604 in the half-duplex mode, and control the target device 700 to send or receive data according to the control signal.

[0060] It should be noted that the serial communication controller 604 uses the same set of target physical port PADs in full-duplex mode and half-duplex mode, wherein the target physical port PADs are used for data flow control in full-duplex mode and for data direction control in half-duplex mode.

[0061] According to yet another aspect of the present invention, Fig. 9is a schematic diagram showing an electronic device 900 according to an embodiment of the present invention. Fig. 9 The electronic device 900 includes a memory 902, a processor 904, and a computer program stored in the memory 902 and executable on the processor 904. When the processor 904 executes the computer program, the various steps of the serial communication control method described above are implemented.

[0062] In summary, the serial communication control method and device, and electronic device provided by the present invention provide different types of control signals through a serial communication controller based on the transmission characteristics of full-duplex mode and half-duplex mode, output data flow control signals in full-duplex communication mode, and output transmission direction indication signals in half-duplex communication mode. There is no need to configure the data transmission state of the serial communication mode through an application program, but the control is directly implemented based on the hardware device of the serial communication controller, thereby avoiding the time difference between the execution of commands and the actual data transmission control process at the application layer, and effectively improving the efficiency and reliability of data transmission. In addition, since the full-duplex mode and the half-duplex mode are selected in the same application scenario, the control signal only needs one set of target physical terminals, which not only improves the transmission efficiency but also saves transmission resources.

[0063] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A serial communication control method, characterized in that: include: Determine any serial communication mode of the full-duplex mode and the half-duplex mode according to the data transmission instruction; generating a control signal corresponding to the serial communication mode by a serial communication controller; as well as The data transmission state of the target device is controlled according to the control signal.

2. The serial communication control method according to claim 1, characterized in that: Generating a control signal corresponding to the serial communication mode by a serial communication controller includes: If the serial communication mode is a full-duplex mode, generating a data flow control signal corresponding to the full-duplex mode through the serial communication controller; If the serial communication mode is a half-duplex mode, a data direction control signal corresponding to the half-duplex mode is generated by the serial communication controller.

3. The serial communication control method according to claim 2, characterized in that: Generating a data flow control signal corresponding to the full-duplex mode by the serial communication controller includes: Detecting whether the amount of data in the first memory used to store the received data is greater than a preset storage threshold; If yes, generating a data flow stop control signal through the serial communication controller; Otherwise, a resume data flow control signal is generated by the serial communication controller.

4. The serial communication control method according to claim 2, characterized in that: Generating, by the serial communication controller, a data direction control signal corresponding to the half-duplex mode comprises: Detecting whether the data amount of the second memory used for storing the data to be sent is a null value; If the amount of data in the second memory is a null value and a transmission end mark is detected in the target data of the current transmission, a receiving data direction control signal is generated by the serial communication controller; If the data amount in the second memory is not a null value and it is detected that a transmission start mark exists in the target data to be transmitted this time, a data transmission direction control signal is generated through the serial communication controller.

5. The serial communication control method according to claim 3, characterized in that: Controlling the data transmission state of the target device according to the control signal includes: The stop data flow control signal or the resume data flow control signal is output to the target device through the set target physical port, the stop data flow control signal is used to instruct the target device to stop sending data, and the resume data flow control signal is used to instruct the target device to continue sending data.

6. The serial communication control method according to claim 4, characterized in that: Controlling the data transmission state of the target device according to the control signal includes: The sending data direction control signal or the receiving data direction control signal is output through the set target physical port to control the data transmission status of the target device. The sending data direction control signal is used to instruct the target device to send data, and the receiving data direction control signal is used to instruct the target device to receive data.

7. The serial communication control method according to claim 6, characterized in that: Controlling the data transmission state of the target device according to the control signal includes: The data transmission direction control signal or the data reception direction control signal is sent to a half-duplex controller, so that the half-duplex controller controls the target device to transmit data or receive data.

8. The serial communication control method according to claim 2, characterized in that: Before generating a control signal corresponding to the serial communication mode through a serial communication controller, the method further includes: If a signal configuration instruction is received, the serial communication controller is controlled to generate a control signal corresponding to the serial communication mode according to the signal configuration instruction, and the data transmission state of the target device is controlled according to the control signal.

9. A serial communication control device, characterized in that: include: A processor configured to determine any one of a full-duplex mode and a half-duplex mode of serial communication according to a data transmission instruction; as well as The serial communication controller is electrically coupled to the processor and the target device and is configured to generate a control signal corresponding to the serial communication mode so that the data transmission state of the target device is controlled according to the control signal.

10. The serial communication control device according to claim 9, characterized in that: Also includes: The memory is electrically coupled to the processor and the target device and is configured to store received data and data to be sent.

11. The serial communication control device according to claim 9, characterized in that: Also includes: A half-duplex controller is electrically coupled between the serial communication controller and the target device and is configured to receive the control signal from the serial communication controller in a half-duplex mode and control the target device to send or receive data according to the control signal.

12. The serial communication control device according to claim 9, characterized in that: The serial communication controller is configured to: In the full-duplex mode, the control signal is sent to the target device to control the target device to suspend sending data or continue sending data according to the control signal.

13. An electronic device, characterized in that: include: a memory configured to store a computer program; as well as A processor is configured to execute the computer program to perform a serial communication control method according to any one of claims 1 to 8.