Serial communication device

By introducing a dual-role controller and a message transmission controller into the serial communication device, device roles are identified and simulated, enabling peer-to-peer communication among multiple devices and concurrent connections between multiple hosts. This solves the problem of system communication interruption caused by single-host failure and improves the reliability and scalability of the system.

CN122111921BActive Publication Date: 2026-07-21SHENZHEN INJOINIC TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610569168.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-04-28
Publication Date
2026-07-21
Estimated Expiration
2046-04-28

Smart Images

  • Figure CN122111921B_ABST
    Figure CN122111921B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a serial communication device. The serial communication device comprises a plurality of serial communication links and a message transmission controller. The serial communication link comprises a serial connector, a dual-role controller and a communication control unit. The dual-role controller identifies a target role type of a first serial bus device. The communication control unit enters a reference role mode based on the target role type, and transmits a first message to the message transmission controller in the reference role mode. The message transmission controller transmits the first message to a second serial bus device based on target routing information. According to the target role type, the communication control unit is flexibly controlled to simulate a role type opposite to the target role type. In cooperation with a routing forwarding mechanism of the message transmission controller, it is ensured that a plurality of serial bus devices of any role type can communicate with each other under a traditional serial bus, so that a single host failure point is eliminated, and peer-to-peer communication of the plurality of serial bus devices of any role type is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of serial communication technology, specifically to a serial communication device. Background Technology

[0002] Serial communication technology, due to its advantages such as low cost, high reliability, and suitability for long-distance transmission, has become the cornerstone of modern electronic system interconnection and is widely used in various fields such as consumer electronics and industrial control. However, many serial communication protocols adopt a strict single-master architecture in their design, meaning that the communication control of the entire bus or network belongs to only one master. Although this centralized control mode simplifies the design, its limitations become increasingly apparent as system complexity increases: the communication of the entire system depends entirely on a single master, and when the master experiences a crash, power outage, malfunction, or disconnection, the entire system cannot communicate normally. Summary of the Invention

[0003] To address the aforementioned technical problems, this application provides a serial communication device that improves upon the situation where related technologies are prone to system failure due to a single point of failure.

[0004] In a first aspect, embodiments of this application provide a serial communication device, including multiple serial communication links and a message transmission controller. The message transmission controller is communicatively connected to each of the serial communication links. Each serial communication link includes a serial connector, a dual-role controller, and a communication control unit connected in sequence. The communication control unit is also communicatively connected to the message transmission controller. The serial connector is configured to connect to a first serial bus device. The dual-role controller is configured to identify a target role type of the first serial bus device, wherein the role type includes a master type or a slave type. The communication control unit is configured to enter a reference role mode based on the target role type of the first serial bus device. When a first message is received from the first serial bus device to a second serial bus device in the reference role mode, the first message is transmitted to the message transmission controller. The role type of the reference role mode is opposite to the target role type. The message transmission controller is configured to acquire target routing information from the first serial bus device to the second serial bus device and transmit the first message to the second serial bus device based on the target routing information.

[0005] Optionally, identifying the target role type of the first serial bus device includes: the dual role controller being configured to acquire a device type command sent by the first serial bus device, the device type command carrying a target role identifier; and the dual role controller being configured to, in response to the device type command, determine a role type that matches the target role identifier between the host type and the slave type as the target role type.

[0006] Optionally, the reference role mode includes a host working mode or a slave working mode. Entering the reference role mode based on the target role type of the first serial bus device includes: the dual role controller is configured to encapsulate the target role type of the first serial bus device into a mode type command and send the mode type command to the communication control unit; the communication control unit is configured to parse the target role type from the mode type command and enter the reference role mode based on the target role type.

[0007] Optionally, the communication control unit includes a host controller and a slave controller, the reference role mode includes a host working mode and a slave working mode, the role type includes a host type and a slave type, and sending the mode type command to the communication control unit includes: the dual-role controller is configured to send the mode type command to the slave controller in response to the target role type being a host type, so that the slave controller enters the slave working mode based on the mode type command; or, the dual-role controller is configured to send the mode type command to the host controller in response to the target role type being a slave type, so that the host controller enters the host working mode based on the mode type command.

[0008] Optionally, the reference role mode includes a host working mode and a slave working mode. When the first message transmitted by the first serial bus device through the serial connector and the dual-role controller is received in the reference role mode, transmitting the first message to the message transmission controller includes: the communication control unit is configured to, in response to the reference role mode being in host working mode, send a message read command to the first serial bus device through the dual-role controller and the serial connector, so that the first serial bus device transmits the first message to the communication control unit through the serial connector and the dual-role controller; the communication control unit is further configured to transmit the first message to the message transmission controller.

[0009] Optionally, the reference role mode includes a master working mode and a slave working mode. The step of receiving a first message transmitted by the first serial bus device through the serial connector and the dual-role controller in the reference role mode, and transmitting the first message to the message transmission controller, further includes: the communication control unit being configured to, in response to the reference role mode being a slave working mode, acquire the first message actively sent by the first serial bus device through the dual-role controller and the serial connector; and the communication control unit being configured to transmit the first message to the message transmission controller.

[0010] Optionally, obtaining the target routing information from the first serial bus device to the second serial bus device includes: the message transmission controller being configured to obtain a first message sent by the communication control unit, a first device identifier of the first serial bus device, a second device identifier of the second serial bus device, and a device control identifier of the communication control unit; the message transmission controller being configured to determine the transmission link information of the target serial communication link based on the second device identifier of the second serial bus device, wherein the target serial communication link is a serial communication link electrically connected to the second serial bus device; the message transmission controller being configured to generate target routing information based on the first device identifier, the second device identifier of the second serial bus device, the device control identifier, and the transmission link information of the target serial communication link, and add the target routing information to the first message to obtain an updated first message; the message transmission controller being configured to, when detecting that the first message meets a preset sending condition, parse the target routing information from the updated first message, and transmit the first message to the second serial bus device based on the target routing information.

[0011] Optionally, provided that both the first serial bus device and the second serial bus device are hosts, and the first serial bus device sends a first message to the second serial bus device, the target routing information includes the first serial bus device, the serial connector of the reference serial communication link, the dual-role controller of the reference serial communication link, the communication control unit of the reference serial communication link, the message transmission controller, the communication control unit of the target serial communication link, the dual-role controller of the target serial communication link, the serial connector of the target serial communication link, and the second serial bus device, wherein the reference serial communication link is a serial communication link electrically connected to the first serial bus device.

[0012] Optionally, the communication control unit includes a host controller and a slave controller. The step of determining the transmission link information of the target serial communication link based on the second device identifier of the second serial bus device includes: the message transmission controller being configured to acquire a device maintenance list, the device maintenance list including a set of device addresses for all serial communication links and a device identifier of the serial bus device electrically connected to each serial communication link; the set of device addresses being a set of addresses of corresponding devices under a serial communication link; both the host controller and the slave controller of the serial communication link being configured with status identifiers, the status identifiers including an active identifier and a standby identifier; the message transmission controller being configured to determine, based on the device maintenance list and the second device identifier, the serial communication link electrically connected to the second serial bus device as the target serial communication link; and the message transmission controller being configured to determine, in the communication control unit, the controller with the active status identifier as the target controller, and generate the transmission link information of the target serial communication link based on the address of the target controller and the second device identifier.

