Serial port switching device and method, device, storage medium, system and vehicle
The serial port switching device addresses the challenge of limited board space by using a single hot key to switch serial ports between multiple processors, enhancing maintenance efficiency and resource conservation.
Patent Information
- Application Number
- JP2024527784
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-11-12
- Publication Date
- 2025-06-12
- Estimated Expiration
- 2041-11-12
AI Technical Summary
The increasing complexity of systems and integration density of chips require multiple serial ports for debugging and maintenance, but limited board space makes it impossible to provide sufficient physical serial ports.
A serial port switching device with switching logic units connected between external interfaces and multiple processors, utilizing multiplexers, hot key detection, and control modules to switch serial ports using a single hot key, thereby saving board resources and simplifying maintenance.
Enables efficient switching of serial ports between multiple processors using a single hot key, improving debugging and maintenance convenience while conserving board resources and reducing operational complexity.
Smart Images

Figure 0007692118000001 
Figure 0007692118000002 
Figure 0007692118000003
Abstract
Description
Technical Field
[0001] The present invention relates to a serial port switching device and method, a device, a storage medium, a system, and a vehicle.
Background Art
[0002] As the complexity of systems and the integration density of chips increase, the number of processors on a single chip increases rapidly. For example, some boards are equipped with more than 10 chips, and three different types of processors are integrated inside each chip. This requires each chip to have a serial port that matches the number of processors for on-site debugging, fault identification, fault recovery, etc. However, since the space on the panel is limited, it is impossible to provide sufficient space for configuring such a large number of serial ports. Therefore, there is an urgent need for a new serial port switching device to solve problems such as maintenance and debugging in the case of insufficient board ports.
Summary of the Invention
Problems to be Solved by the Invention
[0003] In order to solve the above technical problems, embodiments of the present application provide a serial port switching device and method, a device, a storage medium, a system, and a vehicle.
Means for Solving the Problems
[0004] A first aspect of the present application provides a serial port switching device applied to a computing device. The computing device includes an external interface and G processors. The serial port switching device includes one or more switching logic units. The switching logic unit is connected between the external interface and N processors in the computing device. The switching logic unit includes 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 terminal is connected to the control module, the data output terminal is connected to the external interface, and the first data input terminal is connected to the data output terminal of the third multiplexer.
[0006] In the second multiplexer, the control terminal is connected to the control module, the data input terminal is connected to the external interface, and the N data output terminals are connected to the input serial ports of the N processors in a one-to-one correspondence.
[0007] In the third multiplexer, the control terminal is connected to the control module, the data output terminal is connected to one data input terminal of the first multiplexer, and the N data input terminals are connected to the output serial ports of the N processors in a one-to-one correspondence.
[0008] The hot key detection module is configured to perform hot key detection based on the input characters of the external interface to determine the hot key type corresponding to the input characters.
[0009] When the hot key type is a toggle hot key, the control module is configured to perform switching, and the switching includes controlling the first multiplexer and the third multiplexer so that the output serial port of the next processor among the N processors can be connected to the external interface, and controlling the second multiplexer so that the input serial port of the next processor can be connected to the external interface.
[0010] G is an integer greater than or equal to 2, and N is an integer less than or equal to G.
[0011] In this way, the switching of the 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 multiprocessor system can be implemented by using only one external interface. This can effectively save board port resources, improve the convenience of debugging and maintenance of the multiprocessor system, and further simplify the board port design. In addition, this solution may further have advantages such as simple operation, easy implementation, low cost, and good user experience.
[0012] In a possible implementation of the first aspect, when the hot key type is a lock / unlock hot key, the control module is further configured to change the lock status. 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 hot key type is a toggle hot key, the control module can perform switching. Therefore, the lock / unlock of the serial port in the multiprocessor system can be implemented by using only one lock / unlock hot key. 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 end of the third multiplexer. The control module is specifically configured to perform switching when the hot key type is a toggle hot key and the idle detection result of the idle detection module is "idle", or when the hot key type is a lock / unlock hot key and the idle detection result of the idle detection module is "idle", specifically configured to change the lock status. In this way, the purpose of not performing switching in the non-idle mode can be achieved, and the character garbling 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 timeout control. The timeout control includes one of the following: that is, before switching is performed, if the idle detection result of the idle detection module is an idle detection timeout, stop the execution of switching; during the process of performing switching, if the idle detection result of the idle detection module is an idle detection timeout, control the first multiplexer, the second multiplexer, and the third multiplexer to roll back to the state before switching; or before the change of the lock status is performed, if the idle detection result of the idle detection module is an idle detection timeout, stop the change of the lock status.
[0015] In this way, in order to avoid user judgment errors and misoperations caused by an overly long execution time, by introducing a timeout mechanism, the operation efficiency of the serial port and the user experience can be improved.
[0016] In a possible implementation of the first aspect, the switching logic unit further comprises a prompt module, which is connected to the second data input end of the first multiplexer and is configured to output prompt information corresponding to the hotkey type to the first multiplexer under the control of the control module. The control module controls the first multiplexer to select the prompt module, and is further configured such that the prompt information is transmitted to an 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, which helps the user clearly and visually understand the operation process and result of the serial port, and further avoids judgment errors and misoperations.
[0018] In a possible implementation of the first aspect, specifically, before the prompt information is output, the control module controls the first multiplexer to select the prompt module, controls the third multiplexer to select the output serial port of the next processor, after the prompt information is output, controls the first multiplexer to select the third multiplexer, and controls 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 among the N processors are connected to the 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 executing 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] The second aspect of the present application provides a serial port switching method applied to a computing device, where the computing device includes an external interface and G processors.
[0022] The serial port switching method is implemented by using a serial port switching device. The serial port switching device includes one or more switching logic units. The switching logic unit is connected between the external interface and the serial ports of N processors in the computing device. The switching logic unit includes a first multiplexer, a second multiplexer, and a third multiplexer. The data output terminal of the first multiplexer is connected to the external interface, the first data input terminal of the first multiplexer is connected to the data output terminal of the third multiplexer, the data input terminal of the second multiplexer is connected to the external interface, the N data output terminals of the second multiplexer are connected to the input serial ports of the N processors in a one-to-one correspondence, the data output terminal of the third multiplexer is connected to one data input terminal of the first multiplexer, and the N data input terminals of the third multiplexer are connected to the output serial ports of the N processors in a one-to-one correspondence.
[0023] The serial port switching method includes executing hot key detection based on the input characters of the external interface to determine the hot key type corresponding to the input characters, and When the hot key type is a toggle hot key, a step of performing switching, the switching including: controlling a first multiplexer and a third multiplexer so that an output serial port of a next processor among N processors can be connected to an external interface; and controlling a second multiplexer so that an input serial port of the next processor can be connected to the external interface, including.
[0024] G is an integer greater than or equal to 2, and N is an integer less than or equal to G.
[0025] In a possible implementation of a second aspect, the serial port switching method further includes a step of 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 switching, and in the unlocked state, when the hot key type is a toggle hot key, the control module can perform switching.
[0026] In a possible implementation of a second aspect, the serial port switching method further includes a step of performing idle detection at a data output end of a third multiplexer.
[0027] When the hot key type is a toggle hot key, the step of performing switching includes a step of performing switching when the hot key type is a toggle hot key and the detection result of the idle detection is "idle", or When the hot key type is a lock / unlock hot key, the step of changing the lock status includes a step of changing the lock status when the hot key type is a lock / unlock hot key 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 a step of performing timeout control, and the timeout control is one of the following: that is, before switching is executed, if the idle detection result is an idle detection timeout, stop the execution of switching; in the process of executing switching, if the idle detection result is an idle detection timeout, control the first multiplexer, the second multiplexer, and the third multiplexer to roll back to the state before switching, or before the change of the lock status is executed, if the idle detection result is an idle detection timeout, stop the change of the lock status. It includes one of the above.
[0029] In a possible implementation of the second aspect, the serial port switching device further includes a prompt module. The prompt module is connected to the second data input end of the first multiplexer. The serial port switching method further includes a step of controlling the first multiplexer to select the prompt module so that prompt information is transmitted to an external device through the first multiplexer and an external interface.
[0030] In a possible implementation of the second aspect, controlling the first multiplexer and the third multiplexer such that the output serial port of the next processor among the N processors can be connected to the external interface includes: 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; and after the prompt information is output, controlling the first multiplexer to select the third multiplexer such that the output serial port of the next processor among the N processors is connected to the external interface. Controlling the second multiplexer such that the input serial port of the next processor can be connected to the external interface includes, after the prompt information is output, controlling the second multiplexer to select the input serial port of the next processor such that the 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 the memory by using the interface circuit. The memory stores program instructions. When the program instructions are executed by the processor, the processor can execute 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 stores program instructions. When the program instructions are executed by the processor, the processor can execute the serial port switching method described above.
[0033] In a possible implementation of the fourth aspect, the processor is a CPLD. A ROM is integrated inside the CPLD, the CPLD has a relatively low cost, and the resources are appropriate and there is no waste. Therefore, the cost can be further reduced.
[0034] The fifth aspect of the present application provides a computer-readable storage medium. The computer-readable storage medium stores program instructions. When the program instructions are executed by a computer, the computer can execute the serial port switching method described above.
[0035] The sixth aspect of the present application provides a computer program product including a computer program. When the computer program is executed by a processor, the processor can execute the serial port switching method described above according to the second aspect.
[0036] The seventh aspect of the present application provides a computing device, where the computing device includes a plurality of processors. The computing device further includes any one of the serial port switching devices described above, any one of the electronic devices described above, or the computer-readable storage medium described above.
[0037] The eighth aspect of the present application provides a chassis system including any one of the serial port switching devices described above, any one of the electronic devices described above, the computer-readable storage medium described above, or the computing device described above.
[0038] The ninth aspect of the present application provides an in-vehicle system including any one of the serial port switching devices described above, any one of the electronic devices described above, the computer-readable storage medium described above, or the computing device described above.
[0039] The tenth aspect of the present application provides a vehicle including any one of the serial port switching devices described above, any one of the electronic devices described above, the computer-readable storage medium described above, the computing device described above, or the in-vehicle system described above.
[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 a plurality of processors and an external interface. The second multiplexer is connected between the input serial ports of the plurality of processors and the external interface. In response to the input character corresponding to the toggle hot key, 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 serial port switching function between a plurality of processors by using only one hot key, thereby effectively reducing the logical complexity of serial port switching and simplifying the user operation of serial port switching. Therefore, operations such as debugging, maintenance, and fault recovery of the multiprocessing system can be implemented by using only one external interface. This can effectively save board port resources and improve the convenience of board debugging. In addition, the embodiments of the present application further have the advantages of easy implementation, low cost, and improved user experience.
[0041] These and other aspects of the present application will be more clearly and easily understood in the following description of the (multiple) embodiments.
Brief Description of the Drawings
[0042] Hereinafter, with reference to the accompanying drawings, the features of the present application and the relationships between the features will be further described. All of the accompanying drawings are illustrative, and some features are not shown at actual scales. In addition, in some of the accompanying drawings, common features that are not essential to the present application in the field of 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 accompanying drawings are not intended to limit the present application. In addition, in this specification, those referred to by the same reference numerals are the same. The accompanying drawings are as follows.
[0043]
Figure 1
[0044]
Figure 2
[0045]
Figure 3
[0046]
Figure 4
[0047]
Figure 5
[0048]
Figure 6
[0049]
Figure 7
[0050]
Figure 8
[0051]
Figure 9
Embodiments for Carrying Out the Invention
[0052] Important terms and related terms in the embodiments of the present application are explained as follows.
[0053] The console port is sometimes referred to as a maintenance port or maintenance segment. This 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 via a terminal or an emulation terminal (such as a serial port service program). The console port is usually an RJ45 interface, a DB9 interface or a DB25 interface and complies with the serial data interface standard (RS232) protocol.
[0054] The following briefly analyzes possible implementations of serial port switching.
[0055] Currently, there are mainly two possible implementations for serial port switching solutions:
[0056] (1) Serial port switching solution based on an internal controller: Log in to the controller via a network or a serial port, enter a switching command, use the controller to control the toggle switch, and implement the switching. The drawback of this implementation is that the operation is complex and the user cannot visually know the switching result.
[0057] (2) Serial port switching solution based on an external serial port: As a hot key or frame format, commands are input into a Complex Programmable Logic Device (CPLD). The CPLD acquires serial port data through analysis and determines whether a toggle hot key or a switching frame exists through comparison. Then, the corresponding serial port is switched. The drawbacks of this implementation include the following: 1. When there are a large number of serial ports, hot keys are insufficient. 2. There may be conflicts with the hot keys of some serial port tools. 3. It is necessary to repeatedly switch between the switching frame and the normal application scenario, and the logical complexity of serial port switching is relatively high. 4. The switching result is not feedback. When there are multiple operating systems of the same type, the processors corresponding to the current serial port cannot be distinguished.
[0058] In addition, the two serial port switching solutions described above are hard switching solutions, which may cause garbled characters in the serial port.
[0059] From this perspective, embodiments of the present application provide a serial port switching device and method, a device, a storage medium, a system, and a 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] The external interface described in the embodiments of this application is an interface used to connect to an external device, and it should be noted that the external interface can 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 the console port described in this specification.
[0061] FIG. 1 and FIG. 2 are schematic diagrams of the structure and connections of the serial port switching device 100 according to the embodiments of this application. The serial port switching device 100 provided in the embodiments of this application may be applied to a computing device. The computing device may include one or more external interfaces and may include G processors. Each processor is provided with a serial port. The serial port may include an input serial port and an output serial port. G is an integer greater than or equal to 2, and G represents the total number of processors in the computing device.
[0062] As shown in FIG. 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 of a plurality of processors corresponding to the same external interface.
[0063] When the computing device has one external interface, or when only one external interface needs to be connected to a plurality of processors, only one switching logic unit 110 can be arranged in the serial port switching device 100. The switching logic unit 110 is connected between the external interface and a plurality of processors corresponding to the external interface.
[0064] If a computing device has two or more external interfaces, and each of the two or more external interfaces corresponds to a plurality of processors, two or more switching logic units 110 can be arranged in the serial port switching device 100. Each switching logic unit 110 is connected between one external interface and a plurality of processors corresponding to the external interface.
[0065] Assume that the external interface is a debug interface of N processors in the computing device, and a switching logic unit 110 corresponding to the external interface can be connected between the external interface and the N processors. The switching logic unit 110 is configured to implement serial port switching of N processors, where N represents the 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 include two external interfaces, external interface 1 and external interface 2. The computing device includes G (G = N + K) processors, namely CPU 0 ~CPU N+K External interface 1 corresponds to the first N processors, namely CPU 0 ~CPU N External interface 2 corresponds to the last K processors, namely CPU N+1 ~CPU N+K where N is an integer greater than or equal to 2 and K is an integer greater than or equal to 2. Correspondingly, the serial port switching device 100 may include two switching logic units 110. One switching logic unit 110 is connected between external interface 1 and processors CPU 0 ~CPU N and the first N processors CPU 0 ~CPU NIs responsible for serial port switching of. The other switching logic unit 110 is connected between the external interface 2 and the processor CPU N+1 ~CPU N+K And is responsible for serial port switching of the last K processor CPUs N+1 ~CPU N+K Is responsible for serial port switching of.
[0067] As shown in Figure 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] The serial port switching of N processor CPUs 0 ~CPU N Is used as an example. The relationship between each part in the switching logic unit 110 is as follows:
[0069] The first multiplexer 111 has one control end, two data input ends, and one data output end. The control end is connected to the control module 115, the data output end is connected to the 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 is connected to the control module 115, the N data output ends are connected one-to-one to the input serial ports of N processors, and the data input end is connected to the external interface.
[0071] The third multiplexer 113 has one control end, one data output end, and at least N data input ends. The control end is connected to the control module 115, the data output end is connected to the first data input end of the first multiplexer 111, and the N data input ends are connected one-to-one to the output serial ports of N processors.
[0072] The input end of the hot key 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 separately connected to the hot key 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.
[0074] In some embodiments, the hot key detection module 114 may be configured to perform hot key detection based on the input characters of the external interface and determine the hot key type corresponding to the input characters. After determining the hot key type corresponding to the input characters, the hot key detection module 114 may provide information regarding the hot key type to the control module 115, and as a result, the control module 115 performs the corresponding serial port operation based on the hot key 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 hot key type is a toggle hot key. This switching may include controlling the first multiplexer 111 and the third multiplexer 113 to enable the output serial port of the next processor among the N processors to be connected to the external interface, and controlling the second multiplexer 112 to enable the input serial port of the next processor to be connected to the external interface, and may implement serial port switching from the current processor to the next processor among the N processors. Therefore, in this embodiment of the present application, sequential rolling switching of the serial ports among multiple processors (for example, N processor CPUs 0 ~CPU N ) can be implemented by using only one toggle hot key.
[0077] In some embodiments, the control module 115 may be further configured to change the lock status when the hot key type is a lock / unlock hot key. 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 can perform switching when the hot key type is a toggle hot key. Thus, locking / unlocking of the output serial port of the processor can be implemented by using only one lock / unlock hot key.
[0078] Specifically, changing the lock status may include the following: When the hot key type is a lock / unlock hot key, the control module 115 changes the current lock state to an unlock state or changes the current unlock state to a lock state. Specifically, when the control module 115 is currently in the lock state, the control module 115 updates the lock status to the unlock state in response to the input character corresponding to the lock / unlock hot key, or when the control module 115 is currently in the unlock state, the control module 115 updates the lock status to the lock state in response to the input character corresponding to the lock / unlock hot key.
[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 the hot key type to the first multiplexer 111 under the control of the control module 115. Further, the control module 115 is further configured to control the first multiplexer 111 to select the prompt module 116, whereby the prompt information is transmitted to an external device (such as a debug device) via the first multiplexer 111 and the external interface, so that the external device displays the prompt information to the user, thereby helping the user to clearly and visually understand information such as the serial port operation process and operation results.
[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 preconfigured for the toggle hotkey. When the hotkey type is the toggle hotkey, the control module 15 may control the prompt module 116 to output the switching prompt information. Here, the switching prompt information may indicate the serial port of the processor whose current serial port is switched in the current operation, and the switching prompt information may include contents such as the identifier of the processor.
[0082] In another example, the lock prompt information may be preconfigured for the lock / unlock hotkey. When the hotkey type is the lock / unlock hotkey, the control module 115 may control the prompt module 116 to output the lock prompt information. Here, the lock prompt information may indicate the serial port of the processor that is locked or unlocked in the current operation, and the lock prompt information may include contents such as the identifier of the processor and the lock / unlock action instruction.
[0083] It should be noted that the format, form, content, etc. of the prompt information are not limited in this embodiment of the present application.
[0084] In some embodiments, the control module 115 is specifically configured to control the first multiplexer 111 to select the prompt module 116 before the prompt information is output, control the third multiplexer 113 to select the output serial port of the next processor, after the prompt information is output, 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, whereby both the output serial port and the input serial port of the next processor among the N processors are connected to the external interface. In this way, by using only one toggle hot key, switching may be performed between the serial ports of multiple processors, the prompt information is output in the switching process, helping the user to timely and accurately know the relevant information regarding the serial port switching, thereby effectively avoiding the user's operation errors or misjudgments.
[0085] In some embodiments, the switching logic unit 110 may further include an idle detection module 117. As shown in FIG. 2, the input end of the idle detection module 117 is connected to the data output end of the third multiplexer 113, and the 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 at the data output terminal of the third multiplexer 113. In certain applications, the idle detection module 117 may implement idle detection in various applicable ways. For example, the idle detection module 117 may perform idle detection at the data output terminal of the third multiplexer 113. If two consecutive characters of the data output by the third multiplexer 113 are both at a high level, it may be determined that the data output terminal of the third multiplexer 113 is idle, that is, 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 high-level characters within a predetermined period, it is considered that the idle detection has timed out, and it may be determined that the data output terminal of the third multiplexer 113 is in a busy state or there is an abnormal output, that is, 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 executes an action corresponding to the hot key based on the idle state of the data output terminal of the third multiplexer 113, thereby avoiding character garbling.
[0087] In some embodiments, specifically, when the hot key type is a toggle hot key and the idle detection result of the idle detection module 117 is "idle", the control module 115 may be configured to perform the above switching. In this way, after it is determined that the idle detection result is "idle", the current serial port can be switched to the serial port of the target processor to avoid character garbling.
[0088] In some embodiments, the control module 115 may be specifically configured to change the lock status when the hot key type is the lock / unlock hot key and the idle detection result of the idle detection module 117 is "idle". In this way, after it is determined that the idle detection result is "idle", the lock / unlock can be executed to avoid character garbling.
[0089] In some embodiments, the control module 115 may be further configured to perform timeout control. The timeout control may include one of the following: (1) stopping the execution of switching when the idle detection result of the idle detection module 117 is an idle detection timeout before the switching is executed; (2) controlling the first multiplexer 111, the second multiplexer 112, and the third multiplexer 113 to roll back to the state before switching when the idle detection result of the idle detection module 117 is an idle detection timeout during the process of executing the switching; or (3) stopping the change of the lock status when the detection result of the idle detection module 117 is an idle detection timeout before the change of the lock status is executed.
[0090] Specifically, during the process of executing the 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 the timeout control of the serial port switching can be implemented to avoid taking a long time in the process of executing the switching.
[0091] Specifically, before executing switching, the control module 115 can be further configured to skip executing the switching action when the idle detection result of the idle detection module 117 is an idle detection timeout, determining that the switching has failed. In this way, timeout control for serial port switching can be implemented to avoid incorrect operations caused by a time-consuming switching process.
[0092] Specifically, before changing the lock status, the control module 115 can be further configured to skip executing the action of changing the lock status when the idle detection result of the idle detection module 117 is an idle detection timeout, determining that the lock / unlock has failed. In this way, timeout control for serial port lock / unlock can be implemented to avoid incorrect operations caused by a time-consuming lock / unlock process.
[0093] If the operation of the serial port (such as switching or lock / unlock) is executed for an excessively long time, the operator may make an incorrect judgment, and as a result, incorrect operation results (such as switching to an inappropriate processor, executing lock / unlock on an inappropriate processor) may be caused. For example, if the switching is executed for an excessively long time, the operator may think that the switching has failed and may continue to enter the toggle hot key, which may cause switching to an inappropriate processor serial port. In this regard, in this embodiment of the present application, the above-described timeout control mechanism is introduced to effectively avoid such cases, improve the operation efficiency of the serial port, simplify user operations, 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 is configured to implement level signal conversion between the external interface and the processor serial port. For example, as shown in FIGS. 1 and 2, the level shifter may be, but is not limited to, the RS232 level shifter 120, and is configured to implement 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 the universal asynchronous receiver / transmitter (UART) interface of the standard console.
[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 is deployed on a single-board computer having a plurality of processors, and can implement a serial port switching function between the plurality of 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] FIG. 3 is a schematic flowchart 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-described serial port switching device 100. Subsequently, the serial port switching of N processors CPU 0 ~CPU N is used as an example. As shown in FIG. 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. The switching includes controlling the first multiplexer 111 and the third multiplexer 113 so that the output serial port of the next processor among the N processors is connected to the external interface, and controlling the second multiplexer 112 so that the input serial port of the next processor is connected to the external interface.
[0099] In some embodiments, step S320 may further include changing the lock status when the hot key type is a lock / unlock hot key. The lock status is either 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 hot key type is a toggle hot key.
[0100] In some embodiments, step S320 may further include controlling the first multiplexer to select the prompt module, whereby 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 specifically may 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 among the N processors can be connected to the external interface.
[0102] In some embodiments, step S320 may further include the step of performing idle detection at the data output end of the third multiplexer.
[0103] In one implementation, in step S320, when the hot key type is a toggle hot key and the detection result of the idle detection is "idle", the switching is performed.
[0104] In one implementation, in step S320, when the hot key type is a lock / unlock hot key and the idle detection result of the idle detection module is "idle", the lock status is changed.
[0105] In some implementations, the serial port switching method described above may further include performing timeout control. The timeout control may include one of the following: (1) before switching is performed, if the idle detection result is an idle detection timeout, stopping the execution of the switching; (2) in the process of performing the switching, if the idle detection result is an idle detection timeout, controlling the first multiplexer 111, the second multiplexer 112, and the third multiplexer 113 to roll back to the state before the switching; or (3) before performing the change of the lock status, if the idle detection result is an idle detection timeout, stopping the change of the lock status.
[0106] Hereinafter, a specific implementation example of the serial port switching method in the embodiments of the present application will be described.
[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 the implementation procedure of serial port switching of a multi-processor single-board computer may include the following steps.
[0109] Step S401: After power-on, the CPU M (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 starts the procedure by inputting characters to the console port by using the serial port service program loaded on the debug device.
[0110] The serial port service program may be a visual serial port service program installed on a 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. 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. 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. 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. When the data output end is not idle, proceed to step S404.
[0114] In this step, the idle detection may be continuously performed when not exceeding a predetermined time.
[0115] Step S404: Perform 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 CPU M . If the idle detection times out, it is determined that the switching has failed, and the switching action is not executed.
[0118] (2) During switching (i.e., after the switching prompt information is output), the currently selected CPU is CPU X . If the idle detection times out, it is determined that the switching has failed, and CPU X is rolled back to CPU M .
[0119] (3) Before lock / unlock (i.e., before the lock prompt information is output), the currently selected CPU is CPU M . After the idle detection times out, it is determined that the lock / unlock has failed, and the lock status change action is not executed.
[0120] (4) During lock / unlock (i.e., after the lock prompt information is output), the currently selected CPU is CPU M . After the idle detection times out, it is determined that the lock / unlock has failed, and the lock status change action is not executed.
[0121] The timeout of idle detection means that the execution time of idle detection exceeds a predetermined period. In other words, within the predetermined period, the data output terminal of the third multiplexer 113 continuously becomes busy or in 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 lock / unlock process, when it is determined that the hot key matches, idle detection is continuously executed until the serial port switching or lock / unlock is completed. The timeout control and idle detection may be executed simultaneously until the serial port switching or lock / unlock 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 specific value of the predetermined period are not limited.
[0123] Step S405: Determine whether the hot key type is a toggle hot key or a lock / unlock hot key. If the hot key type is a toggle hot key, follow the serial port switching procedure in steps S406 to S408. If the function of the hot key 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, whereby the output port of the prompt module 116 is connected to the console port, and the prompt module 116 outputs prompt information. In addition, the control module 115 controls the third multiplexer MUX113 to switch to the Xth data input terminal, whereby the CPU XThe output serial port of X 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 detect whether the data output terminal of the third multiplexer MUX113 is in an idle state, that is, whether the output serial port of the CPU
[0125] X = [(M + 1) mode N], where "mode N" represents a modulo operation. Overflow switching to an empty serial port can be avoided by using a modulo operation. The CPU X is the next processor of the CPU M where M and X are integers greater than or equal to 1, X is an integer greater than or equal to 2, N is an integer greater than or equal to 2, N represents the number of processors connected to the switching logic unit 110 that executes this procedure, M is the identifier (e.g., serial number) of the current processor, and X is the identifier (e.g., serial number) of the next processor.
[0126] In a specific application, the identifiers of the processors connected to the switching logic unit 110 can be preconfigured. In some implementations, a one-to-one corresponding processor identifier sequence for the switching logic unit 110 can be preconfigured in the control module 115. The processor identifier sequence may include the identifiers of all processors connected to the switching logic unit 110, and these identifiers are arranged in a predetermined order. When performing switching, the control module 115 determines the identifier of the next processor (i.e., the target processor to be switched to) based on the identifier of the current processor and the processor identifier sequence, thereby enabling the switching to the next processor.
[0127] Step S407: The prompt module 116 sends switching prompt information "Switch to CPU X " (SWITCH TO CPU X)」 is output. The switching prompt information is output to the debug device through the MUX111 and the console port in sequence, and the debug device displays the switching prompt information, whereby the user visually and clearly knows the target processor to be switched to.
[0128] Step S408: After outputting the switching prompt information, if the output serial port of the CPU X is idle, the control module 115 controls the MUX111 to switch to the first data input end of the MUX111, whereby the output serial port of the CPU X is connected to the console port; the control module 115 controls the MUX112 to switch to the Xth data input end of the MUX112, whereby the console port is connected to the input serial port of the CPU X , skips to step S412, and ends the serial port switching procedure from the CPU M to the CPU X .
[0129] Step S409: Before outputting the lock prompt information, the control module 115 controls the MUX111 to switch to the second data input end, whereby 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 end of the third multiplexer MUX113 is idle, that is, to determine whether the output serial port of the CPU X is idle.
[0130] Step S410: The prompt module 116 outputs the lock prompt information "CPU M UNLOCK / LOCK CPU M )". The lock prompt information is output to the debug device through the MUX111 and the console port in sequence, 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 the unlocked state, and the output content of the lock prompt information is "CPU M is locked (LOCK CPU M )", and the user can be prompted so that the lock status is changed to the locked state, that is, the output serial port of the CPU M is locked; alternatively, if the value of the lock status is "0", this indicates that the current lock status is the locked state, and the output content of the lock prompt information is "CPU M is unlocked (UNLOCK CPU M )", and the user can be prompted so that the lock status is changed to the unlocked state, that is, the output serial port of the CPU M is unlocked.
[0132] Step S411: After outputting the switching prompt information, if the output serial port of the CPU M is idle, the control module 115 changes the lock status and controls the MUX111 to switch to the first data input end of the MUX111, whereby the output serial port of the CPU M is connected to the console port, and proceeds to step S412 to end the lock / unlock procedure of the output serial port of the CPU M .
[0133] Specifically, when the value of the lock status before the change is "0", this indicates that the control module 115 is in the locked state. In this step, the value of the lock status is changed to "1", whereby the control module 115 is changed to the unlocked state. When the value of the lock status before the change is "1", this indicates that the control module 115 is in the unlocked state. In this step, the value of the lock status is changed to "0", whereby the control module 115 is changed to the locked state. In this way, the lock / unlock hotkey enables the control module 115 to switch between two lock states, whereby the current processor CPU M The lock operation and the unlock operation 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, sequential and cyclic switching between multiple CPUs (for example, CPU 0 ~CPU N ) can be executed, and by using only two hotkeys, CPU 0 ~CPU NSerial port switching and serial port locking / unlocking can be implemented among them. This can effectively avoid the conflict of serial port program hotkeys on the debug device, reduce the logical complexity of serial port operations, and save the external interface resources of the board. Second, prompt information can be output during serial port operations, which helps the user easily and visually know the process and results of serial port operations. Third, switching is not executed in the non-idle mode, thereby avoiding garbled characters caused by serial port switching. Fourth, timeout control is introduced to avoid the user's misoperation caused by the overly long execution time of serial port operations, thereby improving the effectiveness of serial port operations and the user experience. Fifth, when the target processor (e.g., CPU X ) is abnormal, the target processor can be rolled back to the processor before switching (e.g., CPU M ), and the effectiveness of serial port operations and the user experience can be further improved.
[0136] FIG. 5 is a schematic diagram of the 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 the memory 520. The memory 520 may be configured to store program codes and data. Therefore, the memory 520 may be an internal storage unit within the processor 510, or an external storage unit independent of the processor 510, or a component including an internal 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 within the electronic device 500 shown in FIG. 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 the bus. For the sake of convenience of representation, in FIG. 5, only one line is used to represent the bus, 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). Alternatively, the processor may 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, an individual gate or transistor logic device, an individual hardware component, etc. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor or the like. Alternatively, the processor 510 uses one or more integrated circuits and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present application.
[0141] The memory 520 may include a read-only memory and a random access memory, and provides instructions and data to the processor 510. A part of the processor 510 may further include a non-volatile random access memory. For example, the processor 510 may further store information about the device type.
[0142] When the electronic device 500 operates, the processor 510 executes computer-executable instructions in the memory 520 to execute the operation steps of the above-described atmospheric light control method.
[0143] The electronic device 500 according to this embodiment of the present application may correspond to the corresponding executor of the method according to the embodiment of the present application. It should be understood that the foregoing 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 herein.
[0144] The present application further provides another electronic device including a processor and an interface circuit. The processor accesses the memory by using the interface circuit. The memory stores program instructions. When the program instructions are executed by the processor, the processor can execute the serial port switching method described above.
[0145] In some embodiments, a programmable read-only memory (ROM) is integrated in the CPLD. The CPLD has a lower cost than another programmable device (such as an FPGA), and the resources are appropriate and not wasted. Therefore, in the electronic device provided in this embodiment of the present application, the processor may be a CPLD.
[0146] Embodiments of the present application further provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the program is executed by a processor, the processor can execute the serial port switching method described above. 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 electrical connections having one or more wires, portable computer disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories, optical fibers, portable compact disk read-only memories, optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0147] Embodiments of the present application further provide a computer program product including a computer program. When the computer program is executed by a processor, the processor is enabled to execute the serial port switching method described above. There may be one or more program design languages in the computer program product. The program design language may include, but is not limited to, object-oriented program design languages such as Java or C++, and conventional procedural program design languages such as the "C" language.
[0148] Embodiments of the present application further provide a computing device. The computing device includes a plurality of processors. The computing device further includes the serial port switching device 100, an electronic device, a computer-readable storage medium, or a computer program product described above.
[0149] FIG. 6 is a schematic diagram of the 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 has an external interface, and the serial port switching device 100 is connected between the plurality of processors 610 and the external interface.
[0150] Optionally, the computing device 600 may further include a memory 620 and a communication interface 630. It should be understood that the computing device 600 may further include other components.
[0151] In actual applications, the computing device 600 may be implemented as a single-board computer or a functional unit or module within a chip, or may be implemented as an independent chip or a single-board computer. For example, the computing device 600 may be a functional unit / module within a composite 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, that is, 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] FIG. 7 shows an example of the structure of the MDC. As shown in FIG. 7, the MDC includes one System on Chip (SoC), three video processors, eight artificial intelligence (AI) processors, one Microcontroller Unit (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 with flexible data rates.
[0153] As shown in FIG. 7, the eight Serial Gigabit Media Independent Interfaces (SGMIIs) of the SoC are connected to eight Gigabit Ethernet (GE) interfaces by using eight port physical layer (PHY) elements. One SGMII of the SoC is connected to four GE interfaces by using an Ethernet switching device and four SGMIIs and four port physical layer (PHY) elements of the Ethernet switching device. The three Peripheral Component Interconnect Express (PCIe) Gen2 X2 interfaces of the SoC are connected to three video processors. Video Processor 1 is connected to four camera interfaces by using a video deserializerr 1. Video Processor 2 is connected to four camera interfaces by using a video deserializerr 2. Video Processor 3 is connected to eight camera interfaces by using a video deserializerr 3 and a video deserializerr 4. The SoC is connected to eight AI processors by using eight 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 Controller Area Network with Flexible Data-Rate (CAN-FD) interfaces. Installing, debugging, and recovering from failures of the processors and microcontrollers in the MDC require corresponding serial ports. However, the MDC has only two external interfaces and cannot provide more serial ports.
[0154] FIG. 8 shows an example of the structure of the MDC including the 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. The switching logic unit 110 is responsible for serial port switching between a microcontroller unit (MCU), a system on chip (SoC) (including three processors), and three video processors. The other switching logic unit 110 is connected to the other external interface console X1 of the MDC by using the RS232 level shifter 120. 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, by defining only two hotkeys, serial port switching and serial port locking / unlocking can be performed between the processors in the MDC. Therefore, operations such as installation, debugging, and fault recovery of all the processors in the MDC can be implemented through serial port switching by using only two external interfaces.
[0155] Embodiments of the present application further provide an in-vehicle system. The in-vehicle system may include the serial port switching device 100, any one of the above-described electronic devices, the above-described computer-readable storage medium, or the above-described computing device 600.
[0156] In some embodiments, the in-vehicle system may include an in-vehicle telematics processor (telematics box, T-Box), a central gateway, a body control module (Body Control Module, BCM), an integrated cockpit controller (Integrated Cockpit Controller, ICC), an advanced driving assistance system (advanced driving assistance system, ADAS), a power distribution control unit (Power Distribution Control Unit, PDCU), and an on-board diagnostic system (On-Board Diagnostic).
[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 a plurality of processors in the ADAS by using several external interfaces. In some embodiments, the ADAS can be implemented as the MDC shown in FIG. 8.
[0159] The T-Box may be used to receive positioning information of the global positioning system (GPS), and / or provide in-vehicle wireless fidelity (Wi-Fi) network access, and / or access the mobile data network by using Long Term Evolution (LTE), and is a common interface for connecting the vehicle to the outside.
[0160] The central gateway may be used to provide switching between CAN and in-vehicle Ethernet, In-vehicle which is the connection center of the network.
[0161] The BCM can be used to control or report the status of turn lights, head lights, brake lights, wipers, vehicle doors, and seat belt slots.
[0162] The ICC can be used to receive user instructions and display information on the display interface.
[0163] ADAS can be used to receive sensing data from various sensors, obtain vehicle control operation instructions through complex calculations, and distribute the instructions to the PDCU to complete the autonomous driving operation.
[0164] The PDCU can be responsible for vehicle control operations such as steering, braking, accelerating, and decelerating, as well as reporting the status.
[0165] Embodiments of this application further provide a vehicle. The vehicle may include a serial port switching device 100, any one of the above-mentioned electronic devices, a computing device 600, the above-mentioned computer-readable storage medium, the above-mentioned computer program product, or the above-mentioned in-vehicle system.
[0166] The "vehicle" in this embodiment of this application may be, but is not limited to, a private car, a commercial vehicle, a bus, a passenger car, a high-speed railway, a subway, a driverless vehicle, a logistics transport vehicle, a drone, etc. The type of power of the "vehicle" may be fuel-driven, pure electric, hydrogen fuel cell-driven, hybrid power, etc. In addition, the "vehicle" in this specification may be a vehicle driven by a person, an autonomous driving vehicle, a driverless vehicle, or another type of vehicle. Those skilled in the art can understand that any similar transportation tool may be regarded as the "vehicle" in this embodiment of this application.
[0167] One embodiment of the present application further provides a chassis system. The chassis system may include a serial port switching device 100, any one of the above-described electronic devices, the above-described computer-readable storage medium, or the above-described computing device 600.
[0168] FIG. 9 is an example of a configuration 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 back board 930. The H control boards 910 and the J service boards 920 are interconnected by using the back board 930.
[0169] In some embodiments, in order to implement the serial port switching function of the chassis system 900, the serial port switching device 100 may be disposed within each control board 910. The serial port switching device 100 is connected between the panel console port of the control board 910 and the serial ports of P CPUs (i.e., CPU 0 ~CPU P ) within the control board 910. In this way, serial port switching between the P CPUs (i.e., CPU 0 ~CPU P ) within the control board 910 can be implemented. In addition, since the control board 910 is interconnected with the service board 920, serial port switching between Q CPUs (i.e., CPU 0 ~CPU Q ) within each service board 920 can also be implemented by using the serial port switching device 100 within the control board 910. Both P and Q can be integers greater than or equal to 1.
[0170] Specifically, the user operates a toggle hot key on the debug device, and the debug device inputs the character corresponding to the toggle hot key into the panel console port. In response to the character corresponding to the toggle hot key, the serial port switching device 100 in the control board 910 switches the serial ports among the P CPUs (i.e., CPU 0 ~CPU P ) of the control board 910 and the Q CPUs (i.e., CPU 0 ~CPU Q ) of the currently locked service board 920.
[0171] Specifically, when the user operates the lock / unlock hot key on the debug device, the debug device inputs the character corresponding to the lock / unlock hot key into the panel console port. In response to the character corresponding to the lock / unlock hot key, 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., CPU 0 ~CPU P ) of the control board 910 and the Q CPUs (i.e., CPU 0 ~CPU Q ) of the currently locked service board 920.
[0172] In some embodiments, by using the lock / unlock hot key, the service board 920 can be further locked or unlocked. For example, when the user operates the lock / unlock hot key on the debug device, the debug device inputs the character corresponding to the lock / unlock hot key into the panel console port. In response to the character corresponding to the lock / unlock hot key, the serial port switching device 100 in the control board 910 can unlock or lock the current service board 920.
[0173] In some embodiments, by switching the toggle hotkey, switching between service boards 920 can be further implemented. Since the specific switching process is the same as the serial port switching described above, it will not be repeated here.
[0174] From the above, 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. Also, in the finished product of the chassis system 900, operations such as debugging, testing, maintenance, and fault recovery of the control board 910 and the service board 920 can also be implemented. 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 on the entire chassis system 900. 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, improves the convenience of maintenance, but also simplifies the board structure.
[0175] In some embodiments, the serial port switching device 100 may be disposed within the service board 920 in the chassis system 900. The serial port switching device 100 is connected between the in-panel console port on the service board 920 and the serial ports of Q CPUs (i.e., CPU 0 ~CPU Q ) within the service board 920. Therefore, by using the serial port switching device 100, serial port switching between the Q CPUs (i.e., CPU 0 ~CPU Q ) within the service board 920 can be implemented. In this way, operations such as debugging, testing, maintenance, and fault recovery of the service board 920 can be implemented in scenarios such as the manufacturing process or the 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. The specific form, arrangement method, etc. of the chassis system 900 are not limited in this embodiment of the present application.
[0177] It should be noted that the above are merely exemplary embodiments 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 can make various obvious changes, readjustments, and substitutions without departing from the protection scope of the present application. Therefore, although the present application has been described in detail with reference to the above embodiments, the present application is not limited to the above embodiments. Without departing from the concept of the present application, more other equivalent embodiments may be included, and all are within the protection scope of the present application.
Claims
1. A serial port switching device applied to a computing device, wherein the computing device comprises an external interface and G processors, and the serial port switching device comprises one or more switching logic units, and the one or more switching logic units are connected between the external interface and N processors in the computing device, and the switching logic unit comprises a first multiplexer, a second multiplexer, a third multiplexer, a hot key detection module and a control module, In the first multiplexer, a control end is connected to the control module, a data output end is connected to the external interface, and a first data input end is connected to a data output end of the third multiplexer, In the second multiplexer, a control end is connected to the control module, a data input end is connected to the external interface, and N data output ends are connected to input serial ports of the N processors in a one-to-one correspondence, In the third multiplexer, a control end is connected to the control module, a data output end is connected to the first data input end of the first multiplexer, and N data input ends are connected to output serial ports of the N processors in a one-to-one correspondence, The hot key detection module is configured to perform hot key detection based on input characters of the external interface to determine a hot key type corresponding to the input characters, The control module is configured to perform switching when the hot key type is a toggle hot key, and the switching includes controlling the first multiplexer and the third multiplexer so that an output serial port of the next processor among the N processors can be connected to the external interface, and controlling the second multiplexer so that an input serial port of the next processor can be connected to the external interface, A device, where G is an integer greater than or equal to 2, and N is an integer less than or equal to G.
2. When the hot key type is the lock / unlock hot key, the control module is further configured to change the lock status, where the lock status is either a locked state or an unlocked state. In the locked state, the control module does not perform the switching. In the unlocked state, when the hot key type is the toggle hot key, the control module can perform the switching. The apparatus according to claim 1.
3. The switching logic unit further includes an idle detection module configured to perform idle detection at the data output end of the third multiplexer. The control module is specifically configured to perform the switching when the hot key type is the toggle hot key and the idle detection result of the idle detection module is "idle", or is specifically configured to change the lock status when the hot key type is the lock / unlock hot key and the detection result of the idle detection is "idle". The apparatus according to claim 2.
4. The control module is further configured to perform timeout control, and the timeout control is one of the following: namely, Before the switching is performed, if the idle detection result of the idle detection module is an idle detection timeout, stop the execution of the switching. In the process of performing the switching, if the idle detection result of the idle detection module is an idle detection timeout, control the first multiplexer, the second multiplexer, and the third multiplexer to roll back to the previous state of the switching, or Before the change of the lock status is performed, if the idle detection result of the idle detection module is an idle detection timeout, stop the change of the lock status. The apparatus according to claim 3, including one of the above.
5. The switching logic unit further includes a prompt module, which is connected to the second data input end of the first multiplexer and is configured to output prompt information corresponding to the hotkey type to the first multiplexer under the control of the control module. The control module controls the first multiplexer to select the prompt module, so that the prompt information is further configured to be transmitted to an external device through the first multiplexer and the external interface. The device according to any one of claims 1 to 4.
6. Specifically, the control module Before the prompt information is output, the control module controls the first multiplexer to select the prompt module and controls the third multiplexer to select the output serial port of the next processor. After the prompt information is output, the control module controls the first multiplexer to select the third multiplexer and controls 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 among the N processors are configured to be connected to the external interface. The device according to claim 5.
7. The serial port switching device further includes a level shifter connected between the one or more switching logic units and the external interface. The device according to any one of claims 1 to 6.
8. A serial port switching method applied to a computing device, the computing device includes an external interface and G processors. The method is implemented by using a serial port switching device, the serial port switching device includes one or more switching logic units, the one or more switching logic units are connected between the external interface and the serial ports of N processors in the computing device, the switching logic unit includes a first multiplexer, a second multiplexer and a third multiplexer, a data output end of the first multiplexer is connected to the external interface, a first data input end of the first multiplexer is connected to a data output end of the third multiplexer, a data input end of the second multiplexer is connected to the external interface, N data output ends of the second multiplexer are connected to the input serial ports of the N processors in a one-to-one correspondence, a data output end of the third multiplexer is connected to the first data input end of the first multiplexer, and N data input ends of the third multiplexer are connected to the output serial ports of the N processors in a one-to-one correspondence. The serial port switching method is as follows. Performing hot key detection based on the input characters of the external interface to determine the hot key type corresponding to the input characters. When the hot key type is a toggle hot key, performing a switching step, where the switching includes controlling the first multiplexer and the third multiplexer so that the output serial port of the next processor among the N processors can be connected to the external interface, and controlling the second multiplexer so that the input serial port of the next processor can be connected to the external interface. Including, where G is an integer greater than or equal to 2 and N is an integer less than or equal to G.
9. The method is as follows. When the hot key type is a lock / unlock hot key, further including the step of changing the lock status. The lock status is either a locked state or an unlocked state. In the locked state, the control module does not execute the switching. In the unlocked state, when the hot key type is the toggle hot key, the control module can execute the switching. The method according to claim 8.
10. The method further includes the step of performing idle detection at the data output end of the third multiplexer. When the hot key type is the toggle hot key, the step of performing switching includes the step of performing the switching when the hot key type is the toggle hot key and the detection result of the idle detection is "idle", or When the hot key type is the lock / unlock hot key, the step of changing the lock status includes the step of changing the lock status when the hot key type is the lock / unlock hot key and the detection result of the idle detection is "idle". The method according to claim 9.
11. The method further includes the step of performing timeout control. The timeout control is one of the following: namely, Before the switching is executed, if the idle detection result is an idle detection timeout, stopping the execution of the switching. In the process of executing the 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 the previous state of the switching, or Before the change of the lock status is executed, if the idle detection result is an idle detection timeout, stopping the change of the lock status. The method according to claim 10, including one of the above.
12. The serial port switching device further includes a prompt module, and the prompt module is connected to the second data input end of the first multiplexer. The method further includes the step of controlling the first multiplexer to select the prompt module so that prompt information is transmitted to an external device via the first multiplexer and the external interface. The method according to any one of claims 9 to 11.
13. Controlling the first multiplexer and the third multiplexer so that the output serial port of the next processor among the N processors can be connected to the external interface includes: 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 among the N processors is connected to the external interface. Controlling the second multiplexer so that the input serial port of the next processor can be connected to the external interface includes: after the prompt information is output, 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. The method according to claim 12.
14. An electronic device comprising a processor and an interface circuit, wherein the processor accesses a memory by using the interface circuit, the memory stores program instructions, and when the program instructions are executed by the processor, the processor can execute the method according to any one of claims 8 to 13.
15. An electronic device comprising a processor and a memory, wherein the memory stores program instructions, and when the program instructions are executed by the processor, the processor can execute the method according to any one of claims 8 to 13.
16. The processor is a complex programmable logic device CPLD. The electronic device according to claim 15.
17. A computer-readable storage medium that stores program instructions, and when the program instructions are executed by a computer, the computer is capable of executing 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 the serial port switching device according to any one of claims 1 to 7, the electronic device according to any one of claims 14 to 16, or the computer-readable storage medium according to claim 17.
19. A chassis system comprising the serial port switching device according to any one of claims 1 to 7, the electronic device according to any one of claims 14 to 16, the computer-readable storage medium according to claim 17, or the computing device according to claim 18.
20. An in-vehicle system comprising the serial port switching device according to any one of claims 1 to 7, the electronic device according to any one of claims 14 to 16, the computer-readable storage medium according to claim 17, or the computing device according to claim 18.
21. A vehicle comprising the serial port switching device according to any one of claims 1 to 7, the electronic device according to any one of claims 14 to 16, the computer-readable storage medium according to claim 17, the computing device according to claim 18, or the 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