Serial port switching apparatus and method, device, storage medium, system and vehicle
The serial port switching apparatus addresses the challenge of limited space for multiple processors by using a switching logic unit with multiplexers and hotkey detection to efficiently switch serial ports, enhancing user experience and resource utilization.
Patent Information
- Application Number
- JP2024527784
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2021-11-12
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2041-11-12
AI Technical Summary
The increasing complexity and chip density in computing systems, leading to a high number of processors per chip, necessitates multiple serial ports for debugging and maintenance, which is not feasible due to limited panel space.
A serial port switching apparatus with a switching logic unit comprising multiplexers and a control module, enabling serial port switching between multiple processors using a single external interface through hotkey detection and idle detection to avoid garbled characters and user errors.
Saves board port resources, simplifies operations, and improves user experience by allowing serial port switching and maintenance with a single external interface, reducing logical complexity and avoiding garbled characters.
Smart Images

Figure 2024545588000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to a serial port switching apparatus and method, a device, a storage medium, a system and a vehicle. [Background technology]
[0002] As system complexity and chip integration increase, the number of processors on a single chip increases exponentially. For example, some boards are equipped with more than 10 chips, and each chip has three different types of processors integrated inside. This requires that each chip be equipped with serial ports that match the number of processors for on-site debugging, fault identification, fault recovery, etc. However, due to the limited space on the panel, it is impossible to provide enough space to configure such a large number of serial ports. Therefore, a new serial port switching device is urgently needed to solve problems such as maintenance and debugging in the case of insufficient board ports. Summary of the Invention [Problem to be solved by the invention]
[0003] To solve the above technical problems, the embodiments of the present application provide a serial port switching apparatus and method, a device, a storage medium, a system and a vehicle. [Means for solving the problem]
[0004] A first aspect of the present application provides a serial port switching apparatus applied to a computing device. The computing device has an external interface and includes G processors. The serial port switching apparatus includes one or more switching logic units. The switching logic units are connected between the external interface and the N processors in the computing device. The switching logic units include a first multiplexer, a second multiplexer, a third multiplexer, a hot key detection module, and a control module.
[0005] In the first multiplexer, the control end is connected to the control module, the data output end is connected to the external interface, and the first data input end is connected to the data output end of the third multiplexer.
[0006] In the second multiplexer, the control end is connected to the control module, the data input end is connected to the external interface, and the N data output ends are connected to the input serial ports of the N processors in one-to-one correspondence.
[0007] In the third multiplexer, the control end is connected to the control module, the data output end is connected to one data input end of the first multiplexer, and the N data input ends are connected to the output serial ports of the N processors in one-to-one correspondence.
[0008] The hotkey detection module is configured to perform hotkey detection based on an input character of an external interface, and determine a hotkey type corresponding to the input character.
[0009] The control module is configured to perform switching when the hotkey type is a toggle hotkey, the switching including controlling the first multiplexer and the third multiplexer to enable an output serial port of a next processor among the N processors to be connected to an external interface, and controlling the second multiplexer to enable an input serial port of the next processor to be connected to the external interface.
[0010] G is an integer equal to or greater than 2, and N is an integer equal to or less than G.
[0011] In this way, the switching of serial ports between multiple processors can be implemented by using only one hot key, and operations such as debugging, maintenance and fault recovery of the multi-processor system can be implemented by using only one external interface. This can effectively save the board port resources, improve the convenience of debugging and maintenance of the multi-processor system, and further simplify the board port design. In addition, this solution can further have advantages such as simple operation, easy implementation, low cost and good user experience.
[0012] In a possible implementation of the first aspect, the control module is further configured to change a lock status when the hotkey type is a lock / unlock hotkey. The lock status is a locked state or an unlocked state. In the locked state, the control module does not perform switching. In the unlocked state, when the hotkey type is a toggle hotkey, the control module can perform switching. Thus, locking / unlocking a serial port in a multiprocessor system can be implemented by using only one lock / unlock hotkey. This can effectively save board port resources and improve the convenience of operations such as debugging, maintenance and fault recovery of the multiprocessor system.
[0013] In a possible implementation of the first aspect, the switching logic unit further includes an idle detection module configured to perform idle detection at the data output of the third multiplexer. The control module is specifically configured to perform switching when the hotkey type is a toggle hotkey and the idle detection result of the idle detection module is "idle", or to change the lock status when the hotkey type is a lock / unlock hotkey and the idle detection result of the idle detection module is "idle". In this way, the objective of not performing switching in non-idle mode can be achieved, and garbled characters generated when switching is performed in the case of a busy serial port or abnormal output can be avoided.
[0014] In a possible implementation of the first aspect, the control module is further configured to perform a timeout control, the timeout control including one of the following: before the switching is performed, if the idle detection result of the idle detection module is the idle detection timeout, stopping the execution of the switching; in the process of performing the switching, if the idle detection result of the idle detection module is the idle detection timeout, controlling the first multiplexer, the second multiplexer and the third multiplexer to roll back to a state before the switching; or before the change of the lock status is performed, if the idle detection result of the idle detection module is the idle detection timeout, stopping the change of the lock status.
[0015] In this way, in order to avoid user misjudgment or operation errors caused by excessively long execution times, a timeout mechanism is introduced, thereby improving the operation efficiency of the serial port and the user experience.
[0016] In a possible implementation of the first aspect, the switching logic unit further comprises a prompt module, the prompt module being connected to the second data input of the first multiplexer and configured to output prompt information corresponding to the hot key type to the first multiplexer under the control of the control module, the control module being further configured to control the first multiplexer to select the prompt module, such that the prompt information is transmitted to the external device via the first multiplexer and the external interface.
[0017] In this way, information related to the operation of the serial port can be fed back to the user in real time during the operation process of the serial port, helping the user to clearly and visually know the operation process and operation results of the serial port, and further avoiding misjudgment and erroneous operation.
[0018] In a possible implementation of the first aspect, the control module is specifically configured to: before the prompt information is output, control the first multiplexer to select the prompt module and control the third multiplexer to select the output serial port of the next processor; and after the prompt information is output, control the first multiplexer to select the third multiplexer and control the second multiplexer to select the input serial port of the next processor, thereby connecting both the output serial port and the input serial port of the next processor among the N processors to an external interface.
[0019] In this way, information related to switching can be fed back to the user in a timely manner during the process of performing the switching.
[0020] In a possible implementation of the first aspect, the serial port switching device further includes a level shifter connected between the switching logic unit and the external interface. In this way, level signal conversion between the external interface and the processor serial port can be implemented to meet the level requirements of the standard interface.
[0021] A second aspect of the present application provides a serial port switching method applied to a computing device, where the computing device has an external interface and includes G processors.
[0022] The serial port switching method is implemented by using a serial port switching apparatus. The serial port switching apparatus includes one or more switching logic units. The switching logic units are connected between an external interface and serial ports of N processors in a computing device. The switching logic units include a first multiplexer, a second multiplexer, and a third multiplexer. A data output of the first multiplexer is connected to the external interface, a first data input of the first multiplexer is connected to a data output of the third multiplexer, a data input of the second multiplexer is connected to the external interface, the N data outputs of the second multiplexer are connected to the input serial ports of the N processors in one-to-one correspondence, a data output of the third multiplexer is connected to one data input of the first multiplexer, and the N data inputs of the third multiplexer are connected to the output serial ports of the N processors in one-to-one correspondence.
[0023] Serial port switching methods are: Performing hot key detection based on input characters of an external interface to determine a hot key type corresponding to the input characters; when the hotkey type is a toggle hotkey, performing switching, the switching including controlling the first multiplexer and the third multiplexer to enable an output serial port of a next processor of the N processors to be connected to an external interface, and controlling the second multiplexer to enable an input serial port of the next processor to be connected to an external interface; Includes.
[0024] G is an integer equal to or greater than 2, and N is an integer equal to or less than G.
[0025] In a possible implementation of the second aspect, the serial port switching method further includes changing a lock status when the hotkey type is a lock / unlock hotkey, the lock status being a locked state or an unlocked state, in the locked state the control module does not perform switching, and in the unlocked state the control module can perform switching when the hotkey type is a toggle hotkey.
[0026] In a possible implementation of the second aspect, the serial port switching method further comprises performing idle detection on the data output of the third multiplexer.
[0027] When the hotkey type is a toggle hotkey, performing the switching step includes performing the switching step when the hotkey type is a toggle hotkey and the detection result of the idle detection is "idle", or When the hotkey type is a lock / unlock hotkey, changing the lock status includes changing the lock status when the hotkey type is a lock / unlock hotkey and the detection result of the idle detection module is "idle".
[0028] In a possible implementation of the second aspect, the serial port switching method further includes the step of performing a timeout control, the timeout control being one of the following: Stopping the execution of switching if the idle detection result is an idle detection timeout before the switching is executed; In the process of performing switching, if the idle detection result is an idle detection timeout, controlling the first multiplexer, the second multiplexer and the third multiplexer to roll back to a state before switching; or halting the lock status change if the idle detection result is an idle detection timeout before the lock status change is performed; Contains one of the following:
[0029] In a possible implementation of the second aspect, the serial port switching apparatus further includes a prompt module, the prompt module being connected to a second data input of the first multiplexer, and the serial port switching method further includes controlling the first multiplexer to select the prompt module such that prompt information is transmitted to the external device via the first multiplexer and the external interface.
[0030] In a possible implementation of the second aspect, controlling the first multiplexer and the third multiplexer to enable an output serial port of a next one of the N processors to be connected to an external interface includes: controlling the first multiplexer to select a prompt module and controlling the third multiplexer to select an output serial port of the next processor before the prompt information is output; controlling the first multiplexer to select the third multiplexer after the prompt information is output such that an output serial port of the next one of the N processors is connected to the external interface. Controlling the second multiplexer to enable an input serial port of the next processor to be connected to the external interface includes controlling the second multiplexer to select an input serial port of the next processor after the prompt information is output such that an input serial port of the next processor is connected to the external interface.
[0031] A third aspect of the present application provides an electronic device including a processor and an interface circuit. The processor accesses a memory by using the interface circuit. The memory stores program instructions. When the program instructions are executed by the processor, the processor is enabled to perform the serial port switching method described above.
[0032] A fourth aspect of the present application provides an electronic device including a processor and a memory, the memory storing program instructions that, when executed by the processor, enable the processor to perform the serial port switching method described above.
[0033] In a possible implementation of the fourth aspect, the processor is a CPLD. The ROM is integrated inside the CPLD, which is relatively low cost and has adequate and efficient resources, thus further reducing the cost.
[0034] A fifth aspect of the present application provides a computer-readable storage medium having stored thereon program instructions that, when executed by a computer, enable the computer to perform the serial port switching method described above.
[0035] A sixth aspect of the present application provides a computer program product comprising a computer program which, when executed by a processor, enables the processor to perform the above-mentioned serial port switching method according to the second aspect.
[0036] A seventh aspect of the present application provides a computing device, wherein the computing device includes a plurality of processors. The computing device further includes the serial port switching apparatus described above, any one of the electronic devices described above, or the computer-readable storage medium described above.
[0037] An eighth aspect of the present application provides a chassis system including the above-mentioned serial port switching apparatus, any one of the above-mentioned electronic devices, the above-mentioned computer-readable storage medium, or the above-mentioned computing device.
[0038] A ninth aspect of the present application provides an in-vehicle system including the serial port switching apparatus described above, any one of the electronic devices described above, the computer-readable storage medium described above, or the computing device described above.
[0039] A tenth aspect of the present application provides a vehicle including the above-mentioned serial port switching apparatus, any one of the above-mentioned electronic devices, the above-mentioned computer-readable storage medium, the above-mentioned computing device, or the above-mentioned in-vehicle system.
[0040] In an embodiment of the present application, the serial port switching device includes a second multiplexer and a third multiplexer. The third multiplexer is connected between the output serial ports of the multiple processors and an external interface. The second multiplexer is connected between the input serial ports of the multiple processors and an external interface. In response to the input character corresponding to the toggle hotkey, the third multiplexer is controlled to select the output serial port of the processor, and the second multiplexer is controlled to select the input serial port of the processor, implementing the switching function of the serial ports among the multiple processors by using only one hotkey, thereby effectively reducing the logic complexity of the serial port switching and simplifying the user operation of the serial port switching. Therefore, operations such as debugging, maintenance and fault recovery of the multi-processing system can be implemented by using only one external interface. This can effectively save the board port resources and improve the convenience of the board debugging. In addition, the embodiment of the present application further has the advantages of easy implementation, low cost and improved user experience.
[0041] These and other aspects of the present application will become more clear and readily understood in the description of the embodiment(s) that follows. [Brief description of the drawings]
[0042] The features and the relationships between the features of the present application will be further described below with reference to the attached drawings. The attached drawings are all illustrative, and some features are not drawn to scale. In addition, in some of the attached drawings, common features in the field of the present application that are not essential to the present application may be omitted. Alternatively, additional features that are not essential to the present application are not shown. The combinations of features shown in the attached drawings are not intended to limit the present application. In addition, in this specification, items referred to by the same reference numerals are the same. The attached drawings are as follows:
[0043] [Figure 1]1 is a schematic diagram of the structure and connection of a serial port switching device according to an embodiment of the present application;
[0044] [Diagram 2] 1 is a schematic diagram of the structure of a serial port switching device according to an embodiment of the present application;
[0045] [Diagram 3] 4 is a schematic flowchart of a serial port switching method according to an embodiment of the present application;
[0046] [Figure 4] 4 is a flowchart illustrating a specific implementation of a serial port switching method according to an embodiment of the present application;
[0047] [Diagram 5] 1 is a schematic diagram of a structure of an electronic device according to an embodiment of the present application;
[0048] [Figure 6] 1 is a schematic diagram of the structure of a computing device according to an embodiment of the present application;
[0049] [Figure 7] FIG. 2 is a schematic diagram of the structure of an intelligent drive controller.
[0050] [Figure 8] FIG. 2 is a schematic diagram of the structure of an intelligent drive controller according to an embodiment of the present application.
[0051] [Figure 9] 1 is a schematic diagram of a structure of a chassis system according to an embodiment of the present application. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0052] Key terms and related terms in the embodiments of the present application are explained as follows:
[0053] The console port is sometimes called the maintenance port or maintenance segment. It is the console access port of the device and is used by the user to perform the initial configuration and subsequent management of the device through a terminal or an emulated terminal (such as a serial port service program). The console port is usually an RJ45 interface, a DB9 interface or a DB25 interface, and conforms to the serial data interface standard (RS232) protocol.
[0054] Below we briefly analyze possible implementations of serial port switching.
[0055] Currently, there are two main possible implementations of serial port switching solutions:
[0056] (1) Serial port switching solution based on internal controller: Log in to the controller through the network or serial port, input the switching command, and use the controller to control the toggle switch to implement switching. The disadvantage of this implementation is that the operation is complicated and users cannot visually know the switching result.
[0057] (2) Serial port switching solution based on external serial port: Input the instruction to the Complex Programmable Logic Device (CPLD) as hot key or frame format. The CPLD obtains the serial port data through analysis, and determines whether there is a toggle hot key or switching frame through comparison. Then the corresponding serial port is switched. The disadvantages of this implementation include: 1. When there are a large number of serial ports, the hot key is insufficient. 2. There may be conflicts with the hot key of some serial port tools. 3. It is necessary to repeatedly switch between the switching frame and the normal application scenario, and the logic complexity of the serial port switching is relatively high. 4. The switching result is not fed back. When there are multiple operating systems of the same type, it is not possible to distinguish the processor corresponding to the current serial port.
[0058] In addition, the two serial port switching solutions mentioned above are hard switching solutions, which may cause garbled characters on the serial port.
[0059] In this regard, embodiments of the present application provide a serial port switching apparatus and method, device, storage medium, system and vehicle, such that serial port switching between multiple processors can be implemented by using only one hot key, and operations such as debugging, maintenance and fault recovery of a multi-processor system can be implemented by using only one external interface.
[0060] It should be noted that the external interface described in the embodiments of the present application is an interface used to connect with an external device, and the external interface may be of various applicable types. For example, the external interface may be, but is not limited to, a debug interface or a maintenance interface. For example, the external interface may be a console port as described herein.
[0061] 1 and 2 are schematic diagrams of the structure and connection of a serial port switching device 100 according to an embodiment of the present application. The serial port switching device 100 provided in the embodiment of the present application may be applied to a computing device. The computing device may have one or more external interfaces and include G processors. Each processor has a serial port. The serial port may include an input serial port and an output serial port. G is an integer equal to or greater than 1, and G represents the total number of processors in the computing device.
[0062] 1, the serial port switching device 100 may include one or more switching logic units 110. One switching logic unit 110 is responsible for serial port switching for multiple processors corresponding to the same external interface.
[0063] If a computing device has one external interface, or if only one external interface needs to be connected to multiple processors, only one switching logic unit 110 may be disposed in the serial port switching apparatus 100. The switching logic unit 110 is connected between the external interface and the multiple processors corresponding to the external interface.
[0064] If a computing device has two or more external interfaces, each corresponding to multiple processors, two or more switching logic units 110 may be disposed in the serial port switching apparatus 100. Each switching logic unit 110 is connected between one external interface and the multiple processors corresponding to the external interface.
[0065] Assume that the external interface is a debug interface of N processors in a computing device, and a switching logic unit 110 corresponding to the external interface may be connected between the external interface and the N processors. The switching logic unit 110 is configured to implement serial port switching of the N processors, where N represents a total number of processors corresponding to the switching logic unit 110, N is an integer less than or equal to G, and N is an integer greater than or equal to 2.
[0066] FIG. 1 is used as an example. The computing device may have two external interfaces, external interface 1 and external interface 2. The computing device has G (G=N+K) processors, i.e., CPU0 to CPU N+K The external interface 1 includes the first N processors, i.e., CPU0 to CPU N , and external interface 2 is connected to the last K processors, i.e., CPU N+1 ~CPU N+K where N is an integer equal to or greater than 2, and K is an integer equal to or greater than 2. Correspondingly, the serial port switching device 100 may include two switching logic units 110. One switching logic unit 110 is connected to an external interface 1 and processors CPU0 to CPU N The first N processors CPU0 to CPU N The other switching logic unit 110 is responsible for serial port switching between the external interface 2 and the processor CPU. N+1 ~CPUN+K The last K processors connected between N+1 ~CPU N+K Responsible for serial port switching.
[0067] As shown in FIG. 2, the switching logic unit 110 may include a first multiplexer (MUX) 111, a second multiplexer 112, a third multiplexer 113, a hot key detection module 114 and a control module 115.
[0068] N processors CPU0 to CPU N Using the serial port switching of the above as an example, the relationship of each part in the switching logic unit 110 is as follows:
[0069] The first multiplexer 111 has a control end, two data input ends and a data output end, the control end is connected to the control module 115, the data output end is connected to an external interface, and the first data input end of the two data input ends is connected to the data output end of the third multiplexer 113.
[0070] The second multiplexer 112 has one control end, one data input end and at least N data output ends, the control end being connected to the control module 115, the N data output ends being connected one-to-one to the input serial ports of the N processors, and the data input end being connected to an external interface.
[0071] The third multiplexer 113 has a control end, a data output end and at least N data input ends, the control end being connected to the control module 115, the data output end being connected to the first data input end of the first multiplexer 111, and the N data input ends being connected to the N output serial ports of the processors in a one-to-one relationship.
[0072] The input end of the hotkey detection module 114 is connected to the external interface, and the output end is connected to the control module 115 .
[0073] The control module 115 is connected to the hotkey detection module 114, the control end of the first multiplexer 111, the control end of the second multiplexer 112 and the control end of the third multiplexer 113, respectively.
[0074] In some embodiments, the hotkey detection module 114 may be configured to perform hotkey detection based on input characters of an external interface, and determine a hotkey type corresponding to the input characters. After determining the hotkey type corresponding to the input characters, the hotkey detection module 114 may provide information about the hotkey type to the control module 115, so that the control module 115 performs a corresponding serial port operation based on the hotkey type.
[0075] The hot key type may include, but is not limited to, a toggle hot key and a lock / unlock hot key. Correspondingly, the serial port operation may include, but is not limited to, switching and lock / unlock. In a specific application, another hot key type may be defined based on different application scenarios and actual test requirements. The specific definition of the hot key type is not limited in this embodiment of the present application.
[0076] In some embodiments, the control module 115 may be configured to perform switching when the hotkey type is a toggle hotkey. This switching may include controlling the first multiplexer 111 and the third multiplexer 113 to allow an output serial port of the next processor among the N processors to be connected to an external interface, and controlling the second multiplexer 112 to allow an input serial port of the next processor to be connected to an external interface, thereby implementing serial port switching from the current processor to the next processor among the N processors. Thus, in this embodiment of the present application, multiple processors (e.g., N processors CPU0 to CPUN ) can be implemented using only one toggle hotkey.
[0077] In some embodiments, the control module 115 may be further configured to change a lock status when the hotkey type is a lock / unlock hotkey. The lock status may be a locked state and an unlocked state. In the locked state, the control module 115 does not perform switching, and in the unlocked state, the control module 115 may perform switching when the hotkey type is a toggle hotkey. In this manner, locking / unlocking of the processor's output serial port may be implemented by using only one lock / unlock hotkey.
[0078] Specifically, changing the lock status may include: when the hotkey type is a lock / unlock hotkey, the control module 115 changes the current locked state to an unlocked state, or changes the current unlocked state to a locked state. Specifically, if the control module 115 is currently in a locked state, the control module 115 updates the lock status to an unlocked state in response to an input character corresponding to the lock / unlock hotkey, or if the control module 115 is currently in an unlocked state, the control module 115 updates the lock status to a locked state in response to an input character corresponding to the lock / unlock hotkey.
[0079] In some embodiments, the switching logic unit 110 may further include a prompt module 116. As shown in FIG. 2, one end of the prompt module 116 is connected to the second data input end of the first multiplexer 111, and the other end of the prompt module 116 is connected to the control module 115. In some embodiments, the prompt module 116 may be configured to output prompt information corresponding to a hotkey type to the first multiplexer 111 under the control of the control module 115. And the control module 115 is further configured to control the first multiplexer 111 to select the prompt module 116, so that the prompt information is sent to an external device (e.g., a debugging device) through the first multiplexer 111 and the external interface, so that the external device displays the prompt information to a user, thereby helping the user to clearly and visually grasp information such as the serial port operation process and the operation result.
[0080] The prompt information may be pre-configured information corresponding to the hot key type. In a specific application, the corresponding prompt information may be configured separately for different hot key types.
[0081] For example, the switching prompt information may be pre-configured for a toggle hotkey. When the hotkey type is a toggle hotkey, the control module 15 may control the prompt module 116 to output the switching prompt information, where the switching prompt information may indicate a serial port of a processor to which a current serial port is switched in a current operation, and the switching prompt information may include content such as an identifier of the processor.
[0082] In another example, the lock prompt information may be pre-configured for a lock / unlock hot key. When the hot key type is a lock / unlock hot key, the control module 115 may control the prompt module 116 to output the lock prompt information, where the lock prompt information may indicate the serial ports of the processor that are locked or unlocked in the current operation, and the lock prompt information may include contents such as a processor identifier and a lock / unlock action instruction.
[0083] It should be noted that the format, form, content, etc. of the prompt information is not limited in this embodiment of the present application.
[0084] In some embodiments, the control module 115 may be specifically configured to control the first multiplexer 111 to select the prompt module 116 and control the third multiplexer 113 to select the output serial port of the next processor before the prompt information is output, and control the first multiplexer 111 to select the third multiplexer 113 and control the second multiplexer 112 to select the input serial port of the next processor after the prompt information is output, so that both the output serial port and the input serial port of the next processor of the N processors are connected to the external interface. In this way, by using only one toggle hotkey, switching between the serial ports of multiple processors may be performed, and prompt information is output in the switching process, helping the user to know the relevant information about serial port switching in a timely and accurate manner, thereby effectively avoiding the user's operation errors or misjudgment.
[0085] In some embodiments, the switching logic unit 110 may further include an idle detection module 117. As shown in Figure 2, an input end of the idle detection module 117 is connected to a data output end of the third multiplexer 113, and an output end of the idle detection module 117 is connected to the control module 115.
[0086] In some embodiments, the idle detection module 117 may be configured to perform idle detection on the data output of the third multiplexer 113. In a particular application, the idle detection module 117 may implement the idle detection in various applicable ways. For example, the idle detection module 117 may perform idle detection on the data output of the third multiplexer 113. If two consecutive characters of the data output by the third multiplexer 113 are both at high level, it may be determined that the data output of the third multiplexer 113 is idle, i.e., the output serial port of the processor currently selected by the third multiplexer 113 is idle, and an idle detection result indicating "idle" is output to the control module 115. If there are no two consecutive characters at high level within a predetermined period, it may be determined that the data output of the third multiplexer 113 is busy or has an abnormal output, i.e., the output serial port of the processor currently selected by the third multiplexer 113 is busy or abnormal, and an idle detection result indicating "not idle" is output to the control module 115. In this way, the control module 115 performs an action corresponding to the hot key based on the idle state of the data output terminal of the third multiplexer 113, thereby avoiding garbled characters.
[0087] In some embodiments, the control module 115 may be specifically configured to perform the above switching when the hotkey type is a toggle hotkey and the idle detection result of the idle detection module 117 is “idle”. In this way, after the idle detection result is determined to be “idle”, the current serial port may be switched to the serial port of the target processor to avoid garbled characters.
[0088] In some embodiments, the control module 115 may be specifically configured to change the lock status when the hotkey type is a lock / unlock hotkey and the idle detection result of the idle detection module 117 is “idle”. In this way, after the idle detection result is determined to be “idle”, lock / unlock may be performed to avoid garbled characters.
[0089] In some embodiments, the control module 115 may be further configured to perform a timeout control, which may include one of the following: (1) before switching is performed, if the idle detection result of the idle detection module 117 is an idle detection timeout, stopping the execution of switching; (2) in the process of performing switching, if the idle detection result of the idle detection module 117 is an idle detection timeout, controlling the first multiplexer 111, the second multiplexer 112, and the third multiplexer 113 to roll back to a state before switching; or (3) before performing the change of the lock status, if the detection result of the idle detection module 117 is an idle detection timeout, stopping the change of the lock status.
[0090] Specifically, in the process of performing switching, the control module 115 may be further configured to: control the third multiplexer 113 to select the output serial port of the current processor, and control the second multiplexer 112 to select the input serial port of the current processor when the idle detection result of the idle detection module 117 is an idle detection timeout. In this way, not only can the target processor be rolled back to the current processor when the target processor is busy or the output is abnormal, but also a timeout control of serial port switching may be implemented to avoid the process of performing switching taking a long time.
[0091] Specifically, before performing the switching, the control module 115 may be further configured to determine that the switching has failed and skip performing the switching action when the idle detection result of the idle detection module 117 is an idle detection timeout. In this way, a timeout control of the serial port switching may be implemented to avoid erroneous operation caused by the time-consuming switching process.
[0092] Specifically, before changing the lock status, the control module 115 may be further configured to determine that the lock / unlock has failed and skip performing the action of changing the lock status when the idle detection result of the idle detection module 117 is an idle detection timeout. In this way, a timeout control of the lock / unlock of the serial port may be implemented to avoid erroneous operation caused by the time-consuming lock / unlock process.
[0093] If the operation of the serial port (e.g., switching or locking / unlocking) is performed for too long, the operator may make a wrong decision, resulting in an incorrect operation result (e.g., switching to an inappropriate processor, performing locking / unlocking on an inappropriate processor). For example, if the switching is performed for too long, the operator may think that the switching has failed and continue to input the toggle hotkey, which causes switching to an inappropriate processor serial port. In this regard, the embodiment of the present application introduces the above-mentioned timeout control mechanism to effectively avoid such cases, improve the operation efficiency of the serial port, simplify the user operation, and improve the user experience.
[0094] In some embodiments, the serial port switching device 100 may further include a level shifter. The level shifter is connected between the switching logic unit 110 and the external interface and configured to implement a level signal conversion between the external interface and the processor serial port. For example, as shown in Figures 1 and 2, the level shifter may be, but is not limited to, an RS232 level shifter 120 and may be configured to implement a conversion between a level signal, such as an LVCMOS level signal or an LVTTL level signal, and an RS232 level signal to meet the level requirements of a standard console Universal Asynchronous Receiver / Transmitter (UART) interface.
[0095] The serial port switching device 100 in this embodiment of the present application can be applied to various computing devices. In some embodiments, the serial port switching device 100 can be deployed on a single-board computer with multiple processors to implement serial port switching functions between multiple processors in the single-board computer. This not only saves external interface resources required for board maintenance and debugging, but also has advantages such as easy implementation, simple operation, low cost and good user experience.
[0096] 3 is a schematic flow chart of a serial port switching method according to an embodiment of the present application. The serial port switching method is implemented by using the above-mentioned serial port switching device 100. Subsequently, N processors CPU0 to CPU N 3, the serial port switching method provided in this embodiment of the present application may include the following steps:
[0097] Step S310: Perform hot key detection based on the input characters of the external interface to determine the hot key type corresponding to the input characters.
[0098] Step S320: When the hot key type is a toggle hot key, perform switching, which includes controlling the first multiplexer 111 and the third multiplexer 113 to allow the output serial port of the next processor among the N processors to be connected to an external interface, and controlling the second multiplexer 112 to allow the input serial port of the next processor to be connected to an external interface.
[0099] In some embodiments, step S320 may further include changing a lock status when the hotkey type is a lock / unlock hotkey. The lock status is a locked state or an unlocked state. In the locked state, the control module 115 does not perform switching, and in the unlocked state, the control module 115 can perform switching when the hotkey type is a toggle hotkey.
[0100] In some embodiments, step S320 may further include controlling the first multiplexer to select the prompt module, so that the prompt information is transmitted to the external device via the first multiplexer and the external interface.
[0101] In some embodiments, the switching in step S320 may specifically include: before the prompt information is output, controlling the first multiplexer to select the prompt module and controlling the third multiplexer to select the output serial port of the next processor; after the prompt information is output, controlling the first multiplexer to select the third multiplexer and controlling the second multiplexer to select the input serial port of the next processor. In this way, both the input serial port and the output serial port of the next processor of the N processors can be connected to the external interface.
[0102] In some embodiments, step S320 may further include performing idle detection on the data output of the third multiplexer.
[0103] In one implementation, in step S320, when the hotkey type is a toggle hotkey and the detection result of the idle detection is "idle", switching is performed.
[0104] In one implementation, in step S320, when the hotkey type is a lock / unlock hotkey and the idle detection result of the idle detection module is "idle", the lock status is changed.
[0105] In some implementations, the above-mentioned serial port switching method may further include performing a timeout control, which may include one of: (1) stopping the execution of switching if the idle detection result is the idle detection timeout before switching is performed; (2) in the process of performing switching, controlling the first multiplexer 111, the second multiplexer 112, and the third multiplexer 113 to roll back to a state before switching if the idle detection result is the idle detection timeout; or (3) stopping the change of the lock status if the idle detection result is the idle detection timeout before performing the change of the lock status.
[0106] A specific implementation example of the serial port switching method in the embodiment of the present application will be described below.
[0107] Before serial port switching, the debug serial port of the CPU on the board is separately connected to the switching logic unit of the serial port switching device, and the console port on the board is connected to the switching logic unit of the serial port switching device by using a level shifter.
[0108] As shown in FIG. 4, an example of an implementation procedure for serial port switching of a multi-processor single board computer may include the following steps.
[0109] Step S401: After power-on, the CPU MWhen (0 ≦ M < N) is connected to the panel console by default, the COM port of the debug device is connected to the console port of the single-board computer, and the user inputs characters to the console port by using the serial port service program loaded on the debug device, and the procedure starts.
[0110] The serial port service program may be a visual serial port service program installed on the debug device and may also be called serial interaction software such as Windows' HyperTerminal.
[0111] Step S402: Monitor the input characters of the console port, perform byte-by-byte detection on the input characters to determine whether the hotkey matches, and when the hotkey matches, enable the corresponding hotkey function (i.e., serial port switching or locking / unlocking of the serial port) and proceed to step S430, or when the hotkey does not match, return to step S401.
[0112] For example, ASCII code 0x1c corresponds to the hotkey "Ctrl + ]", where the hotkey "Ctrl + ]" is a pre-agreed hotkey for sequentially switching the serial port, and ASCII code 0x1d corresponds to the hotkey "Ctrl + \", where the hotkey "Ctrl + \" is a pre-agreed lock / unlock hotkey. When the input character of the console port is 0x1c, it matches the toggle hotkey. When the input character of the console port is 0x1d, it matches the lock / unlock hotkey. When the input character of the console port is neither 0x1c nor 0x1d, neither hotkey matches.
[0113] Step S403: Perform idle detection at the data output end of the third multiplexer 113. When the data output end is idle, proceed to step S405, and when the data output end is not idle, proceed to step S404.
[0114] In this step, the idle detection may be performed continuously unless it exceeds a predetermined time.
[0115] Step S404: Execute timeout control, and skip to step S412.
[0116] Specifically, the timeout control may include one of the following:
[0117] (1) Before switching (i.e., before the switching prompt information is output), the currently selected CPU is the CPU M If the idle detection times out, it is determined that switching has failed and no switching action is taken.
[0118] (2) During switching (i.e., after the switching prompt information is output), the currently selected CPU is the CPU X If the idle detection times out, it is assumed that switching has failed and the CPU X CPU M will be rolled back to.
[0119] (3) Before locking / unlocking (i.e., before the lock prompt information is output), the currently selected CPU is the CPU M After the idle detection times out, the lock / unlock is considered to have failed and no lock status change action is performed.
[0120] (4) During lock / unlock (i.e. after the lock prompt information is output), the currently selected CPU is the CPU M After the idle detection times out, the lock / unlock is considered to have failed and no lock status change action is performed.
[0121] The timeout of the idle detection means that the execution time of the idle detection exceeds a predetermined period. In other words, during the predetermined period, the data output terminal of the third multiplexer 113 is continuously in a busy state or an abnormal output state. The state of the data output terminal of the third multiplexer 113 is the state of the output serial port of the CPU currently selected by the third multiplexer 113. Generally, in the serial port switching or locking / unlocking process, once it is determined that the hot key is matched, the idle detection is continuously executed until the switching or locking / unlocking of the serial port is completed. The timeout control and the idle detection may be executed simultaneously until the switching or locking / unlocking of the serial port is completed.
[0122] In a specific application, the predetermined period of idle detection may be configured by setting a detection window, and the specific value of the predetermined period may be freely set according to the requirements of the application scenario. In this embodiment of the present application, the configuration method and the specific value of the predetermined period are not limited.
[0123] Step S405: Determine whether the hotkey type is a toggle hotkey or a lock / unlock hotkey. If the hotkey type is a toggle hotkey, follow the serial port switching procedure in steps S406 to S408. If the hotkey function is lock / unlock, follow the lock / unlock procedure in steps S409 to S411.
[0124] Step S406: Before the switching prompt information is output, the control module 115 controls the first multiplexer MUX111 to switch to the second data input terminal, so that the output port of the prompt module 116 is connected to the console port, and the prompt module 116 outputs the prompt information. In addition, the control module 115 controls the third multiplexer MUX113 to switch to the Xth data input terminal, so that the CPU XThe output serial port of the first multiplexer MUX111 is connected to the first data input terminal of the first multiplexer MUX111, and step S407 is executed. At the same time, step S403 is continuously executed to check whether the data output terminal of the third multiplexer MUX113 is in an idle state, that is, whether the CPU X Detects if the output serial port is idle.
[0125] X=[(M+1)modeN], where "modeN" represents modulo arithmetic. Overflow switching to an empty serial port can be avoided by using modulo arithmetic. X CPU M where M and X are integers equal to or greater than 1, X is an integer equal to or greater than 2, N is an integer equal to or greater than 2, N represents the quantity of processors connected to the switching logic unit 110 executing this procedure, M is an identifier (e.g., serial number) of the current processor, and X is an identifier (e.g., serial number) of the next processor.
[0126] In certain applications, the identifiers of the processors connected to the switching logic unit 110 may be pre-configured. In some implementations, a processor identifier sequence that corresponds one-to-one to the switching logic unit 110 may be pre-configured in the control module 115. The processor identifier sequence may include identifiers of all processors connected to the switching logic unit 110, which are arranged in a predetermined order. When performing switching, the control module 115 may determine the identifier of the next processor (i.e., the target processor to switch to) based on the identifier of the current processor and the processor identifier sequence, thereby performing the switching of the next processor.
[0127] Step S407: The prompt module 116 switches the prompt information “CPU X SWITCH TO CPU XThe switching prompt information is output to the debugging device via the MUX 111 and the console port in this order, and the debugging device displays the switching prompt information, so that the user can visually and clearly know the target processor to which the switching is to be performed.
[0128] Step S408: After outputting the switching prompt information, the CPU X When the output serial port is idle, the control module 115 controls the MUX 111 to switch to the first data input of the MUX 111, thereby X The output serial port of MUX 112 is connected to the console port; the control module 115 controls MUX 112 to switch to the X-th data input of MUX 112, so that the console port is connected to the CPU X The process skips to step S412, and the CPU M From CPU X to finish the serial port switching procedure.
[0129] Step S409: Before outputting the lock prompt information, the control module 115 controls the MUX 111 to switch to the second data input, so that the output port of the prompt module 116 is connected to the console port, and step S410 is executed. At the same time, step S403 is continuously executed to detect whether the data output of the third multiplexer MUX 113 is idle, i.e., the CPU X Determines if the output serial port is idle.
[0130] Step S410: The prompt module 116 receives the lock prompt information “CPU M UNLOCK / LOCK CPU M The lock prompt information is output to the debug device via MUX 111 and the console port in that order, and the debug device displays the lock prompt information.
[0131] Specifically, before outputting the lock prompt information, if the value of the lock status is "1", this indicates that the current lock status is unlocked, and the output content of the lock prompt information is "CPU M LOCK CPU M )" so that the lock status is changed to a locked state, i.e., the CPU M The output of the serial port can prompt the user to lock the serial port; or if the value of the lock status is "0", this indicates that the lock status is currently locked, and the output of the lock prompt information is "CPU M UNLOCK CPU M )" so that the lock status is changed to an unlocked state, i.e., M The user can be prompted to unlock the output serial port.
[0132] Step S411: After outputting the switching prompt information, the CPU M When the output serial port of the control module 115 is idle, the control module 115 controls the MUX 111 to change the lock status and switch to the first data input of the MUX 111, thereby M The output serial port of the M Finishes the lock / unlock procedure for the output serial port.
[0133] Specifically, if the value of the lock status before the change is "0", this indicates that the control module 115 is in a locked state. In this step, the value of the lock status is changed to "1", thereby changing the control module 115 to be in an unlocked state. If the value of the lock status before the change is "1", this indicates that the control module 115 is in an unlocked state. In this step, the value of the lock status is changed to "0", thereby changing the control module 115 to be in a locked state. In this way, the lock / unlock hotkey allows the control module 115 to switch between two lock states, thereby reducing the current processor CPU M Lock and unlock operations for the output serial port are implemented.
[0134] Step S412: End the procedure.
[0135] From the above example of the implementation procedure, it can be seen that the serial port switching method in this embodiment of the present application can achieve the following effects: First, by using only one hotkey, multiple CPUs (such as CPU0 to CPU1) can be switched N ) can be performed sequentially and cyclically, and by using only two hotkeys, NThe serial port switching between and locking / unlocking the serial port can be implemented. This can effectively avoid the conflict of serial port program hotkeys on the debugging device, reduce the logical complexity of the serial port operation, and save the external interface resources of the board. Secondly, prompt information can be output during the serial port operation, which helps the user to easily and visually know the process and result of the serial port operation. Thirdly, no switching is performed in non-idle mode, thus avoiding the garbled characters caused by the switching of the serial port. Fourthly, a timeout control is introduced to avoid the user's erroneous operation caused by the excessively long execution time of the serial port operation, thereby improving the effectiveness of the serial port operation and the user experience. Fifthly, the target processor (e.g. CPU X When the target processor is abnormal, the target processor is switched to the processor before switching (e.g., CPU M ), which can further improve the effectiveness of serial port operation and the user experience.
[0136] 5 is a schematic diagram of a structure of an electronic device 500 according to an embodiment of the present application. The electronic device 500 includes a processor 510 and a memory 520.
[0137] The processor 510 may be connected to a memory 520. The memory 520 may be configured to store program codes and data. Thus, the memory 520 may be a storage unit within the processor 510, or an external storage unit independent of the processor 510, or a component including a storage unit within the processor 510 and an external storage unit independent of the processor 510.
[0138] Optionally, the electronic device 500 may further include a communication interface 530. It should be understood that the communication interface 530 in the electronic device 500 shown in Figure 8 may be used for communication with another device.
[0139] Optionally, the electronic device 500 may further include a bus. The memory 520 and the communication interface 530 may be connected to the processor 510 by using a bus. For ease of representation, only one line is used to represent the bus in FIG. 5, but this does not mean that there is only one bus or only one type of bus.
[0140] It should be understood that in this embodiment of the present application, the processor 510 may be a central processing unit (CPU). The processor may alternatively be another general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a CPLD or another programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc. Alternatively, the processor 510 is configured to use one or more integrated circuits and execute related programs to implement the technical solutions provided in the embodiments of the present application.
[0141] The memory 520 may include read-only memory and random access memory and provides instructions and data to the processor 510. A portion of the processor 510 may further include non-volatile random access memory. For example, the processor 510 may further store information regarding the device type.
[0142] When the electronic device 500 is operated, the processor 510 executes computer-executable instructions in the memory 520 to perform the operational steps of the atmospheric light control method described above.
[0143] It should be understood that the electronic device 500 according to this embodiment of the present application may correspond to a corresponding executing entity of the method according to the embodiment of the present application, and the above-mentioned and other operations and / or functions of the modules in the electronic device 500 are separately intended to implement the corresponding procedures of the method in the embodiment. For the sake of brevity, the details will not be described again in this specification.
[0144] The present application further provides another electronic device including a processor and an interface circuit. The processor accesses a memory by using the interface circuit. The memory stores program instructions. Execution of the program instructions by the processor enables the processor to perform the serial port switching method described above.
[0145] In some embodiments, a programmable read-only memory (ROM) is integrated into a CPLD, which has a lower cost than another programmable device (e.g., an FPGA), and resources are adequate and not wasted. Therefore, in the electronic device provided in this embodiment of the present application, the processor may be a CPLD.
[0146] An embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the program is executed by a processor, the processor is enabled to execute the above-mentioned serial port switching method. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0147] An embodiment of the present application further provides a computer program product including a computer program. When the computer program is executed by a processor, the processor is enabled to execute the above-mentioned serial port switching method. There may be one or more program design languages in the computer program product. The program design languages may include, but are not limited to, object-oriented program design languages, such as Java or C++, and traditional procedural program design languages, such as the "C" language.
[0148] An embodiment of the present application further provides a computing device, which includes a plurality of processors, which further includes the above-mentioned serial port switching apparatus 100, an electronic device, a computer-readable storage medium, or a computer program product.
[0149] 6 is a schematic diagram of a structure of a computing device 600 according to an embodiment of the present application. The computing device 600 includes a plurality of processors 610 and a serial port switching device 100. The computing device 600 includes an external interface, and the serial port switching device 100 is connected between the plurality of processors 610 and the external interface.
[0150] Optionally, computing device 600 may further include a memory 620 and a communication interface 630. It is to be appreciated that computing device 600 may further include other components.
[0151] In practical applications, the computing device 600 may be implemented as a functional unit or module in a single-board computer or chip, or may be implemented as an independent chip or single-board computer. For example, the computing device 600 may be a functional unit / module in a multi-board multiprocessor system, an in-vehicle information device, a cockpit domain controller (CDC), a mobile data center / multi-domain controller (MDC), or a software and hardware integration platform used to support intelligent driving, i.e., a vehicle computing platform (VPC). It should be noted that in this embodiment of the present application, the form and arrangement method of the computing device 600 are not limited.
[0152] Figure 7 shows an example of the structure of the MDC. As shown in Figure 7, the MDC includes one System on Chip (SoC), three video processors, eight artificial intelligence (AI) processors, one microcontroller (MCU), and various sensor interfaces. The sensor interfaces include 16 camera interfaces, 12 GE interfaces, and seven Controller Area Network with Flexible Data-Rate (CAN-FD) interfaces.
[0153] As shown in FIG. 7, eight Serial Gigabit Media Independent Interfaces (SGMII) of the SoC are connected to eight GE interfaces by using eight port physical level (PHY) elements. One SGMII of the SoC is connected to four GE interfaces by using an Ethernet switching device and four SGMII and four port physical level (PHY) elements of the Ethernet switching device. Three PCIe Gen2 X2 interfaces of the SoC are connected to three video processors. Video processor 1 is connected to four camera interfaces by using video deserializer 1. Video processor 2 is connected to four camera interfaces by using video deserializer 2. Video processor 3 is connected to eight camera interfaces by using video deserializer 3 and video deserializer 4. The SoC is connected to eight AI processors by using eight high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express (PCIe) Gen2 X2 interfaces. The eight Reduced Gigabit Media Independent Interface (RGMII) interfaces of the eight AI processors are connected to the MCU by using an Ethernet switching device and one RGMII of the Ethernet switching device. The MCU is connected to seven CAN-FD interfaces. Corresponding serial ports are required for installation, debugging and fault recovery of the processors and microcontrollers in the MDC. However, the MDC only has two external interfaces and cannot provide more serial ports.
[0154] FIG. 8 shows an example of the structure of an MDC including a serial port switching device 100. As shown in FIG. 8, the serial port switching device 100 includes two switching logic units 110 and one RS232 level shifter 120. One switching logic unit 110 is connected to one external interface console X1 of the MDC by using the RS232 level shifter 120, and the switching logic unit 110 is responsible for serial port switching between a microcontroller (MCU), a system on chip (SoC) (including three processors), and three video processors. The other switching logic unit 110 is connected to another external interface console X1 of the MDC by using the RS232 level shifter 120, and the switching logic unit 110 is responsible for serial port switching between eight AI processors. In this way, by using the serial port switching device 100, it is possible to perform serial port switching and serial port locking / unlocking between processors in the MDC by defining only two hot keys. Therefore, operations such as installation, debugging and fault recovery of all processors in the MDC can be implemented through serial port switching by using only two external interfaces.
[0155] An embodiment of the present application further provides an in-vehicle system, which may include the serial port switching apparatus 100, any one of the electronic devices described above, the computer-readable storage medium described above, or the computing device 600 described above.
[0156] In some embodiments, the in-vehicle system may include an in-vehicle remote information processor (telematics box, T-Box), a central gateway, a Body Control Module (BCM), an Integrated Cockpit Controller (ICC), an advanced driving assistance system (ADAS), a Power Distribution Control Unit (PDCU), and an On-Board Diagnostics system.
[0157] The central gateway can be connected to the T-Box by using CAN-FD or Ethernet (ETH). The ICC, ADAS, PDCU and on-board diagnostic system can be separately connected to the central gateway by using CAN-FD or ETH. The BCM can be connected to the central gateway by using CAN-FD.
[0158] In this embodiment of the present application, the ADAS includes a serial port switching device 100. The serial port switching device 100 can implement operations such as installation, debugging, maintenance and fault recovery of multiple processors in the ADAS by using several external interfaces. In some embodiments, the ADAS can be implemented as an MDC as shown in FIG.
[0159] The T-Box may be used to receive global positioning system (GPS) positioning information, and / or provide in-vehicle Wireless Fidelity (Wi-Fi) network access, and / or access mobile data networks by using Long Term Evolution (LTE), a common interface for connecting the vehicle to the outside world.
[0160] A central gateway may be used to provide switching between CAN and automotive Ethernet and is the connectivity center of the n-vehicle network.
[0161] The BCM may be used to control or report the status of turn lights, headlights, brake lights, windshield wipers, vehicle doors and seat belt slots.
[0162] The ICC can be used to receive user commands and display information on a display interface.
[0163] The ADAS can be used to receive sensing data from various sensors, obtain vehicle control operation instructions through complex calculations, and deliver the instructions to the PDCU to complete the autonomous driving operation.
[0164] The PDCU may be responsible for vehicle control operations such as steering, braking, acceleration and deceleration, and status reporting.
[0165] An embodiment of the present application further provides a vehicle, which may include the serial port switching apparatus 100, any one of the electronic devices described above, the computing device 600, the computer-readable storage medium described above, the computer program product described above, or the in-vehicle system described above.
[0166] The "vehicle" in this embodiment of the present application may be, but is not limited to, a private car, a commercial vehicle, a bus, a passenger car, a high-speed train, a subway, an unmanned vehicle, a logistics transport vehicle, an unmanned aerial vehicle, etc. The power type of the "vehicle" may be fuel-powered, pure electric, hydrogen fuel cell powered, hybrid powered, etc. In addition, the "vehicle" in this specification may be a human-operated vehicle, an autonomous vehicle, an unmanned vehicle, or another type of vehicle. Those skilled in the art may understand that any similar transportation tool may be considered as a "vehicle" in this embodiment of the present application.
[0167] An embodiment of the present application further provides a chassis system, which may include the serial port switching apparatus 100, any one of the electronic devices described above, the computer-readable storage medium described above, or the computing device 600 described above.
[0168] 9 is an example of a block diagram of a chassis system 900 according to an embodiment of the present application. As shown in FIG. 9, the chassis system 900 may include H control boards 910, J service boards 920, and a backboard 930. The H control boards 910 and the J service boards 920 are interconnected using the backboard 930.
[0169] In some embodiments, to implement the serial port switching function of the chassis system 900, a serial port switching device 100 may be disposed in each control board 910, and the serial port switching device 100 may be configured to connect the panel console port of the control board 910 to the P CPUs (i.e., CPU0 to CPU P In this way, the control board 910 is connected between the serial ports of P CPUs (i.e., CPU0 to CPU P In addition, the control board 910 is interconnected with the service boards 920, so that serial port switching between the Q CPUs (i.e., CPU0 to CPU Q ) may also be implemented by using the serial port switching device 100 inside the control board 910. Both P and Q may be integers equal to or greater than 1.
[0170] Specifically, the user operates a toggle hotkey on the debugging device, and the debugging device inputs a character corresponding to the toggle hotkey to a panel console port. In response to the character corresponding to the toggle hotkey, the serial port switching device 100 in the control board 910 switches the P CPUs (i.e., CPU0 to CPU P) and the Q CPUs (i.e., CPU0 to CPU Q ) to perform serial port switching.
[0171] Specifically, a user operates a lock / unlock hotkey on the debugging device, and the debugging device inputs a character corresponding to the lock / unlock hotkey into a panel console port. In response to the character corresponding to the lock / unlock hotkey, the serial port switching device 100 in the control board 910 may lock or unlock the serial port of the current CPU, where the current CPU is one of the P CPUs (i.e., CPU0 to CPU P ) and the Q CPUs (i.e., CPU0 to CPU Q ) is one of them.
[0172] In some embodiments, the service board 920 can be further locked or unlocked by using a lock / unlock hot key. For example, a user operates the lock / unlock hot key on the debug device, and the debug device inputs a character corresponding to the lock / unlock hot key to the panel console port. In response to the character corresponding to the lock / unlock hot key, the serial port switching apparatus 100 in the control board 910 can unlock or lock the current service board 920.
[0173] In some embodiments, switching between service boards 920 can be further implemented by switching a toggle hotkey. The specific switching process is similar to the serial port switching described above, so it will not be repeated here.
[0174] From the above, it can be seen that by using the serial port switching device 100 in the control board 910, operations such as debugging, testing, maintenance and fault recovery of each control board 910 can be implemented in the manufacturing process of the chassis system 900, and operations such as debugging, testing, maintenance and fault recovery of the control board 910 and the service board 920 can also be implemented in the finished product of the chassis system 900. Therefore, by using only one console port (i.e., the panel console port), operations such as debugging, testing, maintenance and fault recovery can be performed for the entire chassis system 900, and the panel of the service board 920 does not need to provide a serial port for debugging, which not only saves the port resources of the panel and improves the convenience of maintenance, but also simplifies the board structure.
[0175] In some embodiments, the serial port switching device 100 may be disposed in a service board 920 in the chassis system 900. The serial port switching device 100 is connected to an in-panel console port on the service board 920 and Q CPUs (i.e., CPU0 to CPU Q ) in the service board 920. Therefore, by using the serial port switching device 100, the serial ports of the Q CPUs (i.e., CPU0 to CPU Q ) may be implemented. In this manner, operations such as debugging, testing, maintenance, and fault recovery of the service board 920 may be implemented in scenarios such as the manufacturing process or disassembly and maintenance process of the chassis system 900.
[0176] The chassis system 900 provided in this embodiment of the present application may be implemented as a switch, a router, an access network, or another similar device, and the specific form, arrangement, etc. of the chassis system 900 are not limited in this embodiment of the present application.
[0177] It should be noted that the above is merely an exemplary embodiment of the present application and the technical principles used. Those skilled in the art can understand that the present application is not limited to the specific embodiments described herein, and those skilled in the art may make various obvious changes, rearrangements and substitutions without departing from the scope of protection of the present application. Thus, although the present application has been described in detail with reference to the above-mentioned embodiments, the present application is not limited to the above-mentioned embodiments. Many other equivalent embodiments may be included without departing from the concept of the present application, all within the scope of protection of the present application.
Claims
1. A serial port switching apparatus for use in a computing device, the computing device including an external interface and G processors, the serial port switching apparatus including one or more switching logic units, the switching logic units being connected between the external interface and N processors in the computing device, the switching logic units including a first multiplexer, a second multiplexer, a third multiplexer, a hot key detection module and a control module; The first multiplexer has a control end connected to the control module, a data output end connected to the external interface, and a first data input end connected to the data output end of the third multiplexer; The second multiplexer has a control end connected to the control module, a data input end connected to the external interface, and N data output ends connected to the input serial ports of the N processors in one-to-one correspondence; The third multiplexer has a control end connected to the control module, a data output end connected to one data input end of the first multiplexer, and N data input ends connected to the output serial ports of the N processors in one-to-one correspondence; The hotkey detection module is configured to perform hotkey detection based on an input character of the external interface to determine a hotkey type corresponding to the input character; the control module is configured to perform switching when the hot key type is a toggle hot key, the switching including controlling the first multiplexer and the third multiplexer to enable an output serial port of a next processor of the N processors to be connected to the external interface, and controlling the second multiplexer to enable an input serial port of the next processor to be connected to the external interface; An apparatus, wherein G is an integer equal to or greater than 2, and N is an integer equal to or less than G.
2. The control module is further configured to change a lock status when the hotkey type is a lock / unlock hotkey, the lock status being a locked state or an unlocked state, in the locked state, the control module does not perform the switching, and in the unlocked state, when the hotkey type is the toggle hotkey, the control module can perform the switching.
2. The apparatus of claim 1.
3. the switching logic unit further comprises an idle detection module configured to perform idle detection at the data output of the third multiplexer; The control module is specifically configured to perform the switching when the hotkey type is the toggle hotkey and an idle detection result of the idle detection module is "idle", or to change the lock status when the hotkey type is the lock / unlock hotkey and an idle detection result of the idle detection module is "idle".
3. Apparatus according to claim 1 or 2.
4. The control module is further configured to perform a timeout control, the timeout control being one of the following: before the switching is performed, if an idle detection result of the idle detection module is an idle detection timeout, stopping the switching; In the process of performing the switching, when the idle detection result of the idle detection module is an idle detection timeout, controlling the first multiplexer, the second multiplexer and the third multiplexer to roll back to a state before the switching; or stopping the change of the lock status if an idle detection result of the idle detection module is an idle detection timeout before the change of the lock status is performed; The apparatus of claim 3 , further comprising one of:
5. The switching logic unit further comprises a prompt module, the prompt module is connected to a second data input of the first multiplexer, and is configured to output prompt information corresponding to the hot key type to the first multiplexer under the control of the control module; the control module is further configured to control the first multiplexer to select the prompt module, whereby the prompt information is transmitted to an external device via the first multiplexer and the external interface.
5. Apparatus according to any one of claims 1 to 4.
6. Specifically, the control module: before the prompt information is output, controlling the first multiplexer to select the prompt module and controlling the third multiplexer to select the output serial port of the next processor; after the prompt information is output, controlling the first multiplexer to select the third multiplexer, and controlling the second multiplexer to select the input serial port of the next processor, so that both the output serial port and the input serial port of the next processor of the N processors are connected to the external interface; 6. The apparatus of claim 5.
7. the serial port switching device further comprising a level shifter connected between the switching logic unit and the external interface; 7. Apparatus according to any one of claims 1 to 6.
8. 1. A method for serial port switching applied to a computing device, the computing device comprising an external interface and comprising G processors, The method is implemented using a serial port switching apparatus, the serial port switching apparatus including one or more switching logic units, the switching logic units being connected between the external interface and serial ports of N processors in the computing device, the switching logic units comprising a first multiplexer, a second multiplexer and a third multiplexer, a data output of the first multiplexer being connected to the external interface, a first data input of the first multiplexer being connected to a data output of the third multiplexer, a data input of the second multiplexer being connected to the external interface, the N data outputs of the second multiplexer being connected to input serial ports of the N processors in one-to-one correspondence, a data output of the third multiplexer being connected to one data input of the first multiplexer, and the N data inputs of the third multiplexer being connected to output serial ports of the N processors in one-to-one correspondence, The serial port switching method includes: performing hot key detection based on input characters of the external interface to determine a hot key type corresponding to the input characters; performing switching when the hot key type is a toggle hot key, the switching including controlling the first multiplexer and the third multiplexer to enable an output serial port of a next processor of the N processors to be connected to the external interface, and controlling the second multiplexer to enable an input serial port of the next processor to be connected to the external interface; wherein G is an integer greater than or equal to 2 and N is an integer less than or equal to G.
9. The method comprises: and changing a lock status when the hot key type is a lock / unlock hot key. The lock status is a locked state or an unlocked state, in the locked state, the control module does not perform the switching, and in the unlocked state, when the hotkey type is the toggle hotkey, the control module can perform the switching; The method according to claim 8.
10. The method further includes performing idle detection on the data output of the third multiplexer; When the hotkey type is a toggle hotkey, performing the switching step includes performing the switching step when the hotkey type is the toggle hotkey and a detection result of the idle detection is "idle", or When the hotkey type is a lock / unlock hotkey, changing the lock status includes changing the lock status when the hotkey type is the lock / unlock hotkey and the detection result of the idle detection module is “idle”.
10. The method according to claim 8 or 9.
11. The method further includes the step of performing a timeout control; The timeout control is one of the following: If an idle detection result is an idle detection timeout before the switching is performed, stopping the switching; In the process of performing the switching, if an idle detection result is an idle detection timeout, controlling the first multiplexer, the second multiplexer and the third multiplexer to roll back to a state before the switching; or stopping the change of the lock status if an idle detection result is an idle detection timeout before the change of the lock status is performed; The method of claim 10, comprising one of:
12. The serial port switching device further includes a prompt module, the prompt module being connected to the second data input terminal of the first multiplexer; The method further includes controlling the first multiplexer to select the prompt module such that prompt information is transmitted to an external device via the first multiplexer and the external interface.
12. The method according to any one of claims 9 to 11.
13. controlling the first multiplexer and the third multiplexer to enable an output serial port of a next processor of the N processors to be connected to the external interface comprises: before the prompt information is output, controlling the first multiplexer to select the prompt module and controlling the third multiplexer to select the output serial port of the next processor; after the prompt information is output, controlling the first multiplexer to select the third multiplexer so that the output serial port of the next processor of the N processors is connected to the external interface; controlling the second multiplexer to enable an input serial port of the next processor to be connected to the external interface includes: controlling the second multiplexer to select the input serial port of the next processor so that the input serial port of the next processor is connected to the external interface after the prompt information is output; The method of claim 12.
14. 14. An electronic device comprising a processor and an interface circuit, the processor accessing a memory by using the interface circuit, the memory storing program instructions which, when executed by the processor, enable the processor to perform a method according to any one of claims 8 to 13.
15. 14. An electronic device comprising a processor and a memory, the memory storing program instructions which, when executed by the processor, enable the processor to perform the method according to any one of claims 8 to 13.
16. the processor is a complex programmable logic device (CPLD); 16. The electronic device of claim 15.
17. 14. A computer readable storage medium storing program instructions which, when executed by a computer, enable the computer to carry out the method according to any one of claims 8 to 13.
18. A computing device comprising a plurality of processors, the computing device further comprising a serial port switching apparatus according to any one of claims 1 to 7, an electronic device according to any one of claims 14 to 16, or a computer-readable storage medium according to claim 17.
19. A chassis system comprising the serial port switching apparatus of any one of claims 1 to 7, the electronic device of any one of claims 14 to 16, the computer readable storage medium of claim 17, or the computing device of claim 18.
20. An in-vehicle system comprising a serial port switching apparatus according to any one of claims 1 to 7, an electronic device according to any one of claims 14 to 16, a computer readable storage medium according to claim 17, or a computing device according to claim 18.
21. A vehicle comprising a serial port switching apparatus according to any one of claims 1 to 7, an electronic device according to any one of claims 14 to 16, a computer readable storage medium according to claim 17, a computing device according to claim 18, or an in-vehicle system according to claim 20.
Citation Information
Patent Citations
microprocessor
JP1992155481A
Wating-time shortening and route deciding methods for network message route assigning device
JP1997116570A
Logical address bus architecture for multiprocessor system
JP1997179838A
Device and method for transmitting control information in data communication via serial interface
JP2018195306A