[0013] Optionally, provided that both the first serial bus device and the second serial bus device are slave devices, and the first serial bus device sends a first message to the second serial bus device: the target routing information includes the first serial bus device, the serial connector of the reference serial communication link, the dual-role controller of the reference serial communication link, the master controller of the reference serial communication link, the message transmission controller, the master controller of the target serial communication link, the dual-role controller of the target serial communication link, the serial connector of the target serial communication link, and the second serial bus device, wherein the reference serial communication link is a serial communication link electrically connected to the first serial bus device.

[0014] Optionally, provided that the first serial bus device is a master, the second serial bus device is a slave, and the first serial bus device sends a first message to the second serial bus device: the target routing information includes the first serial bus device, the serial connector of the reference serial communication link, the dual-role controller of the reference serial communication link, the slave controller of the reference serial communication link, the message transmission controller, the master controller of the target serial communication link, the dual-role controller of the target serial communication link, the serial connector of the target serial communication link, and the second serial bus device, wherein the reference serial communication link is a serial communication link electrically connected to the first serial bus device.

[0015] Optionally, where both the first and third serial bus devices are masters, the second serial bus device is a slave, and the first serial bus device sends a first message to the second serial bus device and the third serial bus device sends a second message to the second serial bus device: the target routing information of the first serial bus device includes the first serial bus device, the serial connector of the reference serial communication link, the dual-role controller of the reference serial communication link, the slave controller of the reference serial communication link, the message transmission controller, the master controller of the target serial communication link, the dual-role controller of the target serial communication link, the serial connector of the target serial communication link, and the second serial bus device, wherein the reference serial communication link is a serial communication link electrically connected to the first serial bus device; the target routing information of the third serial bus device includes the third serial bus device, a candidate... The system comprises a serial connector for a serial communication link, a dual-role controller for a candidate serial communication link, a slave controller for a candidate serial communication link, a message transmission controller, a master controller for a target serial communication link, a dual-role controller for the target serial communication link, a serial connector for the target serial communication link, and a second serial bus device, wherein the candidate serial communication link is a serial communication link electrically connected to the third serial bus device; the step of transmitting the first message to the second serial bus device based on the target routing information includes: the message transmission controller being configured to transmit the first message sent by the first serial bus device to the second serial bus device based on the target routing information of the first serial bus device; the message transmission controller being further configured to transmit the second message sent by the third serial bus device to the second serial bus device based on the target routing information of the third serial bus device.

[0016] The beneficial effects of the embodiments of this application are as follows: The embodiments of this application can flexibly control the communication control unit to simulate a role type opposite to the target role type according to the target role type of the serial bus device. With the cooperation of the routing and forwarding mechanism of the message transmission controller, it can ensure that two or more serial bus devices of any role type can communicate with each other under the traditional serial bus. This eliminates the single host failure point, realizes peer-to-peer communication between two or more serial bus devices of any role type, supports flexible expansion of multiple devices, does not require physical disconnection, and supports concurrent connection of multiple hosts. Attached Figure Description

[0017] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0018] Figure 1 A schematic diagram of the circuit structure of a serial communication device provided for related technologies; Figure 2a A circuit structure diagram of a serial communication device provided in an embodiment of this application; Figure 2b The embodiments provided in this application are based on Figure 2a The diagram shows a serial communication device communicating with another device, where the first serial bus device is the host. Figure 3 Provided for another embodiment of this application based on Figure 2a The diagram shows a serial communication device communicating with another device, where the first serial bus device is the slave device. Figure 4 A circuit structure diagram of a serial communication device provided in another embodiment of this application; Figure 5 The embodiments provided in this application are based on Figure 4 The diagram shows a serial communication device communicating with another device, where the first serial bus device is the host. Figure 6 Provided for another embodiment of this application based on Figure 4 The diagram shows a serial communication device communicating with another device, where the first serial bus device is the slave device. Figure 7 Provided for yet another embodiment of this application based on Figure 4 The diagram shows a serial communication device communicating with another device, where the first serial bus device is the slave device. Figure 8 Provided for yet another embodiment of this application based on Figure 4 The diagram shows a serial communication device communicating with another device, where the first serial bus device is the host. Figure 9 Provided for yet another embodiment of this application based on Figure 2a The diagram shows a serial communication device communicating with another device, where both the first and second serial bus devices are host devices. Figure 10 Provided for yet another embodiment of this application based on Figure 4 The diagram shows a serial communication device communicating with another device, where both the first and second serial bus devices are slave devices. Figure 11 Provided for yet another embodiment of this application based on Figure 4 The diagram shows a serial communication device communicating with another device, where the first serial bus device is the master and the second serial bus device is the slave. Figure 12Provided for yet another embodiment of this application based on Figure 4 The diagram shows a serial communication device communicating with another device, where both the first and second serial bus devices are host devices. Detailed Implementation

[0019] To facilitate understanding of this application, a more detailed description is provided below with reference to the accompanying drawings and specific embodiments. It should be noted that when an element is described as being "fixed to" another element, it can be directly on the other element, or one or more intermediate elements may exist between them. When an element is described as being "electrically connected" to another element, it can be directly connected to the other element, or one or more intermediate elements may exist between them. The terms "upper," "lower," "inner," "outer," "bottom," etc., used in this specification indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application. Furthermore, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0020] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items. Furthermore, technical features involved in the different embodiments of this application described below may be combined with each other as long as they do not conflict with each other.

[0021] Serial communication protocols such as SPI (Serial Peripheral Interface), Modbus RTU (Modbus Remote Terminal Unit), and USB (Universal Serial Bus) are designed with a strict single-master architecture, where the communication control of the entire bus or network belongs to only one master.

[0022] Traditional single-master serial buses centralize communication control in a single master, making the master the single point of failure in the system. Once the master fails, loses power, or malfunctions, the entire bus communication will be completely interrupted, and all slave devices will be unable to continue working, resulting in serious deficiencies in system reliability and stability.

[0023] The specific manifestations of a single point of failure are as follows: 1) When the master unit fails, all slave units cannot communicate with each other. 2) When the master unit's program fails, the system bus is blocked. 3) When the master unit fails, no other device has the function to take over the master unit.

[0024] In a single-host centralized control mode, system resources and communication capabilities are limited by the processing performance and interface resources of the single host. As the number of devices increases, the bus load increases, the communication rate decreases, and device expansion and system upgrades are severely restricted, resulting in poor scalability and difficulty in meeting the deployment requirements of complex systems.

[0025] The poor scalability manifests itself in the following ways: 1) The number of host interfaces is limited; if the system needs to add slave devices, the host system needs to be replaced. 2) The host's processing power is fixed; the more slave devices there are, the lower the host's processing speed becomes.

[0026] In a single-host architecture, devices lack peer-to-peer communication capabilities. Slave devices cannot interact directly and must rely on the host as an intermediary; multiple hosts cannot access and collaborate in parallel. The system struggles to achieve distributed control, real-time linkage, and autonomous collaboration, resulting in significantly insufficient flexibility and collaborative efficiency.

[0027] The specific manifestations of poor peer-to-peer coordination are as follows: 1) When slave A needs to send a message to slave B, slave A needs to send the message to the master, and the master forwards the message to slave B. Therefore, slave A and slave B cannot communicate peer-to-peer. 2) Poor real-time performance and high latency. 3) Inability to achieve distributed control and multi-device synchronous coordination. 4) The two masters cannot communicate directly. 5) When two masters access the same slave at the same time, a hard switch is required. The system cannot maintain concurrent connections between multiple masters and the same slave, limiting the system's flexibility and real-time coordination capabilities.

[0028] Please see Figure 1 When the first master and the second master access the same slave, the second master is configured to output a target signal, which causes the bus control module to output a level signal through the corresponding output terminal. This level signal triggers the corresponding switch branch of the same slave to switch from closed to open state, so that the second master disconnects from the same slave. Finally, the first master can reliably communicate with the slave.

[0029] This approach requires physical-level control of the switching branch to achieve master switching. Essentially, it avoids conflicts when two masters access the same slave device by forcibly disconnecting the connection.

[0030] Therefore, embodiments of this application provide a serial communication device. Please refer to... Figure 2aThe serial communication device 100 includes multiple serial communication links 200 and a message transmission controller 300, with the message transmission controller 300 communicatively connected to each serial communication link 200. Each serial communication link 200 can be electrically connected to a serial bus device, which can be a master or a slave device. Therefore, the serial communication device 100 provided in this embodiment supports parallel access of multiple devices, with the message transmission controller 300 uniformly scheduling messages to avoid bus conflicts and achieve multi-channel concurrent processing.

[0031] Each serial communication link 200 includes a serial connector 21, a dual-role controller 22, and a communication control unit 23 connected in sequence. The communication control unit 23 is also connected in communication with the message transmission controller 300.

[0032] The serial connector 21 is configured to connect to the first serial bus device 400. The serial connector 21 serves as a physical interface for connecting to the external first serial bus device 400, enabling electrical connection and message transmission and reception.

[0033] The dual-role controller 22 is configured to identify the target role type of the first serial bus device 400, wherein the role type includes a master type or a slave type, the master type being the type of serial bus device that can have master functions, and the slave type being the type of serial bus device that can have slave functions.

[0034] In this field, the master typically has bus control, actively initiating communication, sending data, and reading data, and can access any slave device. Slave devices do not have bus control, can only wait for calls from the master, cannot preempt the bus, and passively respond to the master.

[0035] The target role type can be either a master type or a slave type, that is: the first serial bus device 400 can be either a master or a slave.

[0036] When the first serial bus device 400 is plugged into the serial connector 21, the first serial bus device 400 sends a device type command through the serial connector 21. The dual-role controller 22 is configured to receive the device type command sent by the first serial bus device 400. The device type command carries a target role identifier, which is used to identify the target role type.

[0037] The dual-role controller 22 is configured to respond to a device type command by determining the target role type as the one that matches the target role identifier between the host type and the slave type. When the target role identifier is a host type identifier, the target role type is the host type. When the target role identifier is a slave type identifier, the target role type is the slave type.

[0038] The communication control unit 23 is configured to enter a reference role mode based on the target role type of the first serial bus device 400, wherein the role type of the reference role mode is the opposite of the target role type. When the target role type is a master type, the role type of the reference role type is a slave type. When the target role type is a slave type, the role type of the reference role type is a master type.

[0039] The reference role modes include master working mode or slave working mode. In master working mode, the communication control unit 23 simulates the working logic of a master. For example, the first serial bus device 400 is a slave. After the communication control unit 23 enters master working mode, it can actively read messages or data from the first serial bus device 400, or it can write messages or data to the first serial bus device 400.

[0040] In slave mode, the communication control unit 23 simulates the working logic of a slave device. For example, the first serial bus device 400 is the master. After the communication control unit 23 enters slave mode, it receives messages or data transmitted by the first serial bus device 400 and sends the messages or data transmitted by the first serial bus device 400 to the message transmission controller 300.

[0041] The dual-role controller 22 is configured to encapsulate the target role type of the first serial bus device 400 into a mode type command and send the mode type command to the communication control unit 23. The communication control unit 23 is configured to parse the target role type from the mode type command and enter the reference role mode based on the target role type.

[0042] Please see Figure 2b When the target role type is a host type, the reference role mode is a slave working mode. The communication control unit 23 enters the slave working mode, and the first serial bus device 400 can send the first message to the dual-role controller 22 through the serial connector 21. The communication control unit 23 has been simulated as a slave and entered the slave working mode. Therefore, the communication control unit 23 transmits the first message sent by the dual-role controller 22 to the message transmission controller 300, which determines the forwarding of the first message.

[0043] Please see Figure 3When the target role type is slave, the reference role mode is master working mode, and the communication control unit 23 enters master working mode. The communication control unit 23 has been simulated as a master and enters master working mode. The communication control unit 23 can read the first message from the first serial bus device 400 through the dual-role controller 22 and the serial connector 21, so that the first message from the first serial bus device 400 is transmitted to the communication control unit 23 through the serial connector 21 and the dual-role controller 22. The communication control unit 23 then transmits the first message sent by the dual-role controller 22 to the message transmission controller 300, which determines the forwarding of the first message.

[0044] The communication control unit 23 provided in this application embodiment simulates a role opposite to the target role type of the first serial bus device 400 and enters the corresponding reference role mode, thereby adapting to the access of any serial bus device and communicating with the serial bus device in an active or passive manner. At the same time, the communication control unit 23 can also ensure that any two serial bus devices can achieve peer-to-peer communication.

[0045] It is understandable that the communication control unit 23 can be a host controller, a slave controller, or both.

[0046] In some embodiments, please refer to Figure 4 The communication control unit 23 includes a host controller 231 and a slave controller 232. The role types include host type and slave type. The process of sending mode type commands to the communication control unit 23 is as follows: The dual-role controller 22 is configured to send a mode type command to the slave controller 232 in response to the target role type being master type, so that the slave controller 232 enters slave working mode based on the mode type command. At this time, the master controller 231 is in a pending state.

[0047] Please see Figure 5 When the target role type is master, the reference role mode is slave working mode. The dual-role controller 22 identifies the role type of the first serial bus device 400 as master. To enable the communication control unit 23 to simulate a slave, the dual-role controller 22 makes an automated decision, autonomously sending a mode type command to the slave controller 232 instead of the master controller 231. Since the master controller 231 does not receive the mode type command, it enters a waiting state, but the slave controller 232 receives the command and enters an active state. The slave controller 232 parses the master type from the mode type command and enters slave working mode based on the master type.

[0048] The first serial bus device 400 can send a first message to the dual-role controller 22 via the serial connector 21. The dual-role controller 22 sends the first message to the slave controller 232, and the slave controller 232 transmits the first message to the message transmission controller 300 in slave mode, whereby the message transmission controller 300 determines the forwarding of the first message.

[0049] In some embodiments, the dual-role controller 22 is also configured to send a mode type command to the host controller 231 in response to the target role type being slave type, so that the host controller 231 enters the host working mode based on the mode type command.

[0050] Please see Figure 6 When the target role type is slave, the reference role mode is master operating mode. The dual-role controller 22 identifies the role type of the first serial bus device 400 as slave. To enable the communication control unit 23 to simulate a master, the dual-role controller 22 makes an automated decision, autonomously sending the mode type command to the master controller 231 instead of the slave controller 232. Since the slave controller 232 does not receive the mode type command, it enters a waiting state, while the master controller 231 receives the mode type command and enters an active state. The master controller 231 parses the slave type from the mode type command and enters master operating mode based on the slave type.

[0051] The host controller 231 can read the first message of the first serial bus device 400 through the dual-role controller 22 and the serial connector 21, so that the first message of the first serial bus device 400 is transmitted to the host controller 231 through the serial connector 21 and the dual-role controller 22. The host controller 231 then transmits the first message to the message transmission controller 300, and the message transmission controller 300 decides to forward the first message.

[0052] The communication control unit 23 provided in this embodiment consists of a host controller 231 and a slave controller 232. Instead of switching between host and slave controller modes in a single controller mode, this embodiment uses a dual-role controller 22 to determine the role type of the first serial bus device 400. Based on the determination, it autonomously decides which controller between the host controller 231 and slave controller 232 needs to be activated to enter the working state. This effectively decouples the host and slave roles, assigning them to different controllers and fixing their roles, awaiting activation by the dual-role controller 22. This avoids the complexity and unreliability caused by switching roles in a single controller mode via software, improving the reliability of the communication control unit 23 in simulating a host / slave connection.

[0053] The communication control unit 23 is also configured to transmit the first message to the message transmission controller 300 when it receives the first message sent by the first serial bus device 400 to the second serial bus device 500 in the reference role mode.

[0054] The following embodiments of this application will explain the working principle of the serial communication device 100 in both the case where the first serial bus device 400 is a slave and the case where the first serial bus device 400 is a master, as detailed below: 1) The first serial bus device 400 is a slave device.

[0055] In some embodiments, the communication control unit 23 is configured to send a message read command to the first serial bus device 400 via the dual-role controller 22 and the serial connector 21 in response to the reference role mode being the host working mode, so that the first serial bus device 400 transmits a first message to the communication control unit 23 via the serial connector 21 and the dual-role controller 22, and transmits the first message to the message transmission controller 300.

[0056] Please see Figure 7 Given that the first serial bus device 400 is a slave device, the dual-role controller 22 determines that the target role type of the first serial bus device 400 is a slave type through the serial connector 21, encapsulates the target role type of the first serial bus device 400 into a mode type command, and sends the mode type command to the communication control unit 23. The communication control unit 23 parses the target role type from the mode type command and enters the master working mode based on the target role type.

[0057] In host operation mode, the communication control unit 23 sends a message read command to the first serial bus device 400 via the dual-role controller 22 and the serial connector 21. The first serial bus device 400 responds to the message read command by sending a first message to the communication control unit 23 via the serial connector 21 and the dual-role controller 22. The communication control unit 23 then sends the first message to the message transmission controller 300, which in turn sends the first message to the second serial bus device 500.

[0058] In this embodiment of the application, when the first serial bus device 400 is a slave device, the communication control unit 23 is triggered by the dual-role controller 22 to enter the master working mode and actively sends a message reading command to the first serial bus device 400 so that the first serial bus device 400 returns the first message. This satisfies the master-slave protocol specification in the serial communication protocol, is compatible with the communication scenario where the first serial bus device 400 is a slave device, and realizes peer-to-peer communication and flexible access for multiple devices.

[0059] 2) The first serial bus device 400 is the master.

[0060] In some embodiments, the communication control unit 23 is configured to, in response to the reference role mode being slave working mode, acquire the first message actively sent by the first serial bus device 400 through the dual role controller 22 and the serial connector 21, and transmit the first message to the message transmission controller 300.

[0061] Please see Figure 8 With the first serial bus device 400 acting as the master, the dual-role controller 22 determines the target role type of the first serial bus device 400 as the master type through the serial connector 21, encapsulates the target role type of the first serial bus device 400 into a mode type command, and sends the mode type command to the communication control unit 23. The communication control unit 23 parses the target role type from the mode type command and enters the slave working mode based on the target role type.

[0062] The first serial bus device 400 actively sends a first message to the communication control unit 23 via the serial connector 21 and the dual-role controller 22. The communication control unit 23 passively responds to the first serial bus device 400 by sending the first message to the message transmission controller 300, which then sends the first message to the second serial bus device 500.

[0063] In this embodiment of the application, when the first serial bus device 400 is the master, the communication control unit 23 is triggered by the dual-role controller 22 to enter the slave working mode and passively respond to the first message sent by the first serial bus device 400 so as to send the first message to the message transmission controller 300. This follows the protocol rule of "master actively initiates, slave passively receives" of the serial bus, which is compatible with the communication scenario where the first serial bus device 400 is the master, and realizes peer-to-peer communication and flexible access of multiple devices.

[0064] The message transmission controller 300 is configured to acquire target routing information from the first serial bus device 400 to the second serial bus device 500, and transmit the first message to the second serial bus device 500 based on the target routing information. The target routing information represents the message path from the first serial bus device 400 to the second serial bus device 500. The target routing information may consist of the address or port number of the corresponding device.

[0065] The embodiments of this application can flexibly control the communication control unit to simulate a role type opposite to the target role type of the serial bus device. With the cooperation of the routing and forwarding mechanism of the message transmission controller, it can ensure that two or more serial bus devices of any role type can communicate with each other under the traditional serial bus. This eliminates the single host failure point, realizes peer-to-peer communication between two or more serial bus devices of any role type, supports flexible expansion of multiple devices, does not require physical disconnection, and supports concurrent connection of multiple hosts.

[0066] The process of obtaining the target routing information from the first serial bus device to the second serial bus device is as follows: The message transmission controller 300 is configured to acquire a first message sent by the communication control unit 23, a first device identifier of the first serial bus device 400, a second device identifier of the second serial bus device 500, and a device control identifier of the communication control unit 23.

[0067] The first device identifier represents the first serial bus device 400, the second device identifier represents the second serial bus device 500, and the device control identifier represents the communication control unit 23. The first serial bus device 400 can encapsulate the first and second device identifiers within a device type command. After parsing the first and second device identifiers from the device type command, the dual-role controller 22 encapsulates them again within a mode type command. After parsing the first and second device identifiers from the mode type command, the communication control unit 23 sends the first device identifier, the second device identifier, and the device control identifier to the message transmission controller 300.

[0068] The message transmission controller 300 is configured to determine the transmission link information of a target serial communication link based on a second device identifier of the second serial bus device 500. The target serial communication link is a serial communication link electrically connected to the second serial bus device 500. The transmission link information is routing information that enables the transmission of the first message to the second serial bus device 500 within the target serial communication link.

[0069] The message transmission controller 300 is configured to generate target routing information based on the first device identifier, the second device identifier of the second serial bus device 500, the device control identifier, and the transmission link information of the target serial communication link, and add the target routing information to the first message to obtain the updated first message.

[0070] The message transmission controller 300 is configured to parse target routing information from the updated first message when it detects that the first message meets the preset sending conditions, and transmit the first message to the second serial bus device 500 based on the target routing information.

[0071] In some embodiments, this application embodiment can determine whether a first message meets preset sending conditions based on the message priority. When the priority of the first message is the highest among all messages cached by the message transmission controller 300, it is determined that the first message meets the preset sending conditions.

[0072] In some embodiments, this application determines whether the first message meets preset sending conditions based on a first-in-first-out (FIFO) order. When the first message is successfully sent, it is determined that the first message meets the preset sending conditions.

[0073] To reduce the storage space occupied by the message transmission controller 300, the message transmission controller 300 deletes the first message after transmitting it to the second serial bus device 500.

[0074] In some embodiments, when the communication control unit 23 includes a host controller 231 and a slave controller 232, determining the transmission link information of the target serial communication link based on the second device identifier of the second serial bus device 500 in this configuration of the communication control unit 23 includes the following steps: The message transmission controller 300 is configured to acquire a device maintenance list, which includes a set of device addresses for all serial communication links and device identifiers for serial bus devices electrically connected to each serial communication link. The set of device addresses is a set of addresses of the corresponding devices under a serial communication link. Both the master controller and slave controller of the serial communication link are configured with status identifiers.

[0075] The message transmission controller 300 is configured to determine the serial communication link electrically connected to the second serial bus device as the target serial communication link based on the device maintenance list and the second device identifier.

[0076] The message transmission controller 300 is configured to determine, in the communication control unit, the controller whose status identifier is active as the target controller, and generate transmission link information of the target serial communication link based on the address of the target controller and the second device identifier.

[0077] As an example, a device maintenance list is shown in Table 1: Table 1

[0078] As shown in Table 1, the device address set for serial communication link 1 is {S1, A1, B1, (C11, C12)}. The device address set for serial communication link 2 is {S2, A2, B2, (C21, C22)}. And so on, which will not be elaborated here.

[0079] The status identifiers include an active identifier and a standby identifier. The active identifier indicates that the corresponding controller is in an active state, and the standby identifier indicates that the corresponding controller is in a standby state. For example, when the status identifier of the first host controller is active, the first host controller is in an active state. When the status identifier of the first host controller is standby, the first host controller is in a standby state.

[0080] It is understandable that the address (or port) of the serial connector and the address (or port) of the dual-role controller are fixed values. Therefore, when the first device identifier, the second device identifier, and the device control identifier of the active controller are determined, the message transmission controller 300 can find the transmission link information through the device maintenance list.

[0081] It is also understandable that when a serial bus device is first plugged into a serial connector, after the dual-role controller identifies the role type of the serial bus device, it can send the device identifier of the serial bus device to the message transmission controller 300 through the controller in the active state (such as the master controller or the slave controller). The message transmission controller 300 records the device identifier of the serial bus device in the device maintenance list.

[0082] As mentioned above, after the dual-role controller 22 parses the first device identifier and the second device identifier from the device type command, the dual-role controller 22 encapsulates the first device identifier and the second device identifier in the mode type command.

[0083] When the dual-role controller 22 sends a mode type command to the master controller 231, the master controller 231 sends its activation identifier, first device identifier, second device identifier, and device control identifier to the message transmission controller 300. Alternatively, when the dual-role controller 22 sends a mode type command to the slave controller 232, the slave controller 232 sends its activation identifier, first device identifier, second device identifier, and device control identifier to the message transmission controller 300. In this way, the message transmission controller 300 can dynamically update the device maintenance list, including updating the device identifiers of the serial bus devices electrically connected to each serial communication link, and the device control identifiers of the controllers that are active between the master and slave controllers in each serial communication link.

[0084] The process of determining the target serial communication link based on the device maintenance list and the second device identifier is as follows: The message transmission controller 300 uses the second device identifier as an index to perform a traversal operation in the device maintenance list and finds the serial communication link containing the second device identifier as the target serial communication link.

[0085] The process of determining the controller with the active status in the communication control unit as the target controller is as follows: Between the host controller and slave controller of the target serial communication link, the controller with the active status is searched for as the target controller. For example, when the target serial communication link is serial communication link 2, and in serial communication link 2, when the host controller's status is in standby mode and the slave controller's status is active, the message transmission controller 300 selects the slave controller as the target controller.

[0086] The process of generating transmission link information for the target serial communication link based on the address of the target controller and the second device identifier is as follows: The transmission link information for the target serial communication link is composed of the address of the serial connector of the target serial communication link, the address of the dual-role controller, and the address of the target controller.

[0087] For example, when the target serial communication link is serial communication link 2, the address A2 of the serial connector of serial communication link 2, the address B2 of the dual-role controller, and the address C22 of the slave controller are used to form the transmission link information.

[0088] The following embodiments of this application will be described in detail based on different product forms of the communication control unit 23 and in conjunction with four application scenarios. The four application scenarios are: the first application scenario in which two hosts communicate with each other, the second application scenario in which two slaves communicate with each other, the third application scenario in which one host and one slave communicate with each other, and the fourth application scenario in which two hosts need to communicate with the same slave.

[0089] ① First application scenario: Two hosts communicate with each other.

[0090] Please see Figure 9 Under the premise that both the first serial bus device 400 and the second serial bus device 500 are hosts, and the first serial bus device 400 sends a first message to the second serial bus device 500, the target routing information is the first serial bus device 400, the serial connector 21 of the reference serial communication link 41, the dual-role controller 22 of the reference serial communication link 41, the communication control unit 23 of the reference serial communication link 41, the message transmission controller 300, the communication control unit 23 of the target serial communication link 51, the dual-role controller 22 of the target serial communication link 51, the serial connector 21 of the target serial communication link 51, and the second serial bus device 500, wherein the reference serial communication link 41 is a serial communication link electrically connected to the first serial bus device 400.

[0091] like Figure 9As shown, the dual-role controller 22 of the reference serial communication link 41 identifies the role type of the first serial bus device 400 as master type, and notifies the communication control unit 23 of the reference serial communication link 41 to simulate slave. The communication control unit 23 of the reference serial communication link 41 sends a first message to the message transmission controller 300. The message transmission controller 300 adds target routing information to the message header of the first message.

[0092] When the first message meets the preset sending conditions, the message transmission controller 300 parses the target routing information from the first message and sends the first message to the communication control unit 23 of the target serial communication link 51. The communication control unit 23 of the target serial communication link 51 sends the first message to the second serial bus device 500 through the dual-role controller 22 and serial connector 21 of the target serial communication link 51, thereby completing the dialogue or message transmission between the two hosts.

[0093] In the first application scenario, the embodiments of this application support direct peer-to-peer communication between two hosts in a serial bus, completely breaking through the limitations of a single-host architecture and bringing the following key technical advantages: 1) The two hosts can be connected to different serial communication links, thus breaking the traditional bus situation where there can only be one host and other devices must be slaves. This enables the two hosts to communicate autonomously, directly, and bidirectionally without the need for a third-party relay, forming a true peer-to-peer distributed architecture.

[0094] 2) The two hosts can back up and take over each other, and the failure of one host will not affect the continued operation of the other host.

[0095] 3) Both hosts still actively send messages according to the original single-host protocol, without the need for hardware modifications. Furthermore, direct communication between the two hosts results in shorter message paths, no need for relay queuing, and faster response times.

[0096] 4) The serial communication device 100 provided in this application embodiment is provided with multiple serial communication links 200. Each serial communication link 200 can be connected to any type of serial bus device, and a host can be added at any time. Multiple hosts can work in parallel without interfering with each other.

[0097] ② Second application scenario: Two slave devices communicate with each other.

[0098] Please see Figure 10Under the premise that both the first serial bus device 400 and the second serial bus device 500 are slave devices, and the first serial bus device 400 sends a first message to the second serial bus device 500, the target routing information is the first serial bus device 400, the serial connector 21 of the reference serial communication link 41, the dual-role controller 22 of the reference serial communication link 41, the master controller 231 of the reference serial communication link 41, the message transmission controller 300, the master controller 231 of the target serial communication link 51, the dual-role controller 22 of the target serial communication link 51, the serial connector 21 of the target serial communication link 51, and the second serial bus device 500. The reference serial communication link 41 is a serial communication link electrically connected to the first serial bus device 400.

[0099] like Figure 10 As shown, the dual-role controller 22 of the reference serial communication link 41 identifies the role type of the first serial bus device 400 as slave type, and the dual-role controller 22 of the reference serial communication link 41 notifies the host controller 231 of the reference serial communication link 41 to enter the working state.

[0100] The dual-role controller 22 of the target serial communication link 51 identifies the role type of the second serial bus device 500 as slave type, and the dual-role controller 22 of the target serial communication link 51 notifies the master controller 231 of the target serial communication link 51 to enter the working state.

[0101] The host controller 231, referring to serial communication link 41, reads the first message that the first serial bus device 400 needs to send to the second serial bus device 500 through the dual-role controller 22 and serial connector 21, and sends the first message to message transmission controller 300. Message transmission controller 300 adds target routing information to the message header of the first message.

[0102] In this case, the status of the device maintenance list is shown in Table 2: Table 2

[0103] As shown in Table 2, reference serial communication link 41 is serial communication link 1, and target serial communication link 51 is serial communication link 2. The message transmission controller 300 determines the transmission link information of serial communication link 2 based on the device maintenance list and the second device identifier of the second serial bus device 500. The transmission link information of serial communication link 2 is {C21, B2, A2}. Next, the message transmission controller 300 obtains target routing information based on the first device identifier, the second device identifier of the second serial bus device, the device control identifier, and the transmission link information of the target serial communication link. The target routing information is {S1, A1, B1, C11, C21, B2, A2, S2}.

[0104] When the first message meets the preset sending conditions, the message transmission controller 300 parses the target routing information from the first message and sends the first message to the second host controller C21 of the serial communication link 2. The second host controller C21 of the serial communication link 2 sends the first message to the second serial bus device 500 through the dual-role controller 22 and the serial connector 21 of the serial communication link 2, thereby completing the dialogue or message transmission between the two slave devices.

[0105] In the second application scenario, the embodiments of this application support direct communication between two slave devices in a serial bus, solving the defect in the traditional architecture that "slave devices cannot actively communicate and must be relayed through the master device," and has the following technical effects: 1) The slave device does not require the host to relay, enabling direct peer-to-peer communication.

[0106] 2) Reduce dependence on the host and alleviate the host's load. Interactions between slave devices do not consume host resources at all; the host only handles core control logic.

[0107] 3) Improve the real-time performance of inter-slave communication and reduce latency.

[0108] 4) When the master unit fails, the slave units can still communicate with each other, making the system more available.

[0109] 5) No protocol modification is required for the slave device, and it is compatible with all standard slave devices.

[0110] 6) Supports autonomous collaboration and distributed linkage between slave devices, allowing for more flexible expansion.

[0111] ③ Third application scenario: One master and one slave communicate with each other.

[0112] Please see Figure 11Under the premise that the first serial bus device 400 is the master, the second serial bus device 500 is the slave, and the first serial bus device 400 sends a first message to the second serial bus device 500, the target routing information is the first serial bus device 400, the serial connector 21 of the reference serial communication link 41, the dual-role controller 22 of the reference serial communication link 41, the slave controller 232 of the reference serial communication link 41, the message transmission controller 300, the master controller 231 of the target serial communication link 51, the dual-role controller 22 of the target serial communication link 51, the serial connector 21 of the target serial communication link 51, and the second serial bus device 500.

[0113] like Figure 11 As shown, the dual-role controller 22 of the reference serial communication link 41 identifies the role type of the first serial bus device 400 as the master type, and the dual-role controller 22 of the reference serial communication link 41 notifies the slave controller 232 of the reference serial communication link 41 to enter the working state.

[0114] The dual-role controller 22 of the target serial communication link 51 identifies the role type of the second serial bus device 500 as slave type, and the dual-role controller 22 of the target serial communication link 51 notifies the master controller 231 of the target serial communication link 51 to enter the working state.

[0115] The slave controller 232 of the reference serial communication link 41 receives the first message that the first serial bus device 400 needs to send to the second serial bus device 500 through the dual-role controller 22 and the serial connector 21, and sends the first message to the message transmission controller 300. The message transmission controller 300 adds target routing information to the message header of the first message.

[0116] In this case, the status of the device maintenance list is shown in Table 3: Table 3

[0117] As shown in Table 2, reference serial communication link 41 is serial communication link 1, and target serial communication link 51 is serial communication link 2. The message transmission controller 300 determines the transmission link information of serial communication link 2 based on the device maintenance list and the second device identifier of the second serial bus device 500. The transmission link information of serial communication link 2 is {C21, B2, A2}. Next, the message transmission controller 300 obtains target routing information based on the first device identifier, the second device identifier of the second serial bus device, the device control identifier, and the transmission link information of the target serial communication link. The target routing information is {S1, A1, B1, C12, C21, B2, A2, S2}.

[0118] When the first message meets the preset sending conditions, the message transmission controller 300 parses the target routing information from the first message and sends the first message to the second host controller C21 of the serial communication link 2. The second host controller C21 of the serial communication link 2 sends the first message to the second serial bus device 500 through the dual-role controller 22 and the serial connector 21 of the serial communication link 2, thereby completing the dialogue or message transmission between the host and the slave.

[0119] In the third application scenario, the embodiments of this application, while supporting direct communication between one host and one slave, do not simply implement traditional master-slave communication. Instead, they bring key advantages that traditional architectures do not possess through role adaptive simulation, message routing and forwarding, and bus decoupling and isolation: 1) The master and slave devices are completely isolated from each other on the physical bus, ensuring no interference and greater stability. In traditional systems, the master and slave devices are directly connected to the same bus, and their voltage levels, timing, and faults can affect each other. However, in this embodiment, the master and slave devices are connected to different links, and forwarding is completed internally by the device. The bus is completely electrically isolated, resulting in stronger anti-interference capabilities. An abnormality in one device will not affect the other, making the system more stable and reliable.

[0120] 2) No need to share the same bus protocol, automatic protocol / timing adaptation is completed. Traditional master and slave devices must be strictly the same in terms of protocol, timing, and voltage level, while the device provided in this application embodiment simulates adaptation internally through the master controller / slave controller, presenting a transparent bridge to the outside.

[0121] 3) It facilitates subsequent expansion to multiple hosts / slaves, and the system can be smoothly upgraded. The traditional 1 master 1 slave architecture cannot be directly upgraded to multiple devices, while the embodiment of this application is a multi-port routing architecture, and 1 master 1 slave is only the simplest scenario, and devices can be added at any time.

[0122] ④ Fourth application scenario: Both hosts need to communicate with the same slave.

[0123] Please see Figure 12 Under the premise that the first serial bus device 400 and the third serial bus device 600 are both masters, the second serial bus device 500 is a slave, and the first serial bus device 400 sends a first message to the second serial bus device 500 and the third serial bus device 600 sends a second message to the second serial bus device 500: The target routing information of the first serial bus device 400 includes the first serial bus device 400, the serial connector 21 of the reference serial communication link 41, the dual-role controller 22 of the reference serial communication link 41, the slave controller 232 of the reference serial communication link 41, the message transmission controller 300, the master controller 231 of the target serial communication link 51, the dual-role controller 22 of the target serial communication link 51, the serial connector 21 of the target serial communication link 51, and the second serial bus device 500. The reference serial communication link 41 is a serial communication link electrically connected to the first serial bus device 400.

[0124] The target routing information of the third serial bus device 600 includes the third serial bus device 600, the serial connector 21 of the candidate serial communication link 61, the dual-role controller 22 of the candidate serial communication link 61, the slave controller 232 of the candidate serial communication link 61, the message transmission controller 300, the master controller 231 of the target serial communication link 51, the dual-role controller 22 of the target serial communication link 51, the serial connector 21 of the target serial communication link 51, and the second serial bus device 500. The candidate serial communication link 61 is a serial communication link electrically connected to the third serial bus device 600.

[0125] The process of transmitting the first message to the second serial bus device based on the target routing information is as follows: The message transmission controller 300 is configured to transmit a first message sent by the first serial bus device 400 to the second serial bus device 500 based on the target routing information of the first serial bus device 400.

[0126] The message transmission controller 300 is also configured to transmit the second message sent by the third serial bus device 600 to the second serial bus device 500 based on the target routing information of the third serial bus device 600.

[0127] like Figure 12 As shown, the dual-role controller 22 of the reference serial communication link 41 identifies the role type of the first serial bus device 400 as the master type, and the dual-role controller 22 of the reference serial communication link 41 notifies the slave controller 232 of the reference serial communication link 41 to enter the working state.

[0128] The dual-role controller 22 of the target serial communication link 51 identifies the role type of the second serial bus device 500 as slave type, and the dual-role controller 22 of the target serial communication link 51 notifies the master controller 231 of the target serial communication link 51 to enter the working state.

[0129] The dual-role controller 22 of the candidate serial communication link 61 identifies the role type of the third serial bus device 600 as the master type, and the dual-role controller 22 of the candidate serial communication link 61 notifies the slave controller 232 of the candidate serial communication link 61 to enter the working state.

[0130] The host controller 231, referring to serial communication link 41, reads the first message that the first serial bus device 400 needs to send to the second serial bus device 500 through the dual-role controller 22 and serial connector 21, and sends the first message to message transmission controller 300. Message transmission controller 300 adds the target routing information of the first serial bus device 400 to the message header of the first message.

[0131] The host controller 231 of the candidate serial communication link 61 reads the second message that the third serial bus device 600 needs to send to the second serial bus device 500 through the dual-role controller 22 and the serial connector 21, and sends the second message to the message transmission controller 300. The message transmission controller 300 adds the target routing information of the third serial bus device 600 to the message header of the second message.

[0132] In this case, the status of the device maintenance list is shown in Table 4: Table 4

[0133] As shown in Table 4, reference serial communication link 41 is serial communication link 1, target serial communication link 51 is serial communication link 2, and candidate serial communication link 61 is serial communication link 3.

[0134] The message transmission controller 300 determines the transmission link information of the serial communication link 2 based on the device maintenance list and the second device identifier of the second serial bus device 500. The transmission link information of the serial communication link 2 is {C21, B2, A2}.

[0135] The message transmission controller 300 obtains the target routing information of the first serial bus device 400 based on the first device identifier, the second device identifier of the second serial bus device, the device control identifier, and the transmission link information of the target serial communication link. The target routing information of the first serial bus device 400 is {S1,A1,B1,C12,C21,B2,A2,S2}.

[0136] The message transmission controller 300 obtains the target routing information of the third serial bus device 600 based on the third device identifier, the second device identifier, the device control identifier, and the transmission link information of the target serial communication link of the third serial bus device 600. The target routing information of the third serial bus device 600 is {S3,A3,B3,C32,C21,B2,A2,S2}.

[0137] When the first message meets the preset sending conditions, the message transmission controller 300 parses the target routing information of the first serial bus device 400 from the first message and sends the first message of the first serial bus device 400 to the second host controller C21 of the serial communication link 2. The second host controller C21 of the serial communication link 2 sends the first message to the second serial bus device 500 through the dual-role controller 22 and the serial connector 21 of the serial communication link 2, thereby completing a dialogue or message transmission between a host and a slave.

[0138] When the second message meets the preset sending conditions, the message transmission controller 300 parses the target routing information of the third serial bus device 600 from the second message and sends the second message of the third serial bus device 600 to the second host controller C21 of the serial communication link 2. The second host controller C21 of the serial communication link 2 sends the first message to the second serial bus device 500 through the dual-role controller 22 and the serial connector 21 of the serial communication link 2, thereby completing the dialogue or message transmission between another host and slave.

[0139] In the fourth application scenario, the embodiments of this application support two host devices communicating with the same slave device simultaneously, solving the core defects of the traditional single-host architecture where "one slave device can only be exclusively used by one host, multiple hosts require physical switching, and concurrent access is not possible," and achieving the following technical effects: 1) Multiple hosts can access the device concurrently without physical disconnection or interruption of communication. Two hosts can maintain a connection and communicate continuously at the same time. The device is uniformly scheduled internally, without disconnection, switching, or bus preemption.

[0140] 2) Enables resource sharing among slave devices, improving hardware utilization. A slave device can be accessed, read, written, and have data acquired or commands issued by two masters simultaneously, eliminating the need to configure a separate slave device for each master.

[0141] 3) Eliminate bottlenecks caused by master monopoly and improve overall system efficiency. Dual masters can access slave devices in parallel, and unified scheduling and distribution within the device reduces waiting time and increases throughput.

[0142] 4) Supports host redundancy; failure of any host does not affect system availability. The two hosts can serve as backups for each other; if one host fails, the other host can still access the slave device normally.

[0143] 5) The host does not require any protocol modifications and is fully compatible with traditional single-host devices.

[0144] 6) The slave device does not need to support the multi-master protocol and maintains standard slave device behavior.

[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of this application as described above, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A serial communication device, characterized in that, It includes multiple serial communication links and a message transmission controller, wherein the message transmission controller is communicatively connected to each of the serial communication links, and each of the serial communication links includes a serial connector, a dual-role controller and a communication control unit that are communicatively connected in sequence, and the communication control unit is also communicatively connected to the message transmission controller; The serial connector is configured to connect to a first serial bus device; The dual-role controller is configured to identify the target role type of the first serial bus device, wherein the target role type includes a master type or a slave type; The communication control unit is configured to enter a reference role mode based on the target role type of the first serial bus device. When a first message is received from the first serial bus device to the second serial bus device in the reference role mode, the first message is transmitted to the message transmission controller. The role type of the reference role mode is the opposite of the target role type. The reference role mode includes a host working mode or a slave working mode. Entering the reference role mode based on the target role type of the first serial bus device includes: the dual role controller is configured to encapsulate the target role type of the first serial bus device into a mode type command and send the mode type command to the communication control unit; the communication control unit is configured to parse the target role type from the mode type command and enter the reference role mode based on the target role type. The communication control unit includes a host controller and a slave controller. Sending the mode type command to the communication control unit includes: the dual-role controller being configured to send the mode type command to the slave controller in response to the target role type being a host type, so that the slave controller enters slave working mode based on the mode type command; or, the dual-role controller being configured to send the mode type command to the host controller in response to the target role type being a slave type, so that the host controller enters host working mode based on the mode type command. The message transmission controller is configured to acquire target routing information from the first serial bus device to the second serial bus device, and transmit the first message to the second serial bus device based on the target routing information.

2. The serial communication device according to claim 1, characterized in that, The identification of the target role type of the first serial bus device includes: The dual-role controller is configured to acquire a device type command sent by the first serial bus device, the device type command carrying a target role identifier; The dual-role controller is configured to, in response to the device type command, determine the role type that matches the target role identifier between the host type and the slave type as the target role type.

3. The serial communication device according to claim 1, characterized in that, When the first message sent by the first serial bus device to the second serial bus device is received in the reference role mode, transmitting the first message to the message transmission controller includes: The communication control unit is configured to send a message read command to the first serial bus device through the dual-role controller and the serial connector in response to the reference role mode being the host working mode, so that the first serial bus device transmits a first message to the communication control unit through the serial connector and the dual-role controller; The communication control unit is also configured to transmit the first message to the message transmission controller.

4. The serial communication device according to claim 3, characterized in that, When the first message sent by the first serial bus device to the second serial bus device is received in the reference role mode, the first message is transmitted to the message transmission controller, which further includes: The communication control unit is configured to, in response to the reference role mode being slave working mode, acquire the first message actively sent by the first serial bus device through the dual role controller and the serial connector; The communication control unit is configured to transmit the first message to the message transmission controller.

5. The serial communication device according to any one of claims 1 to 4, characterized in that, The step of obtaining the target routing information from the first serial bus device to the second serial bus device includes: The message transmission controller is configured to acquire a first message sent by the communication control unit, a first device identifier of the first serial bus device, a second device identifier of the second serial bus device, and a device control identifier of the communication control unit. The message transmission controller is configured to determine the transmission link information of the target serial communication link based on the second device identifier of the second serial bus device, wherein the target serial communication link is a serial communication link electrically connected to the second serial bus device. The message transmission controller is configured to generate target routing information based on the first device identifier, the second device identifier of the second serial bus device, the device control identifier, and the transmission link information of the target serial communication link, and add the target routing information to the first message to obtain the updated first message; The message transmission controller is configured to, when it detects that the first message meets the preset sending conditions, parse the target routing information from the updated first message, and transmit the first message to the second serial bus device based on the target routing information.

6. The serial communication device according to claim 5, characterized in that, Under the premise that both the first serial bus device and the second serial bus device are hosts, and the first serial bus device sends a first message to the second serial bus device, the target routing information includes the first serial bus device, the serial connector of the reference serial communication link, the dual-role controller of the reference serial communication link, the communication control unit of the reference serial communication link, the message transmission controller, the communication control unit of the target serial communication link, the dual-role controller of the target serial communication link, the serial connector of the target serial communication link, and the second serial bus device, wherein the reference serial communication link is a serial communication link electrically connected to the first serial bus device.

7. The serial communication device according to claim 5, characterized in that, The method of determining the transmission link information of the target serial communication link based on the second device identifier of the second serial bus device includes: The message transmission controller is configured to acquire a device maintenance list, which includes a set of device addresses for all serial communication links and a device identifier for a serial bus device electrically connected to each serial communication link. The set of device addresses is a set of addresses of the corresponding device under a serial communication link. Both the master controller and the slave controller of the serial communication link are configured with status identifiers, which include an active identifier and a standby identifier. The message transmission controller is configured to determine the serial communication link electrically connected to the second serial bus device as the target serial communication link based on the device maintenance list and the second device identifier; The message transmission controller is configured to determine, in the communication control unit, the controller whose status identifier is active as the target controller, and generate transmission link information of the target serial communication link based on the address of the target controller and the second device identifier.

8. The serial communication device according to claim 7, characterized in that, Assuming that both the first serial bus device and the second serial bus device are slave devices, and the first serial bus device sends a first message to the second serial bus device: The target routing information includes the first serial bus device, the serial connector of the reference serial communication link, the dual-role controller of the reference serial communication link, the host controller of the reference serial communication link, the message transmission controller, the host controller of the target serial communication link, the dual-role controller of the target serial communication link, the serial connector of the target serial communication link, and the second serial bus device. The reference serial communication link is a serial communication link electrically connected to the first serial bus device.

9. The serial communication device according to claim 7, characterized in that, Under the premise that the first serial bus device is the master, the second serial bus device is the slave, and the first serial bus device sends a first message to the second serial bus device: The target routing information includes the first serial bus device, the serial connector of the reference serial communication link, the dual-role controller of the reference serial communication link, the slave controller of the reference serial communication link, the message transmission controller, the master controller of the target serial communication link, the dual-role controller of the target serial communication link, the serial connector of the target serial communication link, and the second serial bus device. The reference serial communication link is a serial communication link electrically connected to the first serial bus device.

10. The serial communication device according to claim 7, characterized in that, Under the following conditions: both the first and third serial bus devices are masters, the second serial bus device is a slave, and the first serial bus device sends a first message to the second serial bus device and the third serial bus device sends a second message to the second serial bus device: The target routing information of the first serial bus device includes the first serial bus device, the serial connector of the reference serial communication link, the dual-role controller of the reference serial communication link, the slave controller of the reference serial communication link, the message transmission controller, the master controller of the target serial communication link, the dual-role controller of the target serial communication link, the serial connector of the target serial communication link, and the second serial bus device. The reference serial communication link is a serial communication link electrically connected to the first serial bus device. The target routing information of the third serial bus device includes the third serial bus device, the serial connector of the candidate serial communication link, the dual-role controller of the candidate serial communication link, the slave controller of the candidate serial communication link, the message transmission controller, the master controller of the target serial communication link, the dual-role controller of the target serial communication link, the serial connector of the target serial communication link, and the second serial bus device. The candidate serial communication link is a serial communication link electrically connected to the third serial bus device. The step of transmitting the first message to the second serial bus device based on the target routing information includes: The message transmission controller is configured to transmit a first message sent by the first serial bus device to the second serial bus device based on the target routing information of the first serial bus device. The message transmission controller is also configured to transmit the second message sent by the third serial bus device to the second serial bus device based on the target routing information of the third serial bus device.

Citation Information

Patent Citations

  • Communication circuit among a plurality of ARMs (Acorn RISC Machine) and communication method of communication circuit

    CN104216863A

  • Power adapter with dual role ports

    CN111309663A