WO2023082184A1 - 串口切换装置、方法、设备、存储介质、系统和车辆 - Google Patents

串口切换装置、方法、设备、存储介质、系统和车辆 Download PDF

Info

Publication number
WO2023082184A1
WO2023082184A1 PCT/CN2021/130358 CN2021130358W WO2023082184A1 WO 2023082184 A1 WO2023082184 A1 WO 2023082184A1 CN 2021130358 W CN2021130358 W CN 2021130358W WO 2023082184 A1 WO2023082184 A1 WO 2023082184A1
Authority
WO
WIPO (PCT)
Prior art keywords
switching
data selector
serial port
hotkey
data
Prior art date
Application number
PCT/CN2021/130358
Other languages
English (en)
French (fr)
Inventor
梅优良
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2021/130358 priority Critical patent/WO2023082184A1/zh
Priority to CN202180008562.9A priority patent/CN116710907A/zh
Publication of WO2023082184A1 publication Critical patent/WO2023082184A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure

Definitions

  • the present application relates to a serial port switching device, method, equipment, storage medium, system and vehicle.
  • the embodiments of the present application provide a serial port switching device, method, equipment, storage medium, system and vehicle.
  • the first aspect of the present application provides a serial port switching device, which is applied to a computing device.
  • the computing device has an external interface and includes G processors.
  • the serial port switching device includes one or more switching logic units, and the switching logic unit is connected between the external interface and the Between the N processors in the computing device, the switching logic unit includes: a first data selector, a second data selector, a third data selector, a hotkey detection module and a control module;
  • 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 data selector;
  • 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 one-to-one correspondence;
  • control terminal is connected to the control module, the data output terminal is connected to a data input terminal of the first data selector, and the N data input terminals are connected to the output serial ports of the N processors in one-to-one correspondence;
  • the hotkey detection module is used for performing hotkey detection according to the input characters of the external interface, so as to determine the hotkey type corresponding to the input characters;
  • the control module is used to perform switching when the hotkey type is a switching hotkey; the switching includes: controlling the first data selector and the third data selector so that the output serial port of the next processor in the N processors and the external interface Connect, and control the second data selector so that the input serial port of the next processor communicates with the external interface;
  • G is an integer greater than or equal to 2
  • N is an integer less than or equal to G.
  • one hotkey can be used to switch serial ports between multiple processors, and one external interface can be used to realize multi-processor system debugging, maintenance, fault recovery and other operations, which can effectively save board port resources , improve the convenience of multi-processor system debugging and maintenance, and at the same time make the single-board port design more concise.
  • it also has the advantages of simple operation, easy implementation, low cost, and good user experience.
  • the control module is also used to change the lock state when the hotkey type is an unlocked hotkey.
  • the lock state is a locked state or an unlocked state. In the locked state The control module does not perform switching, and in an unlocked state, the control module can perform switching when the hotkey type is a switching hotkey.
  • the serial ports in the multiprocessor system can be unlocked and unlocked with one hotkey for unlocking and unlocking, which can effectively save the port resources of the single board and improve the convenience of debugging, maintenance, fault recovery and other operations of the multiprocessor system.
  • the switching logic unit further includes: an idle detection module, configured to perform idle detection on the data output end of the third data selector; When the hot key is idle and the idle detection result of the idle detection module is idle, switch is performed; or, it is specifically used to change the lock state when the hot key type is an add/unlock hot key and the idle detection result of the idle detection module is idle.
  • an idle detection module configured to perform idle detection on the data output end of the third data selector; When the hot key is idle and the idle detection result of the idle detection module is idle, switch is performed; or, it is specifically used to change the lock state when the hot key type is an add/unlock hot key and the idle detection result of the idle detection module is idle.
  • the control module is also used to perform timeout control, and the timeout control includes one of the following: before the execution of the handover, the idle detection result of the idle detection module is idle detection timeout, and the execution of the handover is stopped; During the execution process of switching, the idle detection result of the idle detection module is idle detection timeout, and the first data selector, the second data selector and the third data selector are controlled to fall back to the state before switching; Before, the idle detection result of the idle detection module is idle detection timeout, stop changing the lock state.
  • the switching logic unit further includes: a prompt module, connected to the second data input end of the first data selector, for outputting prompt information corresponding to the hotkey type under the control of the control module For the first data selector; the control module is also used to control the first data selector to enable the prompt module, so that the prompt information is sent to the external device through the first data selector and the external interface.
  • information related to the serial port operation can be fed back to the user in real time during the serial port operation process, so that the user can clearly and intuitively understand the serial port operation process and operation results, thereby further avoiding misjudgment and misoperation.
  • control module is specifically configured to: before outputting the prompt information, control the first data selector to select the prompt module, and control the third data selector to select the output of the next processor Serial port; after the prompt information is output, control the first data selector to strobe the third data selector, control the second data selector to strobe the input serial port of the next processor, so that the next processor in the N processors Both the output serial port and the input serial port are connected with the external interface.
  • the serial port switching device further includes a level conversion device connected between the switching logic unit and the external interface.
  • a level conversion device connected between the switching logic unit and the external interface.
  • the second aspect of the present application provides a serial port switching method, which is applied to a computing device, and the computing device has an external interface and includes G processors;
  • the serial port switching method is realized by a serial port switching device.
  • the serial port switching device includes one or more switching logic units, and 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: the first data selection device, the second data selector, the third data selector, the data output end of the first data selector is connected to the external interface and the first data input end is connected to the data output end of the third data selector, the data of the second data selector
  • the 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, the data output end of the third data selector is connected to a data input end of the first data selector and the N data input ends One-to-one connection with the output serial ports of N processors;
  • Serial port switching methods including:
  • switching is performed, and the switching includes: controlling the first data selector and the third data selector so that the output serial port of the next processor in the N processors is communicated with the external interface, and controlling the first data selector Two data selectors make the input serial port of the next processor communicate with the external interface;
  • G is an integer greater than or equal to 2
  • N is an integer less than or equal to G.
  • the serial port switching method also includes: changing the lock state when the hotkey type is an unlocked hotkey, the lock state is a locked state or an unlocked state, and in the locked state
  • the control module does not perform switching, and in an unlocked state, the control module can perform switching when the hotkey type is a switching hotkey.
  • the serial port switching method further includes: performing idle detection on the data output end of the third data selector;
  • switching is performed, including: when the hotkey type is a switching hotkey and the detection result of the idle detection is idle, switching is performed; or,
  • changing the lock state includes: changing the lock state when the hotkey type is an add/unlock hotkey and the idle detection result of the idle detection module is idle.
  • the serial port switching method also includes: performing timeout control, and the timeout control includes one of the following:
  • the first data selector, the second data selector, and the third data selector are controlled to fall back to the state before the switching;
  • the serial port switching device further includes: a prompt module connected to the second data input end of the first data selector; the serial port switching method further includes: controlling the first data selector to strobe The reminder module is used to send the reminder information to the external device through the first data selector and the external interface.
  • controlling the first data selector and the third data selector so that the output serial port of the next processor among the N processors is connected to the external interface includes: before outputting the prompt information , control the first data selector to strobe the prompt module, control the third data selector to strobe the output serial port of the next processor; after outputting the prompt information, control the first data selector to strobe the third data selector, so that The output serial port of the next processor among the N processors is communicated with the external interface; controlling the second data selector so that the input serial port of the next processor is communicated with the external interface, including: after outputting the prompt information, controlling the second data selection The input serial port of the next processor is selected by the device, so that the input serial port of the next processor is communicated with the external interface.
  • the third aspect of the present application provides an electronic device, including: a processor and an interface circuit, the processor accesses the memory through the interface circuit, the memory stores program instructions, and when the program instructions are executed by the processor, the above serial port switching method is implemented.
  • the fourth aspect of the present application provides an electronic device, including a processor and a memory, the memory stores program instructions, and when the program instructions are executed by the processor, the processor executes the above serial port switching method.
  • the processor is a CPLD. Because the CPLD is integrated with ROM and the cost is low, the resources are suitable and not wasted, thus, the cost can be further reduced.
  • the fifth aspect of the present application provides a computer-readable storage medium, on which program instructions are stored.
  • the program instructions are executed by a computer, the computer executes the above serial port switching method.
  • a sixth aspect of the present application provides a computer program product, which includes a computer program, and when the computer program is run by a processor, the processor executes the serial port switching method of the second aspect above.
  • a seventh aspect of the present application provides a computing device, the computing device includes a plurality of processors, and the computing device further includes the above-mentioned serial port switching device, any of the above-mentioned electronic devices, or the above-mentioned computer-readable storage medium.
  • the eighth aspect of the present application provides a frame system, including the above-mentioned serial port switching device, any electronic device, a computer-readable storage medium, or the above-mentioned computing device.
  • a ninth aspect of the present application provides a vehicle-mounted system, including the above-mentioned serial port switching device, any electronic device, a computer-readable storage medium or a computing device.
  • the tenth aspect of the present application provides a vehicle, including the above-mentioned serial port switching device, any electronic device, a computer-readable storage medium, a computing device, or a vehicle-mounted system.
  • the serial port switching device includes a second data selector and a third data selector, the third data selector is connected between a plurality of processor output serial ports and the external interface, and the second data selector is connected to the Between the input serial ports of multiple processors and the external interface, in response to the input characters of the corresponding switching hotkeys, the third data selector is controlled to select the output serial port of a processor, and the second data selector is selected to select the input serial port of the processor, Therefore, the serial port switching function between multiple processors can be realized through one hotkey, which effectively reduces the logic complexity of serial port switching and simplifies the user operation of serial port switching. Therefore, the multi-processing system can be realized through one external interface. Operations such as debugging, maintenance, and fault recovery can effectively save board port resources and improve the convenience of board commissioning. At the same time, the embodiment of the present application also has the advantages of easy implementation, low cost, and improved user experience.
  • FIG. 1 is a schematic diagram of the structure and connection of a serial port switching device provided by an embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of a serial port switching device provided by an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of a serial port switching method provided by an embodiment of the present application.
  • Fig. 4 is an exemplary specific implementation flowchart of a method for switching serial ports according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • Fig. 6 is a schematic structural diagram of a computing device provided by an embodiment of the present application.
  • Fig. 7 is a schematic structural diagram of an intelligent driving controller.
  • Fig. 8 is a schematic structural diagram of an intelligent driving controller provided by an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a frame system provided by an embodiment of the present application.
  • the console (Console) port can also be called the management port or the maintenance segment, that is, the console access port of the device, and is used for the user to perform initial configuration and subsequent management of the device through a terminal or an emulated terminal (for example, a serial port service program).
  • the Console port is usually an RJ45 interface, and can also be a DB9 interface or a DB25 interface, which complies with the serial data interface standard (RS232) protocol.
  • serial port switching scheme mainly has the following two possible implementation methods:
  • serial port switching scheme based on the external serial port: input to the complex programmable logic device (Complex Programmable Logic Device, CPLD) in hot key or frame format, and the CPLD parses out the serial port data, and confirms it as switching hot key or switching frame after comparison. Then switch to the corresponding serial port.
  • the disadvantages of this implementation include: 1When the number of serial ports is large, the hotkeys are not enough; 2It may conflict with the hotkeys of some serial port tools; 3Switching frames and normal use scenarios requires repeated switching, and the logic complexity of serial port switching is high; 4 There is no feedback for the switching result. When there are multiple operating systems of the same type, it is impossible to distinguish the processor corresponding to the current serial port.
  • serial port switching schemes are both hard switching, and serial port garbled characters may occur in both.
  • the embodiment of the present application provides a new serial port switching device, method, equipment, storage medium, system and vehicle, which can realize serial port switching among multiple processors by using one hotkey, and through one external The interface can realize the debugging, maintenance, fault recovery and other operations of the multiprocessor system.
  • the external interface mentioned in the embodiment of the present application refers to an interface for connecting external devices, and the external interface may be of various applicable types.
  • the external interface may be, but not limited to, a debugging interface, a maintenance interface, etc., for example, the Console port mentioned herein.
  • FIG. 1 and FIG. 2 show the structure and connection diagrams of the serial port switching device 100 provided by the embodiment of the present application.
  • the serial port switching device 100 provided by the embodiment of the present application can be applied to a computing device.
  • the computing device has one or more external interfaces and may include G processors, each processor has a serial port, and 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.
  • the serial port switching device 100 may include one or more switching logic units 110 , and one switching logic unit 110 is responsible for switching serial ports of multiple processors corresponding to the same external interface.
  • only one switching logic unit 110 can be set in the serial port switching device 100, and the switching logic unit 110 is connected between the external interface and the multiple processors corresponding to the external interface. between processors.
  • two or more switching logic units 110 can be set in the serial port switching device 100, each The switching logic unit 110 is connected between a pair of external interfaces and multiple processors corresponding to the external interfaces.
  • the switching logic unit 110 corresponding to the external interface can be connected between the external interface and the N processors, and the switching logic unit 110 is used to implement
  • the serial port switching of the N processors 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.
  • External interface 1 corresponds to the first N processors CPU 0 -CPU N
  • external interface 2 corresponds to the last K processors CPU N+1 -CPU N+K
  • N is an integer greater than or equal to 2
  • K is greater than or equal to 2 integer.
  • the serial port switching device 100 may include two switching logic units 110, and one switching logic unit 110 is connected between the external interface 1 and the processors CPU 0 -CPU N , responsible for the first N processors CPU 0 -CPU N
  • another switching logic unit 110 is connected between the external interface 2 and the processors CPU N+1 -CPU N+K , and is responsible for the serial port switching of the last K processors CPU N+1 - CPU N+K .
  • the switching logic unit 110 may include: a first data selector (Multiplexer, MUX) 111 , a second data selector 112 , a third data selector 113 , a hotkey detection module 114 and a control module 115 .
  • the first data selector 111 has a control terminal, two data input terminals and a data output terminal, the control terminal is connected to the control module 115, the data output terminal is connected to the external interface, and the first data input terminal in the two data input terminals is connected to the second data input terminal.
  • the second data selector 112 has a control terminal, a data input terminal and at least N data output terminals, the control terminal is connected to the control module 115, and the N data output terminals are connected to the input serial ports in the N processors one by one. The input end is connected to the external interface.
  • the third data selector 113 has a control terminal, a data output terminal and at least N data input terminals, the control terminal is connected to the control module 115, the data output terminal is connected to the first data input terminal of the first data selector 111, N data The input terminals are connected to the output serial ports of the N processors in one-to-one correspondence.
  • 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 .
  • the control module 115 is respectively connected to the hotkey detection module 114 , the control terminal of the first data selector 111 , the control terminal of the second data selector 112 and the control terminal of the third data selector 113 .
  • the hotkey detection module 114 may be configured to perform hotkey detection according to the input characters of the external interface, so as to determine the type of the hotkey corresponding to the input characters. After determining the hotkey type corresponding to the input character, the hotkey detection module 114 can provide information of the hotkey type to the control module 115, so that the control module 115 can perform corresponding serial port operations according to the hotkey type.
  • the hotkey type may include but not limited to switching hotkeys, adding and unlocking hotkeys.
  • the serial port operation may include but not limited to switching, adding and unlocking.
  • other hotkey types may be defined according to different application scenarios and actual test requirements, and the specific definition of the hotkey type is not limited in this embodiment of the present application.
  • control module 115 can be used to perform switching when the hotkey type is a switching hotkey, and the switching can include: controlling the first data selector 111 and the third data selector 113 so that the N processors are down The output serial port of a processor is communicated with the external interface, and the second data selector 112 is controlled so that the input serial port of the next processor is communicated with the external interface, thereby realizing the process from the current processor to the next processor among the N processors serial port switching. Therefore, in the embodiment of the present application, the sequential scrolling switching of serial ports among multiple processors (for example, N processors CPU 0 -CPU N ) can be realized through one switching hotkey.
  • the switching can include: controlling the first data selector 111 and the third data selector 113 so that the N processors are down The output serial port of a processor is communicated with the external interface, and the second data selector 112 is controlled so that the input serial port of the next processor is communicated with the external interface, thereby realizing the process from the current processor to the
  • the control module 115 can also be used to change the state of the lock when the hotkey type is an unlocking hotkey.
  • the lock state can be a locked state or an unlocked state. In the locked state, the control module 115 does not perform switching. In the unlocked state, the control module 115 can perform switching when the hotkey type is a switching hotkey.
  • the unlocking and unlocking of the output serial port of the processor can be realized through one unlocking hotkey.
  • changing the lock state may include: the control module 115 changing the current locked state to an unlocked state, or changing the current unlocked state to a locked state when the hotkey type is an unlocking hotkey. That is, if the control module 115 is currently in the locked state, in response to the input character corresponding to the unlocking hotkey, the control module 115 will update the lock state to "unlocked”; if the control module 115 is currently in the unlocked state, In response to the input characters corresponding to unlocking and unlocking the hotkey, the control module 115 will update the lock status to "locked".
  • the switching logic unit 110 may further include a prompt module 116 .
  • a prompt module 116 Referring to FIG. 2 , one end of the prompt module 116 is connected to the second data input end of the first data selector 111 , and the other end of the prompt module 116 is connected to the control module 115 .
  • the prompt module 116 can be configured to output prompt information corresponding to the hotkey type to the first data selector 111 under the control of the control module 115 .
  • the control module 115 can also be used to control the first data selector 111 to select the prompt module 116, so that the prompt information is sent to an external device (for example, a commissioning device) through the first data selector 111 and the external interface, so that the external device can send
  • an external device for example, a commissioning device
  • the user displays the prompt information, so that the user can clearly and intuitively understand information such as the operation process and operation results of the serial port.
  • the prompt information may be preset information corresponding to the hotkey type.
  • corresponding prompt information can be configured for different hotkey types.
  • switching prompt information may be pre-configured.
  • the control module 115 can control the prompt module 116 to output a switch prompt message, the switch prompt message can indicate the serial port of which processor will be switched to this operation, and the switch prompt message can include the processor identification, etc.
  • lock prompt information may be pre-configured.
  • the control module 115 can control the prompt module 116 to output a lock prompt message, which can indicate which processor's serial port will be locked or unlocked in this operation. It may include the identification of the processor, instructions for unlocking and unlocking actions, etc.
  • the embodiment of the present application does not limit the format, form, content, etc. of the prompt information.
  • control module 115 can be specifically used to: before outputting the prompt information, control the first data selector 111 to select the prompt module 116, and control the third data selector 113 to select the output serial port of the next processor; After prompting information, control the first data selector 111 to strobe the third data selector 113, control the second data selector 112 to strobe the input serial port of the next processor, so that the output of the next processor in the N processors Both the serial port and the input serial port are connected to the external interface.
  • one switch hotkey can be used to switch between the serial ports of multiple processors, and at the same time output prompt information during the switching process, which is convenient for users to understand the relevant information of serial port switching in a timely and accurate manner, thereby effectively avoiding user misoperation or miscarriage of justice.
  • the switching logic unit 110 may further include an idle detection module 117 .
  • the input end of the idle detection module 117 is connected to the data output end of the third data selector 113 , and the output end of the idle detection module 117 is connected to the control module 115 .
  • the idle detection module 117 may be configured to perform idle detection on the data output end of the third data selector 113 .
  • the idle detection module 117 may implement idle detection in various applicable ways. For example, the idle detection module 117 can perform idle detection on the data output end of the third data selector 113, if the data output by the third data selector 113 is high level for two consecutive characters, it can be determined that the third data selector 113 The data output terminal of the data selector 113 is idle, that is, the output serial port of the processor currently selected by the third data selector 113 is idle, and an idle detection result indicating idleness is output to the control module 115.
  • control module 115 can execute the corresponding action of the hotkey according to the idle state of the data output end of the third data selector 113 , thereby avoiding garbled characters.
  • control module 115 is specifically configured to perform the aforementioned switching when the type of the hotkey is a switching hotkey and the idle detection result of the idle detection module 117 is idle. Therefore, it is possible to switch to the serial port of the target processor after confirming that it is idle, so as to avoid garbled characters.
  • control module 115 can be specifically configured to change the lock status when the hotkey type is an unlock hotkey and the idle detection result of the idle detection module 117 is idle. In this way, unlocking can be performed after confirming that it is free, so as to avoid garbled characters.
  • control module 115 can also be used to perform timeout control, which can include one of the following: 1) before the handover is performed, the idle detection result of the idle detection module 117 is idle detection timeout, and the handover is stopped; 2) During the execution process of switching, the idle detection result of the idle detection module 117 is idle detection timeout, and the first data selector 111, the second data selector 112 and the third data selector 113 are controlled to fall back to the state before switching; 3 ) Before changing the lock state, the detection result of the idle detection module 117 is that the idle detection has timed out, and the execution of the change of the lock state is stopped.
  • control module 115 can also be used to control the third data selector 113 to strobe the output serial port of the current processor and control the second data selection when the idle detection result of the idle detection module 117 is idle detection timeout.
  • the device 112 selects the input serial port of the current processor. In this way, not only can the current processor fall 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 realized to avoid the excessively time-consuming switching execution process.
  • control module 115 is further configured to confirm that the handover fails when the idle detection result of the idle detection module 117 is an idle detection timeout, and does not perform the handover action. In this way, the timeout control of serial port switching can be realized, so as to avoid the misoperation caused by the time-consuming switching execution process.
  • the control module 115 can also be used to confirm that the unlocking fails when the idle detection result of the idle detection module 117 is an idle detection timeout, and does not perform the change action of the lock state. In this way, the timeout control of serial port unlocking and unlocking can be realized, avoiding misoperation caused by too long time-consuming execution process of unlocking and unlocking.
  • the embodiment of the present application introduces the above-mentioned timeout control mechanism to effectively avoid such situations, improve the effectiveness of serial port operations, simplify user operations, and improve user experience.
  • the serial port switching device 100 may also include a level conversion device, which is connected between the switching logic unit 110 and the external interface, and is used to realize level signal conversion between the external interface and the serial port of the processor .
  • the level shifting device may be but not limited to the RS232 level shifting device 120, which can be used to realize conversion between level signals such as LVCMOS and LVTTL and RS232 level signals to meet Standard console Universal Asynchronous Receiver/Transmitter (UART) interface level requirements.
  • the serial port switching device 100 of the embodiment of the present application can be applied to various computing devices.
  • the serial port switching device 100 can be deployed on a multi-processor single-board computer to realize the serial port switching function between multiple processors in the single-board computer, which can not only save external devices required for single-board maintenance and debugging. Interface resources, but also has the advantages of easy implementation, simple operation, low cost, and good user experience.
  • FIG. 3 shows a schematic flowchart of a serial port switching method provided by an embodiment of the present application.
  • the serial port switching method is implemented by the above-mentioned serial port switching device 100 .
  • the serial port switching method provided by the embodiment of the present application may include:
  • Step S310 performing hotkey detection according to the input characters of the external interface, so as to determine the hotkey type corresponding to the input characters;
  • Step S320 when the hotkey type is a switching hotkey, switching is performed, and the switching includes: controlling the first data selector 111 and the third data selector 113 so that the output serial port of the next processor among the N processors is the same as The external interface is connected, and the second data selector 112 is controlled to make the input serial port of the next processor communicate with the external interface.
  • step S320 may further include: changing the lock state when the hotkey type is an unlocked hotkey, the lock state is a locked state or an unlocked state, and the control module 115 does not perform switching in the locked state , in the unlocked state, the control module 115 can perform switching when the hotkey type is a switching hotkey.
  • step S320 may further include: controlling the first data selector to enable the prompt module, so that the prompt information is sent to the external device through the first data selector and the external interface.
  • the switching in step S320 may specifically include: before outputting the prompt information, controlling the first data selector to select the prompt module, and controlling the third data selector to select the output serial port of the next processor; After information, control the first data selector to strobe the third data selector, control the second data selector to strobe the input serial port of the next processor, so that the input of the next processor in the N processors can be Both the serial port and the output serial port are connected to the external interface.
  • step S320 may further include: performing idle detection on the data output end of the third data selector.
  • step S320 switching is performed when the type of the hotkey is a switching hotkey and the detection result of the idle detection is idle.
  • step S320 when the hotkey type is an unlocking hotkey and the idle detection result of the idle detection module is idle, the lock state is changed.
  • the above-mentioned serial port switching method may also include: performing timeout control, which may include one of the following: 1) before the switching is performed, the idle detection result is an idle detection timeout, and the switching is stopped; 2) during the switching During execution, if the idle detection result is idle detection timeout, control the first data selector 111, the second data selector 112 and the third data selector 113 to fall back to the state before switching; 3) before changing the lock state execution, The result of the idle detection is that the idle detection timed out, and the execution of the change of the lock state is stopped.
  • timeout control which may include one of the following: 1) before the switching is performed, the idle detection result is an idle detection timeout, and the switching is stopped; 2) during the switching During execution, if the idle detection result is idle detection timeout, control the first data selector 111, the second data selector 112 and the third data selector 113 to fall back to the state before switching; 3) before changing the lock state execution, The result of the idle detection is that the idle detection timed
  • the debugging serial port of each CPU on the single board is respectively connected to the switching logic unit of the serial port switching device, and the Console port on the single board is connected to the switching logic unit in the serial port switching device through a level conversion device.
  • an exemplary implementation process of serial port switching of a multiprocessor single-board computer may include the following steps:
  • Step S401 after power-on, the default CPU M (0 ⁇ M ⁇ N) is connected to the panel console, the COM port of the commissioning device is connected to the console port of the single-board computer, and the user enters into the console port through the serial port service program loaded on the commissioning device. character, the process starts;
  • serial port service program may be a visual serial port service program installed on the commissioning device, and may also be called “serial interactive software", such as the HyperTerminal that comes with Windows.
  • Step S402 monitor the input characters of the Console port, check the input characters byte by byte to determine whether the hotkey matches, start the corresponding hotkey function (that is, switch the serial port or add and unlock the serial port) when the hotkey matches, and continue to step S430 , return to step S401 when the hotkeys do not match.
  • start the corresponding hotkey function that is, switch the serial port or add and unlock the serial port
  • the ASCII code 0x1c corresponds to the hotkey "Ctrl+]", and the hotkey “Ctrl+]” is the hotkey for switching serial ports in a pre-agreed order;
  • the ASCII code 0x1d corresponds to the hotkey "Ctrl+ ⁇ ”, and the hotkey "Ctrl+ ⁇ ” is the Add unlock hotkey. If the input character of the Console port is "0x1c”, switch the hotkey matching, if the input character of the Console port is "0x1d”, then add and unlock the hotkey matching, if the input character of the Console port is neither "0x1c” nor "0x1d ”, the hotkeys do not match.
  • Step S403 perform idle detection on the data output terminal of the third data selector 113, and proceed to step S405 if idle, otherwise proceed to step S404.
  • the idle detection can be continuously performed if the predetermined duration is not exceeded.
  • Step S404 perform timeout control, and jump to step S412.
  • timeout control may include one of the following:
  • the currently selected CPU is CPU M , and after the idle detection times out, it is confirmed that the switching fails, and the switching action is not executed.
  • the currently selected CPU is CPU M , and after the idle detection times out, it is confirmed that adding and unlocking has failed, and the action of changing the lock state is not executed.
  • idle detection timeout refers to that the execution time of idle detection exceeds a predetermined duration, that is, the data output terminal of the third data selector 113 is continuously in a busy or output abnormal state within the predetermined duration, and the third data selector 113
  • the state of the data output terminal is the state of the output serial port of the CPU currently selected by the third data selector 113 .
  • the idle detection will continue until the serial port switching or unlocking is completed. Timeout control and idle detection can be carried out synchronously until the end of serial port switching or the end of adding and unlocking.
  • the predetermined duration of the idle detection can be configured by setting the detection window, and the specific value of the predetermined duration can be freely set according to the requirements of the application scenario.
  • the embodiment of the present application does not limit the configuration mode and specific value of the predetermined duration.
  • Step S405 determine whether the hotkey type is switching or unlocking, if it is switching, continue the serial port switching process of steps S406-S408, if the function of the hotkey is unlocking, continue the unlocking process of steps S409-411.
  • Step S406 before outputting the switch prompt information, the control module 115 controls the first data selector MUX111 to switch to the second data input end, so that the output port of the prompt module 116 is gated to the Console port, so that the prompt module 116 outputs prompt information; meanwhile, The control module 115 controls the third data selector MUX113 to switch to the Xth data input end, so that the CPU X outputs the serial port strobe to the first data input end of the first data selector MUX111, enters step S407, and continues to execute step S403 at the same time, to Detect whether the data output terminal of the third data selector MUX113 is idle, that is, detect whether the CPU X output serial port is idle;
  • X [(M+1)mode N]
  • mode N represents the remainder operation, which can avoid overflow and switch to an empty serial port through the remainder operation
  • CPU X is the next CPU of CPU M
  • M and X are An integer 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 process
  • M represents the identification of the current processor ( For example, number)
  • X is the identification of the next processor (for example, number).
  • the identifier of the processor connected to the switching logic unit 110 may be preconfigured.
  • a processor identification sequence corresponding to the switching logic unit 110 may be pre-configured in the control module 115, and the processor identification sequence may include identifications of all processors connected to the switching logic unit 110, and these identifications are in accordance with Arranging in advance, when performing switching, the control module 115 can determine the identification of the next processor (that is, the target processor to be switched) according to the identification of the current processor and the processor identification sequence, and then perform switching for the next processor .
  • Step S407 the prompt module 116 outputs the switching prompt information "SWITCH TO CPU X ", and the switching prompt information is successively output to the commissioning equipment through the MUX111 and the Console port, and the commissioning equipment displays the switching prompt information, so that the user can intuitively and clearly know the switching target processor.
  • Step S408 after outputting the switching prompt information, if the CPU X output serial port is idle, the control module 115 controls the MUX111 to switch to its first data input end, so that the CPU X output serial port is strobed to the Console port; the control module 115 controls the MUX112 to switch to its first data input port.
  • the X data input terminal makes the Console port strobe to the CPU X input serial port, jumps to step S412, and ends the serial port switching process from CPU M to CPU X.
  • Step S409 before outputting the lock prompt information, the control module 115 controls the MUX111 to switch to the second data input terminal, so that the output port of the prompt module 116 is gated to the Console port, and enters step S410, while continuously executing step S403 to detect the third data Whether the data output terminal of the selector MUX113 is idle, that is, confirm whether the output serial port of CPU X is idle;
  • step S410 the prompt module 116 outputs the lock prompt information "UNLOCK/LOCK CPU M ", and the lock prompt information is output to the commissioning device through the MUX 111 and the Console port successively, and the commissioning device displays the lock prompt information.
  • the content of the output lock prompt information can be "LOCK CPU M " to remind the user that the lock state is about to be changed to an unlocked state.
  • Lock state that is, the output will be locked to CPU M output serial port; if the value of the lock state is 0, it indicates that it is currently in the locked state, and the content of the output lock prompt message can be "UNLOCK CPU M " to remind the user that the lock state is about to be changed to In the unlocked state, the lock on the output serial port of CPU M is about to be unlocked.
  • Step S411 after outputting the switching prompt information, if the CPU M output serial port is idle, the control module 115 changes the lock state, and simultaneously controls the MUX111 to switch to its first data input end, so that the CPU M output serial port is strobed to the Console port, and continues to step S412, End the process of unlocking and unlocking the output serial port of CPU M.
  • the value of the lock state is "0" before the change, it indicates that the control module 115 is in the locked state, and in this step, the value of the lock state is changed to "1", so that the control module 115 is changed to not locked. lock state. If the value of the lock state is "1" before the change, it indicates that the control module 115 is in the unlocked state. In this step, the value of the lock state is changed to "0", so that the control module 115 is changed to the locked state.
  • the control module 115 can be switched between the two lock states by unlocking the hotkey, thereby realizing the locking and unlocking operations for the output serial port of the current processor CPU M.
  • a hot key can be used to switch between multiple CPUs (for example, CPU 0 to CPU N ) in a sequential cycle , the serial port switching from CPU 0 to CPU N and serial port unlocking can be realized through 2 hotkeys, which can effectively avoid the serial port program hotkey conflicts on the commissioning device, reduce the logical complexity of serial port operations, and save the external interface of the board resources;
  • prompt information can be output during serial port operation, which is convenient for users to understand the process and results of serial port operation conveniently and intuitively;
  • third, non-idle does not switch, which can avoid garbled characters caused by serial port switching.
  • timeout control is introduced to avoid user misoperation caused by too long execution time of serial port operations, thereby improving the effectiveness and user experience of serial port operations.
  • the target processor for example, CPU X
  • it can fall back to the processor before switching (for example, CPU M ), which can further improve the effectiveness of serial port operations and user experience.
  • FIG. 5 is a schematic structural diagram of an electronic device 500 provided by an embodiment of the present application.
  • the electronic device 500 includes: a processor 510 and a memory 520 .
  • the processor 510 may be connected to the memory 520 .
  • Memory 520 may be used to store the program codes and data. Therefore, the memory 520 may be a storage unit inside the processor 510, or an external storage unit independent of the processor 510, or a component including a storage unit inside the processor 510 and an external storage unit independent of the processor 510. .
  • 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 FIG. 8 may be used to communicate with other devices.
  • the electronic device 500 may also include a bus.
  • the memory 520 and the communication interface 530 may be connected to the processor 510 through a bus.
  • only one line is used to represent the bus in FIG. 5 , but it does not mean that there is only one bus or one type of bus.
  • the processor 510 may be a central processing unit (central processing unit, CPU).
  • the processor can also be other general-purpose processors, digital signal processors (digital signal processors, DSPs), application specific integrated circuits (application specific integrated circuits, ASICs), field programmable gate arrays (field programmable gate arrays, FPGAs), CPLDs Or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the processor 510 adopts one or more integrated circuits for executing related programs, so as to implement the technical solutions provided by the embodiments of the present application.
  • Memory 520 may include read-only memory and random-access memory, and provides instructions and data to processor 510 .
  • a portion of processor 510 may also include non-volatile random access memory.
  • processor 510 may also store device type information.
  • the processor 510 executes the computer-executed instructions in the memory 520 to execute the operation steps of the above ambient light control method.
  • the electronic device 500 may correspond to a corresponding body executing the methods according to the various embodiments of the present application, and the above-mentioned and other operations and/or functions of the modules in the electronic device 500 are for realizing the present invention
  • the corresponding processes of the methods in the embodiments are not repeated here.
  • the present application also provides another electronic device, including a processor and an interface circuit, the processor accesses the memory through the interface circuit, the memory stores program instructions, and when the program instructions are executed by the processor, the processor executes the above serial port switching method.
  • the processor may be a CPLD.
  • the embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the program is run by a processor, the processor executes the above serial port switching method.
  • the computer readable medium may be a computer readable signal medium or a computer readable storage medium.
  • a computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, semiconductor system, device, or device, or any combination thereof.
  • Computer-readable storage media include: electrical connections with one or more conductors, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable Read memory, optical fiber, portable compact disk read only memory, optical storage devices, magnetic storage devices, or any suitable combination of the above.
  • the embodiment of the present application also provides a computer program product, which includes a computer program, and when the computer program is run by a processor, the processor executes the above serial port switching method.
  • the programming language of the computer program product may be one or more, and the programming language may include but not limited to object-oriented programming languages such as Java and C++, conventional procedural programming languages such as "C" language, etc. language.
  • the embodiment of the present application also provides a computing device, the computing device includes multiple processors, and the computing device further includes the above-mentioned serial port switching apparatus 100, an electronic device, a computer-readable storage medium, or a computer program product.
  • FIG. 6 is a schematic structural diagram of a computing device 600 provided by 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 multiple processors 610 and the external interface.
  • the computing device 600 may further include a memory 620 and a communication interface 630 . It should be understood that other components may also be included in computing device 600 .
  • the computing device 600 can be implemented as a functional unit or module in a single-board computer or chip, or can also be implemented as an independent chip or single-board computer.
  • the above-mentioned computing device 600 may be a single-board complex multi-processor system, a car machine, a cockpit domain controller (cockpit domain controller, CDC), a mobile data center/multi-domain controller (Mobile Data Center/Multi-Domain Controller, MDC ), a functional unit/module in the vehicle computing platform (vehicle computing platform, VPC), which is an integrated software and hardware platform for supporting intelligent driving.
  • VPC vehicle computing platform
  • the embodiment of the present application does not limit the shape and deployment manner of the computing device 600 .
  • Fig. 7 shows an exemplary structure of an MDC.
  • MDC includes 1 system on chip (System On Chip, SOC), 3 video processors, 8 artificial intelligence (AI) processors, 1 microcontroller (Microcontroller Unit, MCU) and various Sensor interface
  • the sensor interface includes 16 camera (Camera) interfaces, 12 GE interfaces, and 7 flexible data transmission rate Controller Area Network (Controller Area Network with Flexible Data-Rate, CAN-FD) interfaces.
  • 8 serial Gigabit Media Independent Interfaces (Serial Gigabit Media Independent Interface, SGMII) of the SOC are connected to 8 GE interfaces through 8 port physical layer (Physical Level, PHY) components, and 1 SGMII of the SOC
  • the four GE interfaces are connected through the Ethernet switching device and its four SGMII and four port physical layer (PHY) components, and the three PCIe Gen2X2 interfaces of the SOC are connected to the three video processors, and the video processor 1 passes the video solution Serializer 1 is connected to 4 camera interfaces, video processor 2 is connected to 4 camera interfaces through video deserializer 2, and video processor 3 is connected to 8 camera interfaces through video deserializer 3 and video deserializer 4.
  • the SOC connects 8 AI processors through its 8 high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, PCIe) Gen2X2 interfaces, and the 8 reduced Gigabit Media Independent Interfaces (Reduced Gigabit Media Independent Interface, RGMII) is connected to the MCU through the Ethernet switching device and one RGMII, and the MCU is connected to seven CAN-FD interfaces.
  • PCIe Peripheral Component Interconnect Express
  • RGMII Reduced Gigabit Media Independent Interface
  • FIG. 8 shows an exemplary structure of an MDC including the serial port switching device 100 .
  • the serial port switching device 100 includes two switching logic units 110 and one RS232 level conversion device 120, and one switching logic unit 110 is connected to an external interface Console X1 of the MDC through the RS232 level conversion device 120 , the switching logic unit 110 is responsible for serial port switching between a microcontroller (Microcontroller Unit, MCU), a processor system on chip (System On Chip, SOC) (including 3 processors), and 3 video processors, and another A switching logic unit 110 is connected to another external interface Console X1 of the MDC through an RS232 level conversion device 120, and the switching logic unit 110 is responsible for the serial port switching between 8 AI processors.
  • MCU microcontroller Unit
  • SOC System On Chip
  • serial port switching device 100 by using the serial port switching device 100, by defining two hot keys, serial port switching and serial port unlocking can be performed between the processors in the MDC.
  • all processing in the MDC can be realized by using two external interfaces through serial port switching. Operations such as installation, commissioning, and fault recovery of the server.
  • the embodiment of the present application also provides a vehicle-mounted system, and the vehicle-mounted system may include the serial port switching device 100 , any electronic device described above, the computer-readable storage medium described above, or the computing device 600 described above.
  • the vehicle system may include: vehicle telematics processor (telematics box, T-BOX), central gateway, body control module (Body Control Module, BCM), integrated cockpit controller (Integrated Cockpit Controller, ICC) , Advanced Driving Assistance System (Advanced Driving Assistance System, ADAS), power chassis domain controller (Power Distribution Control Unit, PDCU) and on-board automatic diagnostic system (On-Board Diagnostic).
  • vehicle telematics processor telematics box, T-BOX
  • central gateway body control module
  • BCM Body Control Module
  • integrated cockpit controller Integrated Cockpit Controller
  • ICC Integrated Cockpit Controller
  • ADAS Advanced Driving Assistance System
  • power chassis domain controller Power Distribution Control Unit
  • On-Board Diagnostic on-board automatic diagnostic system
  • the central gateway can be connected to T-BOX through CAN-FD, ETH, ICC, ADAS and PDCU, and on-board automatic diagnosis system can be connected to the central gateway through CAN-FD and Ethernet (Ethernet, ETH) respectively, and BCM can be connected to the central gateway through CAN-FD Connect with central gateway.
  • the ADAS includes a serial port switching device 100, through the serial port switching device 100, operations such as installation, debugging, maintenance and fault recovery of multiple processors in the ADAS can be realized through a small number of external interfaces.
  • the ADAS can be implemented as an MDC as shown in FIG. 8 .
  • T-BOX can be used to receive global positioning system (global positioning system, GPS) positioning information, and/or provide in-vehicle wireless fidelity (WIFI) network access, and/or access through long-term evolution (Long Term Evolution, LTE)
  • WIFI in-vehicle wireless fidelity
  • LTE long-term evolution
  • the mobile data network is the general interface between the vehicle and the outside world.
  • the central gateway can be used to provide the exchange of CAN and vehicle Ethernet, and it is the connection center of the network in the vehicle.
  • BCM can be used to control or report the status of turn signals, headlights, brake lights, wipers, doors, seat belt buckles, etc.
  • ICC can be used to receive user instructions and display information to the display interface
  • ADAS can be used to receive sensory data from various sensors, obtain control vehicle action commands through complex calculations, and send them to PDCU to complete automatic driving actions;
  • PDCU can be responsible for steering, braking, acceleration and deceleration and other vehicle control actions and status reporting.
  • the embodiment of the present application also provides a vehicle, which may include: the serial port switching device 100, any of the above-mentioned electronic devices, the computing device 600, the above-mentioned computer-readable storage medium, the above-mentioned computer program product, or the above-mentioned vehicle-mounted system.
  • the "vehicle” in the embodiment of this application can be but not limited to private cars, commercial vehicles, buses, passenger vehicles, high-speed rail, subways, unmanned vehicles, logistics transport vehicles, unmanned aerial vehicles, etc.
  • the power type of the "vehicle” can be Fuel-driven, pure electric, hydrogen fuel cell-driven, hybrid, etc.
  • the "vehicle” herein may be a human-driven vehicle, an autonomous vehicle, an unmanned vehicle, or other types of vehicles. Those skilled in the art can understand that any similar means of transportation can be regarded as the "vehicle” in the embodiment of the present application.
  • the embodiment of the present application also provides a frame system, which may include the serial port switching device 100 , any of the above-mentioned electronic devices, the above-mentioned computer-readable storage medium, or the above-mentioned computing device 600 .
  • FIG. 9 shows an exemplary structural diagram of a frame system 900 according to an embodiment of the present application.
  • the frame system 900 may include H control boards 910 , J service boards 920 and a backplane 930 , and the H control boards 910 and J service boards 920 are interconnected through the backplane 930 .
  • a serial port switching device 100 in order to realize the serial port switching function of the frame system 900, can be set in each control board 910, and the serial port switching device 100 is connected to the console port on the control board 910 and the P in the control board 910. between the serial ports of a CPU (that is, CPU 0 to CPU P ). In this way, the serial port switching between the P CPUs (that is, CPU 0 ⁇ CPU P ) inside the control board 910 can be realized.
  • the control board 910 is interconnected with each service board 920, it can also pass through the serial ports inside the control board 910 at the same time.
  • the switching device 100 implements serial port switching among Q CPUs (ie, CPU 0 ⁇ CPU Q ) in each service board 920 .
  • both P and Q can be integers greater than or equal to 1.
  • the user operates the switching hotkey on the commissioning device, and the commissioning device inputs a character corresponding to the switching hotkey to the console port of the panel, and in response to the character corresponding to the switching hotkey, the serial port switching device 100 in the control board 910 will control the Serial port switching is performed between the P CPUs (that is, CPU 0 -CPU P ) in the board 910 and the Q CPUs (that is, CPU 0 -CPU Q ) in the currently locked service board 920 .
  • the P CPUs that is, CPU 0 -CPU P
  • the Q CPUs that is, CPU 0 -CPU Q
  • the user operates the unlocking hotkey on the commissioning device, and the commissioning device inputs a character corresponding to the unlocking hotkey to the console port of the panel.
  • the serial port switching device in the control board 910 100 can lock or unlock the serial port of the current CPU, the current CPU is the P CPUs in the control board 910 (that is, CPU 0 ⁇ CPU P ) and the currently locked Q CPUs in the service board 920 (that is, CPU 0 ⁇ CPU Q ) one of.
  • the locking or unlocking of the service board 920 can also be realized by adding and unlocking hotkeys. For example, when the user operates the hotkey for unlocking and unlocking on the commissioning device, the commissioning device inputs characters corresponding to the hotkey for unlocking and unlocking to the console port of the panel. In response to the character corresponding to the hotkey for unlocking and unlocking, the serial port switching device 100 The current business board 920 can be unlocked or locked.
  • switching among various service boards 920 can also be realized by switching hotkeys.
  • the specific switching process is similar to the previous serial port switching and will not be repeated here.
  • a serial port switching device 100 can be installed in the service board 920 of the frame system 900, and the serial port switching device 100 is connected to the console port on the service board 920 and the Q CPUs in the service board 920 (that is, CPU 0 ⁇ CPU Q ) serial ports, thus, the serial port switching among the Q CPUs (that is, CPU 0 ⁇ CPU Q ) inside the service board 920 can be realized through the serial port switching device 100, and then the production process of the frame system 900 can be realized, for example Operations such as commissioning, testing, maintenance, and fault recovery of a certain service board 920 in scenarios such as disassembly and maintenance.
  • the frame system 900 provided in the embodiment of the present application may be implemented as a switch, a router, an access network, or other similar devices.
  • the embodiment of the present application does not limit the specific form and deployment mode of the frame system 900 .

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Systems (AREA)

Abstract

一种串口切换装置、方法、设备、存储介质、系统和车辆。串口切换装置中包含三个数据选择器,通过1个热键即可控制这些数据选择器使得对外接口在多个处理器的串口之间切换连通,由此通过1个对外接口即可实现多处理器系统的调试、维护和故障恢复等操作,可有效节省单板的端口资源,解决了多处理器场景中单板端口紧张情况下的维护和调测问题。

Description

串口切换装置、方法、设备、存储介质、系统和车辆 技术领域
本申请涉及一种串口切换装置、方法、设备、存储介质、系统和车辆。
背景技术
随着系统复杂度和芯片集成度的提高,单片上的处理器数量急剧增长。例如,有的单板上放置了十几个芯片,每个芯片内部集成了3种不同类型的处理器,这就要求每个芯片配备与处理器数量相匹配的串口,以用于现场调试、故障识别、故障恢复等。然而,因面板空间有限,无法提供足够空间配置如此多的串口,因此,迫切需要一种新的串口切换装置,解决单板端口紧张情况下的维护和调试等问题。
发明内容
为解决上述技术问题,本申请实施例提供了一种串口切换装置、方法、设备、存储介质、系统和车辆。
本申请第一方面提供了一种串口切换装置,应用于计算设备,计算设备具有对外接口且包括G个处理器,串口切换装置包括一个或多个切换逻辑单元,切换逻辑单元连接在对外接口与计算设备中N个处理器之间,切换逻辑单元包括:第一数据选择器、第二数据选择器、第三数据选择器、热键检测模块和控制模块;
第一数据选择器中,控制端连接控制模块,数据输出端连接对外接口,第一数据输入端连接第三数据选择器的数据输出端;
第二数据选择器中,控制端连接控制模块,数据输入端连接对外接口,N个数据输出端与N个处理器的输入串口一一对应连接;
第三数据选择器中,控制端连接控制模块,数据输出端连接第一数据选择器的一数据输入端,N个数据输入端与N个处理器的输出串口一一对应连接;
热键检测模块,用于根据对外接口的输入字符进行热键检测,以确定输入字符对应的热键类型;
控制模块,用于在热键类型为切换热键时,执行切换;切换包括:控制第一数据选择器和第三数据选择器以使N个处理器中下一处理器的输出串口与对外接口连通,以及控制第二数据选择器以使下一处理器的输入串口与对外接口连通;
其中,G为大于或等于2的整数,N为小于或等于G的整数。
由此,使用1个热键即可实现多个处理器之间的串口切换,通过1个对外接口即可实现多处理器系统的调试、维护、故障恢复等操作,可有效节省单板端口资源,提升多处理器系统调试及维护的便捷度,同时还可使单板端口设计更加简洁化。此外,还可具有操作简单、易于实现、成本低、用户体验良好等优点。
作为第一方面的一种可能的实现方式,控制模块,还用于在热键类型为加解锁热键时,更改锁状态,锁状态为加锁状态或未加锁状态,在加锁状态下控制模块不执行 切换,在未加锁状态下控制模块能够在热键类型为切换热键时执行切换。由此,通过1个加解锁热键即可实现多处理器系统中串口的加解锁,可有效节省单板端口资源,提升多处理器系统的调试、维护、故障恢复等操作的便捷度。
作为第一方面的一种可能的实现方式,切换逻辑单元还包括:空闲检测模块,用于对第三数据选择器的数据输出端进行空闲检测;控制模块,具体用于在热键类型为切换热键且空闲检测模块的空闲检测结果为空闲时,执行切换;或者,具体用于在热键类型为加解锁热键且空闲检测模块的空闲检测结果为空闲时,更改锁状态。由此,可以达到非空闲不切换的目的,进而避免在串口忙或输出异常等情况下执行切换而产生乱码。
作为第一方面的一种可能的实现方式,控制模块,还用于执行超时控制,超时控制包括如下之一:在切换执行前,空闲检测模块的空闲检测结果为空闲检测超时,停止执行切换;在切换的执行过程中,空闲检测模块的空闲检测结果为空闲检测超时,控制第一数据选择器、第二数据选择器和第三数据选择器回退到切换前的状态;在更改锁状态执行前,空闲检测模块的空闲检测结果为空闲检测超时,停止更改锁状态。
由此,可通过引入超时机制,避免因执行时间过长而造成用户误判或误操作,可提升串口操作的有效性,改善用户体验。
作为第一方面的一种可能的实现方式,切换逻辑单元还包括:提示模块,连接第一数据选择器的第二数据输入端,用于在控制模块的控制下输出对应热键类型的提示信息给第一数据选择器;控制模块,还用于控制第一数据选择器选通提示模块,以使提示信息经第一数据选择器和对外接口被送至外部设备。
由此,可在串口操作过程中实时向用户反馈串口操作相关的信息,方便用户清楚、直观地了解串口的操作过程、操作结果,从而进一步避免误判和误操作。
作为第一方面的一种可能的实现方式,控制模块,具体用于:在输出提示信息前,控制第一数据选择器选通提示模块,控制第三数据选择器选通下一处理器的输出串口;在输出提示信息后,控制第一数据选择器选通第三数据选择器,控制第二数据选择器选通下一处理器的输入串口,以使N个处理器中下一处理器的输出串口和输入串口均与对外接口连通。
由此,可在切换的执行过程中及时向用户反馈切换相关的信息。
作为第一方面的一种可能的实现方式,串口切换装置还包括电平转换器件,连接在切换逻辑单元与对外接口之间。由此,可实现对外接口与处理器串口之间的电平信号转换,满足标准接口的电平要求。
本申请第二方面提供了一种串口切换方法,应用于计算设备,计算设备具有对外接口且包括G个处理器;
串口切换方法通过串口切换装置实现,串口切换装置包括一个或多个切换逻辑单元,切换逻辑单元连接在对外接口与计算设备中N个处理器的串口之间,切换逻辑单元包括:第一数据选择器、第二数据选择器、第三数据选择器,第一数据选择器的数据输出端连接对外接口且第一数据输入端连接第三数据选择器的数据输出端,第二数据选择器的数据输入端连接对外接口且N个数据输出端与N个处理器的输入串口一一对应连接,第三数据选择器的数据输出端连接第一数据选择器的一数据输入端且N 个数据输入端与N个处理器的输出串口一一对应连接;
串口切换方法,包括:
根据对外接口的输入字符进行热键检测,以确定输入字符对应的热键类型;
在热键类型为切换热键时,执行切换,切换包括:控制第一数据选择器和第三数据选择器以使N个处理器中下一处理器的输出串口与对外接口连通,以及控制第二数据选择器以使下一处理器的输入串口与对外接口连通;
其中,G为大于或等于2的整数,N为小于或等于G的整数。
作为第二方面的一种可能的实现方式,串口切换方法还包括:在热键类型为加解锁热键时,更改锁状态,锁状态为加锁状态或未加锁状态,在加锁状态下控制模块不执行切换,在未加锁状态下控制模块能够在热键类型为切换热键时执行切换。
作为第二方面的一种可能的实现方式,串口切换方法还包括:对第三数据选择器的数据输出端进行空闲检测;
在热键类型为切换热键时,执行切换,包括:在热键类型为切换热键且空闲检测的检测结果为空闲时,执行切换;或者,
在热键类型为加解锁热键时,更改锁状态,包括:在热键类型为加解锁热键且空闲检测模块的空闲检测结果为空闲时,更改锁状态。
作为第二方面的一种可能的实现方式,串口切换方法还包括:执行超时控制,超时控制包括如下之一:
在切换执行前,空闲检测结果为空闲检测超时,停止执行切换;
在切换的执行过程中,空闲检测结果为空闲检测超时,控制第一数据选择器、第二数据选择器和第三数据选择器回退到切换前的状态;
在更改锁状态执行前,空闲检测结果为空闲检测超时,停止更改锁状态。
作为第二方面的一种可能的实现方式,串口切换装置还包括:提示模块,提示模块连接第一数据选择器的第二数据输入端;串口切换方法还包括:控制第一数据选择器选通提示模块,以使提示信息经第一数据选择器和对外接口被送至外部设备。
作为第二方面的一种可能的实现方式,控制第一数据选择器和第三数据选择器以使N个处理器中下一处理器的输出串口与对外接口连通,包括:在输出提示信息前,控制第一数据选择器选通提示模块,控制第三数据选择器选通下一处理器的输出串口;在输出提示信息后,控制第一数据选择器选通第三数据选择器,以使N个处理器中下一处理器的输出串口与对外接口连通;控制第二数据选择器以使下一处理器的输入串口与对外接口连通,包括:在输出提示信息后,控制第二数据选择器选通下一处理器的输入串口,以使下一处理器的输入串口与对外接口连通。
本申请第三方面提供了一种电子设备,包括:处理器和接口电路,处理器通过接口电路访问存储器,存储器存储有程序指令,程序指令当被处理器执行时使得上述的串口切换方法。
本申请第四方面提供了一种电子设备,包括处理器和存储器,存储器存储有程序指令,程序指令当被处理器执行时使得处理器执行上述的串口切换方法。
作为第四方面的一种可能的实现方式,处理器为CPLD。因CPLD内部集成有ROM且成本较低,资源合适不浪费,由此,可进一步降低成本。
本申请第五方面提供了一种计算机可读存储介质,其上存储有程序指令,程序指令当被计算机执行时使得计算机执行上述的串口切换方法。
本申请第六方面提供了一种计算机程序产品,其包括计算机程序,计算机程序在被处理器运行时使得该处理器执行上述第二方面的串口切换方法。
本申请第七方面提供了一种计算设备,计算设备包括多个处理器,计算设备还包括上述的串口切换装置、上述任一电子设备或者上述的计算机可读存储介质。
本申请第八方面提供了一种框式系统,包括上述的串口切换装置、任一项电子设备、计算机可读存储介质或者上述的计算设备。
本申请第九方面提供了一种车载系统,包括上述的串口切换装置、任一项电子设备、计算机可读存储介质或者计算设备。
本申请第十方面提供了一种车辆,包括上述的串口切换装置、任一项电子设备、计算机可读存储介质、计算设备或者车载系统。
本申请实施例,串口切换装置中包含了第二数据选择器和第三数据选择器,第三数据选择器连接在多个处理器输出串口与对外接口之间,第二数据选择器连接在该多个处理器输入串口与对外接口之间,响应于对应切换热键的输入字符控制第三数据选择器选通一处理器的输出串口、第二数据选择器选通该处理器的输入串口,从而通过1个热键实现多个处理器之间的串口切换功能,有效降低了串口切换的逻辑复杂度、简化串口切换的用户操作,由此,通过1个对外接口便可实现多处理系统的调试、维护、故障恢复等操作,可有效节省单板端口资源,提升单板调测的便捷度。同时,本申请实施例还具有易于实现、成本低、提升用户体验的优点。
本申请的这些和其它方面在以下(多个)实施例的描述中会更加简明易懂。
附图说明
以下参照附图来进一步说明本申请的各个特征和各个特征之间的联系。附图均为示例性的,一些特征并不以实际比例示出,并且一些附图中可能省略了本申请所涉及领域的惯常的且对于本申请非必要的特征,或是额外示出了对于本申请非必要的特征,附图所示的各个特征的组合并不用以限制本申请。另外,在本说明书全文中,相同的附图标记所指代的内容也是相同的。具体的附图说明如下:
图1是本申请实施例提供的串口切换装置的结构及连接示意图。
图2是本申请实施例提供的串口切换装置的结构示意图。
图3是本申请实施例提供的串口切换方法的流程示意图。
图4是本申请实施例串口切换方法的示例性具体实现流程图。
图5是本申请实施例提供的电子设备的结构示意图。
图6是本申请实施例提供的计算设备的结构示意图。
图7是一智能驾驶控制器的结构示意图。
图8是本申请实施例提供的智能驾驶控制器的结构示意图。
图9是本申请实施例提供的框式系统的结构示意图。
具体实施方式
本申请实施例涉及的重要名词及相关术语解释如下:
控制台(Console)口,也可称为管理端口或维护段,即设备的控制台接入端口,用于用户通过终端或仿真终端(例如,串口服务程序)对设备进行初始配置和后续管理。Console口通常为RJ45接口,也可以是DB9接口或DB25接口,其遵从串行数据接口标准(RS232)协议。
下面对串口切换的可能实现方式做简要分析。
目前,串口切换方案主要存在如下两种可能的实现方式:
1)基于内部控制器的串口切换方案:通过网络或者串口登录控制器后输入切换指令,使用控制器控制切换开关实施切换。该实现方式的缺点是操作繁琐,并且用户无法直观了解切换结果。
2)基于外部串口的串口切换方案:以热键或者帧格式输入到复杂可编程逻辑器件(Complex Programmable Logic Device,CPLD),CPLD解析出串口数据,比对后确认为切换热键或切换帧,再切换到对应串口。该实现方式的缺点包括:①串口数量多时,热键不够用;②可能与某些串口工具的热键冲突;③切换帧与正常使用场景需要重复切换,串口切换的逻辑复杂度较高;④切换结果无反馈,当有多个相同类型的操作系统时,无法区分当前串口对应的处理器。
此外,上述两种串口切换方案均属于硬切换,均可能出现串口乱码的情况。
鉴于此,本申请实施例提供了一种新的串口切换装置、方法、设备、存储介质、系统和车辆,使用1个热键即可实现多个处理器之间的串口切换,通过1个对外接口即可实现多处理器系统的调试、维护、故障恢复等操作。
需要说明的是,本申请实施例所述的对外接口,是指用于连接外部设备的接口,该对外接口可以是各种可适用的类型。例如,对外接口可以是但不限于调试接口、维护接口等,例如,本文提到的Console口。
图1和图2示出了本申请实施例提供的串口切换装置100的结构及连接示意图。本申请实施例提供的串口切换装置100可应用于计算设备,计算设备具有一个或多个对外接口且可包括G个处理器,每个处理器具有串口,串口可包括输入串口和输出串口。G为大于或等于2的整数,G表示计算设备中处理器的总数。
如图1所示,串口切换装置100可以包括一个或多个切换逻辑单元110,一切换逻辑单元110负责同一对外接口对应的多个处理器的串口切换。
若计算设备具有一个对外接口或仅一对外接口需连接多个处理器,串口切换装置100中可仅设置一个切换逻辑单元110,该切换逻辑单元110连接在该对外接口与对应该对外接口的多个处理器之间。
若计算设备具有两个或更多的对外接口且两个或两个以上的对外接口均对应多个处理器,串口切换装置100中可设置两个或两个以上的切换逻辑单元110,每一切换逻辑单元110连接在一对外接口与对应该对外接口的多个处理器之间。
假设某个对外接口为计算设备中N个处理器的调测接口,对应该对外接口的切换逻辑单元110可以连接在该对外接口与该N个处理器之间,该切换逻辑单元110用于实现该N个处理器的串口切换,N表示对应该切换逻辑单元110的处理器总数,N为小于或等于G的整数,N是大于或等于2的整数。
以图1为例,计算设备可具有两个对外接口,分别为对外接口1和对外接口2,计算设备中包括G(G=N+K)个处理器CPU 0-CPU N+K。对外接口1对应前N个处理器CPU 0-CPU N,对外接口2对应后K个处理器CPU N+1-CPU N+K,N为大于或等于2的整数,K为大于或等于2的整数。相应地,串口切换装置100中可以包含两个切换逻辑单元110,一个切换逻辑单元110连接在对外接口1与处理器CPU 0-CPU N之间,负责前N个处理器CPU 0-CPU N的串口切换,另一个切换逻辑单元110连接在对外接口2与处理器CPU N+1-CPU N+K之间,负责后K个处理器CPU N+1-CPU N+K的串口切换。
如图2所示,切换逻辑单元110可以包括:第一数据选择器(Multiplexer,MUX)111、第二数据选择器112、第三数据选择器113、热键检测模块114和控制模块115。
以负责N个处理器CPU 0-CPU N的串口切换为例,切换逻辑单元110中各部分关系如下:
第一数据选择器111具有一控制端、两个数据输入端和一数据输出端,控制端连接控制模块115,数据输出端连接对外接口,两个数据输入端中的第一数据输入端连接第三数据选择器113的数据输出端;
第二数据选择器112具有一控制端、一数据输入端和至少N个数据输出端,控制端连接控制模块115,N个数据输出端与N个处理器中的输入串口一一对应连接,数据输入端连接对外接口。
第三数据选择器113具有一控制端、一数据输出端和至少N个数据输入端,控制端连接控制模块115,数据输出端连接第一数据选择器111的第一数据输入端,N个数据输入端与N个处理器中的输出串口一一对应连接。
热键检测模块114的输入端连接对外接口、输出端连接控制模块115。
控制模块115分别连接热键检测模块114、第一数据选择器111的控制端、第二数据选择器112的控制端和第三数据选择器113的控制端。
一些实施例中,热键检测模块114可用于根据对外接口的输入字符进行热键检测,以确定输入字符对应的热键类型。在确定输入字符对应的热键类型之后,热键检测模块114可将该热键类型的信息提供给控制模块115,以便控制模块115根据热键类型执行相应的串口操作。
这里,热键类型可以包括但不限于切换热键、加解锁热键。相应地,串口操作可以包括但不限于切换、加解锁。具体应用中,可以根据应用场景的不同、实际测试的需求定义其他的热键类型,对于热键类型的具体定义,本申请实施例不做限制。
一些实施例中,控制模块115可用于在热键类型为切换热键时,执行切换,该切换可以包括:控制第一数据选择器111和第三数据选择器113以使N个处理器中下一处理器的输出串口与对外接口连通,以及控制第二数据选择器112以使下一处理器的输入串口与所述对外接口连通,从而实现N个处理器中当前处理器到下一处理器的串口切换。由此,本申请实施例通过1个切换热键即可实现多个处理器(例如,N个处理器CPU 0-CPU N)之间串口的顺序滚动切换。
一些实施例中,控制模块115还可用于在热键类型为加解锁热键时,更改锁状态。这里,锁状态可以为加锁状态或未加锁状态,在加锁状态下控制模块115不执行切换,在未加锁状态下控制模块115能够在热键类型为切换热键时执行切换。由此,通过1 个加解锁热键即可实现处理器输出串口的加解锁。
具体地,更改锁状态可以包括:控制模块115在热键类型为加解锁热键时,将当前的加锁状态更改为未加锁状态,或者将当前的未加锁状态更改为加锁状态。也即,若控制模块115当前为加锁状态,响应于对应加解锁热键的输入字符,控制模块115会将锁状态更新为“未加锁”;若控制模块115当前为未加锁状态,响应于对应加解锁热键的输入字符,控制模块115会将锁状态更新为“加锁”。
一些实施例中,切换逻辑单元110还可包括提示模块116。参见图2所示,提示模块116的一端连接第一数据选择器111的第二数据输入端,提示模块116的另一端连接控制模块115。一些实施例中,提示模块116可用于在控制模块115的控制下输出对应热键类型的提示信息给第一数据选择器111。控制模块115还可用于控制第一数据选择器111选通提示模块116,以使提示信息经第一数据选择器111和对外接口被送至外部设备(例如,调测设备),以便外部设备向用户显示该提示信息,从而方便用户清楚、直观地了解串口的操作过程、操作结果等信息。
这里,提示信息可以为对应热键类型的预置信息。具体应用中,可针对不同的热键类型分别配置相应的提示信息。
例如,针对切换热键,可以预先配置切换提示信息。在热键类型为切换热键时,控制模块115可控制提示模块116输出切换提示信息,该切换提示信息可指示本次操作将切换至哪个处理器的串口,切换提示信息中可包含该处理器的标识等内容。
再例如,针对加解锁热键,可以预先配置锁提示信息。在热键类型为加解锁热键时,控制模块115可控制提示模块116输出锁提示信息,该锁提示信息可指示本次操作将对哪个处理器的串口进行加锁或解锁,锁提示信息中可包含处理器的标识、加解锁动作指示等内容。
需要说明的是,对于提示信息的格式、形式、内容等,本申请实施例均不做限制。
一些实施例中,控制模块115具体可用于:在输出提示信息前,控制第一数据选择器111选通提示模块116,控制第三数据选择器113选通下一处理器的输出串口;在输出提示信息后,控制第一数据选择器111选通第三数据选择器113,控制第二数据选择器112选通下一处理器的输入串口,以使N个处理器中下一处理器的输出串口和输入串口均与对外接口连通。由此,通过1个切换热键即可在多个处理器的串口之间进行切换,同时在切换过程中输出提示信息,方便用户及时准确地了解串口切换的相关信息,进而有效避免用户误操作或误判。
一些实施例中,切换逻辑单元110还可包括空闲检测模块117。参见图2所示,空闲检测模块117的输入端连接第三数据选择器113的数据输出端,空闲检测模块117的输出端连接控制模块115。
一些实施例中,空闲检测模块117可用于对第三数据选择器113的数据输出端进行空闲检测。具体应用中,空闲检测模块117可以通过各种可适用的方式实现空闲检测。例如,空闲检测模块117可对第三数据选择器113的数据输出端进行空闲检测,若第三数据选择器113输出的数据连续2个字符均为高电平,可判定第三数据选择器113的数据输出端空闲,也即第三数据选择器113当前选通的处理器的输出串口空闲,向控制模块115输出表示空闲的空闲检测结果,若预定时长内均不存在连续2个字符 为高电平的情况,则视为空闲检测超时,可判定第三数据选择器113的数据输出端忙或输出异常,也即第三数据选择器113当前选通的处理器的输出串口忙或异常,向控制模块115输出表示非空闲的空闲检测结果。由此,控制模块115便可根据第三数据选择器113数据输出端的空闲状态执行热键的对应动作,从而避免出现乱码。
一些实施例中,控制模块115具体可用于在热键类型为切换热键且空闲检测模块117的空闲检测结果为空闲时,执行前述的切换。由此,可在确认空闲之后再切换至目标处理器的串口,以避免出现乱码。
一些实施例中,控制模块115具体可用于在热键类型为加解锁热键且空闲检测模块117的空闲检测结果为空闲时,更改锁状态。由此,可在确认空闲之后再进行加解锁,避免出现乱码。
一些实施例中,控制模块115还可用于执行超时控制,该超时控制可以包括如下之一:1)在切换执行前,空闲检测模块117的空闲检测结果为空闲检测超时,停止执行切换;2)在切换的执行过程中,空闲检测模块117的空闲检测结果为空闲检测超时,控制第一数据选择器111、第二数据选择器112和第三数据选择器113回退到切换前的状态;3)在更改锁状态执行前,空闲检测模块117的检测结果为空闲检测超时,停止执行锁状态的更改。
具体地,切换执行过程中,控制模块115还可用于在空闲检测模块117的空闲检测结果为空闲检测超时时,控制第三数据选择器113选通当前处理器的输出串口和控制第二数据选择器112选通当前处理器的输入串口。由此,不仅可在目标处理器忙或输出异常等情况下回退到当前处理器,同时还可实现串口切换的超时控制,避免切换执行过程耗时过长。
具体地,切换执行前,控制模块115还可用于在空闲检测模块117的空闲检测结果为空闲检测超时时,确认切换失败,不执行切换动作。由此,可实现串口切换的超时控制,避免切换执行过程耗时过长而造成误操作。
具体地,更改锁状态前,控制模块115还可用于在空闲检测模块117的空闲检测结果为空闲检测超时时,确认加解锁失败,不执行锁状态的更改动作。由此,可实现串口加解锁的超时控制,避免加解锁执行过程耗时过长而造成误操作。
因串口操作(例如,切换或加解锁等)执行时间过长会使操作人员误判,继而导致错误的操作结果(例如,切换到错误的处理器上或者针对错误的处理器执行了加解锁)。例如,切换执行时间过长,操作人员可能会认为切换失败而继续输入切换热键,从而导致切换到了错误的处理器串口上。鉴于此,本申请实施例引入了上述的超时控制机制,以有效避免此类情况的发生,提升串口操作的有效性,简化用户操作,改善用户体验。
一些实施例中,串口切换装置100中还可以包括电平转换器件,电平转换器件连接在切换逻辑单元110与对外接口之间,用于实现对外接口与处理器串口之间的电平信号转换。例如,参见图1和图2所示,电平转换器件可以为但不限于RS232电平转换器件120,可用于实现诸如LVCMOS、LVTTL等电平信号与RS232电平信号之间的转换,以满足标准控制台通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)接口的电平要求。
本申请实施例的串口切换装置100可应用各类计算设备中。一些实施例中,串口切换装置100可部署在多处理器的单板机上,实现该单板机中多个处理器之间的串口切换功能,不仅可节省单板维护和调试所需的外置接口资源,而且还具有易于实现、操作简单、成本低、用户体验良好等优点。
图3示出了本申请实施例提供的串口切换方法的流程示意图,该串口切换方法通过上述的串口切换装置100实现。仍以前文N个处理器CPU 0-CPU N的串口切换为例,参见图3所示,本申请实施例提供的串口切换方法可以包括:
步骤S310,根据对外接口的输入字符进行热键检测,以确定输入字符对应的热键类型;
步骤S320,在热键类型为切换热键时,执行切换,所述切换包括:控制第一数据选择器111和第三数据选择器113以使N个处理器中下一处理器的输出串口与所述对外接口连通,以及控制第二数据选择器112以使下一处理器的输入串口与对外接口连通。
一些实施例中,步骤S320中还可包括:在热键类型为加解锁热键时,更改锁状态,锁状态为加锁状态或未加锁状态,在加锁状态下控制模块115不执行切换,在未加锁状态下控制模块115能够在热键类型为切换热键时执行切换。
一些实施例中,步骤S320中还可包括:控制第一数据选择器选通提示模块,以使提示信息经第一数据选择器和所述对外接口被送至外部设备。
一些实施例中,步骤S320中的切换具体可包括:在输出提示信息前,控制第一数据选择器选通提示模块,控制第三数据选择器选通下一处理器的输出串口;在输出提示信息后,控制第一数据选择器选通所述第三数据选择器,控制第二数据选择器选通下一处理器的输入串口,如此,可使N个处理器中下一处理器的输入串口和输出串口均与对外接口连通。
一些实施例中,步骤S320中还可包括:对第三数据选择器的数据输出端进行空闲检测。
一种实现方式中,步骤S320中,在热键类型为切换热键且所述空闲检测的检测结果为空闲时,执行切换。
一种实现方式中,步骤S320中,在热键类型为加解锁热键且空闲检测模块的空闲检测结果为空闲时,更改锁状态。
一些实施例中,上述串口切换方法还可包括:执行超时控制,该超时控制可以包括如下之一:1)在切换执行前,空闲检测结果为空闲检测超时,停止执行切换;2)在切换的执行过程中,空闲检测结果为空闲检测超时,控制第一数据选择器111、第二数据选择器112和第三数据选择器113回退到切换前的状态;3)在更改锁状态执行前,空闲检测结果为空闲检测超时,停止执行锁状态的更改。
下面对本申请实施例串口切换方法的示例性具体实现方式进行说明。
串口切换之前,单板上各个CPU的调试串口分别连接到串口切换装置的切换逻辑单元上,单板上的Console口经过电平转换器件连接串口切换装置中的切换逻辑单元。
如图4所示,多处理器单板机的串口切换示例性实现流程可以包括如下步骤:
步骤S401,上电之后默认CPU M(0≤M<N)与面板Console连接,调测设备的COM口连接单板机的Console口,用户通过调测设备上装载的串口服务程序向Console口输入字符,流程开始;
这里,串口服务程序可以是安装在调测设备的可视化串口服务程序,也可称为“串行交互软件”,如Windows自带的超级终端。
步骤S402,监听到Console口的输入字符,对输入字符进行逐字节检测以判断热键是否匹配,热键匹配时启动相应的热键功能(即,切换串口或者加解锁串口),继续步骤S430,热键不匹配时返回步骤S401。
例如,ASCII码0x1c对应热键“Ctrl+]”,热键“Ctrl+]”为预先约定的顺序切换串口热键,ASCII码0x1d对应热键“Ctrl+\”,热键“Ctrl+\”为预先约定的加解锁热键。若Console口的输入字符是“0x1c”则切换热键匹配,若Console口的输入字符是“0x1d”,则加解锁热键匹配,若Console口的输入字符既不是“0x1c”、也不是“0x1d”,则热键不匹配。
步骤S403,对第三数据选择器113的数据输出端进行空闲检测,空闲时继续步骤S405,否则继续步骤S404。
本步骤中,在未超出预定时长的情况下,可持续进行空闲检测。
步骤S404,进行超时控制,并跳转至步骤S412。
具体地,超时控制可包括如下之一:
1)切换前(即,切换提示信息输出之前),当前选通的CPU为CPU M,空闲检测超时后则确认为切换失败,不执行切换动作。
2)切换过程中(即,切换提示信息输出之后),当前选通的CPU为CPU X,空闲检测超时后则确认为切换失败,回退到CPU M
3)加解锁前(即,锁提示信息输出之前),当前选通的CPU为CPU M,空闲检测超时后则确认为加解锁失败,不执行锁状态的更改动作。
4)加解锁过程中(即,锁提示信息输出之后),当前选通的CPU为CPU M,空闲检测超时后则确认为加解锁失败,不执行锁状态的更改动作。
这里,空闲检测超时是指空闲检测的执行时间超出了预定时长,也即在该预定时长内第三数据选择器113的数据输出端持续处于忙或者输出异常的状态,第三数据选择器113的数据输出端的状态即为第三数据选择器113当前选通的CPU输出串口的状态。通常,在串口切换或加解锁的过程中,一旦确认热键匹配即持续进行空闲检测,直到串口切换结束或加解锁结束。超时控制与空闲检测可同步进行,直至串口切换结束或加解锁结束。
具体应用中,可以通过设置检测窗口来配置空闲检测的预定时长,预定时长的具体取值可根据应用场景的需求自由设定。对于预定时长的配置方式、具体取值,本申请实施例不做限制。
步骤S405,判断热键类型是切换还是加解锁,若是切换,继续步骤S406~步骤S408的串口切换流程,若热键的功能是加解锁,则继续步骤S409~411的加解锁流程。
步骤S406,输出切换提示信息之前,控制模块115控制第一数据选择器MUX111切换到第二数据输入端,使得提示模块116的输出端口选通至Console口,以便提示 模块116输出提示信息;同时,控制模块115控制第三数据选择器MUX113切换至第X数据输入端,使得CPU X输出串口选通至第一数据选择器MUX111的第一数据输入端,进入步骤S407,同时持续执行步骤S403,以检测第三数据选择器MUX113的数据输出端是否空闲,也即检测CPU X输出串口是否空闲;
其中,X=[(M+1)mode N],“mode N”表示取余操作,通过取余操作可以避免溢出切换到空串口上,CPU X是CPU M的下一个CPU,M、X为大于或等于1的整数,X为大于或等于2的整数,N为大于或等于2的整数,N表示执行本流程的切换逻辑单元110所连接的处理器数量,M表示当前处理器的标识(例如,编号),X为下一处理器的标识(例如,编号)。
具体应用中,切换逻辑单元110所连接的处理器的标识可以预先配置。一些实现方式中,可以预先在控制模块115中配置与切换逻辑单元110一一对应的处理器标识序列,处理器标识序列中可以包括切换逻辑单元110所连接的所有处理器的标识且这些标识按照预先顺序进行排列,执行切换时,控制模块115可以根据当前处理器的标识与该处理器标识序列确定下一处理器(即切换的目标处理器)的标识,进而针对该下一处理器执行切换。
步骤S407,提示模块116输出切换提示信息“SWITCH TO CPU X”,切换提示信息先后经MUX111、Console口输出到调测设备,调测设备显示该切换提示信息,以便用户直观清晰地获知切换的目标处理器。
步骤S408,输出切换提示信息之后,若CPU X输出串口空闲,控制模块115控制MUX111切换到其第一数据输入端,使得CPU X输出串口选通至Console口;控制模块115控制MUX112切换到其第X数据输入端,使得Console口选通至CPU X输入串口,跳转至步骤S412,结束自CPU M到CPU X的串口切换流程。
步骤S409,输出锁提示信息之前,控制模块115控制MUX111切换到第二数据输入端,使得提示模块116的输出端口选通至Console口,进入步骤S410,同时持续执行步骤S403,以检测第三数据选择器MUX113的数据输出端是否空闲,也即确认CPU X输出串口是否空闲;
步骤S410,提示模块116输出锁提示信息“UNLOCK/LOCK CPU M”,锁提示信息先后经MUX111、Console口输出到调测设备,调测设备显示该锁提示信息。
具体地,输出锁提示信息之前,若锁状态的值为“1”,表明当前处于未加锁状态,输出的锁提示信息内容可以为“LOCK CPU M”,以提示用户即将更改锁状态为加锁状态,即输出将锁定为CPU M输出串口;若锁状态的值为0,表明当前处于加锁状态,输出的锁提示信息内容可以为“UNLOCK CPU M”,以提示用户即将更改锁状态为未加锁状态,即将解除对CPU M输出串口的锁定。
步骤S411,输出切换提示信息之后,若CPU M输出串口空闲,控制模块115更改锁状态,同时控制MUX111切换到其第一数据输入端,使得CPU M输出串口选通至Console口,继续步骤S412,结束CPU M输出串口的加解锁流程。
具体地,若更改之前,锁状态的值为“0”,表明控制模块115处于加锁状态,本步骤则将锁状态的值更改为“1”,如此,控制模块115即被更改为未加锁状态。若更改之前,锁状态的值为“1”,表明控制模块115处于未加锁状态,本步骤将锁 状态的值更改为“0”,如此,控制模块115即被变更为加锁状态。由此,通过加解锁热键可使控制模块115在两种锁状态之间的切换,进而实现了针对当前处理器CPU M输出串口的锁定操作和解除锁定的操作。
步骤S412,结束。
通过上述示例性实现流程可见,本申请实施例的串口切换方法可取得如下效果:第一,通过1个热键便可在多个CPU(例如,CPU 0到CPU N)之间顺序循环滚动切换,通过2个热键即可实现CPU 0到CPU N的串口切换和串口加解锁,可以有效规避调测设备上的串口程序热键冲突,降低串口操作的逻辑复杂度、节省单板的对外接口资源;第二,串口操作过程中可输出提示信息,便于用户方便、直观地了解串口操作的过程和结果;第三,非空闲不切换,可避免因串口切换而产生乱码。第四,引入超时控制,以免串口操作执行时间过长而导致用户误操作,进而提升串口操作的有效性和用户体验。第五,目标处理器(例如CPU X)异常时,可以回退到切换前的处理器(例如,CPU M),可进一步提升串口操作的有效性和用户体验。
图5是本申请实施例提供的一种电子设备500的结构性示意性图。该电子设备500包括:处理器510和存储器520。
其中,处理器510可以与存储器520连接。存储器520可以用于存储该程序代码和数据。因此,存储器520可以是处理器510内部的存储单元,也可以是与处理器510独立的外部存储单元,还可以是包括处理器510内部的存储单元和与处理器510独立的外部存储单元的部件。
可选地,电子设备500还可包括通信接口530。应理解,图8所示的电子设备500中的通信接口530可以用于与其他设备之间进行通信。
可选的,电子设备500还可以包括总线。其中,存储器520、通信接口530可以通过总线与处理器510连接。为便于表示,图5中仅用一条线表示总线,但并不表示仅有一根总线或一种类型的总线。
应理解,在本申请实施例中,处理器510可以采用中央处理单元(central processing unit,CPU)。该处理器还可以是其它通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate Array,FPGA)、CPLD或者其它可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。或者,处理器510采用一个或多个集成电路,用于执行相关程序,以实现本申请实施例所提供的技术方案。
存储器520可以包括只读存储器和随机存取存储器,并向处理器510提供指令和数据。处理器510的一部分还可以包括非易失性随机存取存储器。例如,处理器510还可以存储设备类型的信息。
在电子设备500运行时,处理器510执行存储器520中的计算机执行指令执行上述氛围灯控制方法的操作步骤。
应理解,根据本申请实施例的电子设备500可以对应于执行根据本申请各实施例的方法中的相应主体,并且电子设备500中的各个模块的上述和其它操作和/或功能分别为了实现本实施例各方法的相应流程,为了简洁,在此不再赘述。
本申请还提供了另一种电子设备,包括处理器和接口电路,处理器通过接口电路访问存储器,存储器存储有程序指令,程序指令当被处理器执行时使得处理器执行上述的串口切换方法。
一些实施例中,因CPLD内部集成有可编程的只读存储器(read-only memory,ROM)且成本相较于其他可编程器件(例如,FPGA)更低,资源合适不浪费,因此,本申请实施例提供的上述电子设备中,处理器可以为CPLD。
本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器运行时使得处理器执行上述的串口切换方法。这里,计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是,但不限于电、磁、光、电磁、红外线、半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器、只读存储器、可擦式可编程只读存储器、光纤、便携式紧凑磁盘只读存储器、光存储器件、磁存储器件或者上述的任意合适的组合。
本申请实施例还提供了一种计算机程序产品,其包括计算机程序,所述计算机程序在被处理器运行时使得该处理器执行上述的串口切换方法。这里,计算机程序产品的程序设计语言可以是一种或多种,该程序设计语言可以包括但不限于诸如Java、C++等面向对象的程序设计语言、诸如“C”语言等的常规过程式程序设计语言。
本申请实施例还提供了一种计算设备,计算设备包括多个处理器,该计算设备还包括上述的串口切换装置100、电子设备、计算机可读存储介质或者计算机程序产品。
图6是本申请实施例提供的一种计算设备600的结构性示意性图。该计算设备600包括:多个处理器610和串口切换装置100。计算设备600具有对外接口,串口切换装置100连接在多个处理器610与对外接口之间。
可选地,计算设备600还可包括存储器620和通信接口630。应理解,计算设备600中还可包括其他组件。
实际应用中,计算设备600可以实现为单板机或芯片中的一个功能单元或模块,还可以实现为独立的芯片或单板机。例如,上述计算设备600可以是单板复杂多处理器系统、车机、座舱域控制器(cockpit domain controller,CDC)、移动数据中心/多域控制器(Mobile Data Center/Multi-Domain Controller,MDC)、用于支撑智能驾驶的软硬件一体化平台即车载计算平台(vehicle computing platform,VPC)中的一个功能单元/模块。需要说明的是,本申请实施例对计算设备600的形态和部署方式不做限定。
图7示出了MDC的示例性结构。参见图7所示,MDC包括1个片上系统(System On Chip,SOC)、3个视频处理器、8个人工智能(AI)处理器、1个微控制器(Microcontroller Unit,MCU)以及各种传感器接口,传感器接口包括16个摄像头(Camera)接口、12个GE接口、7个灵活数据传输率控制器局域网(Controller Area Network with Flexible Data-Rate,CAN-FD)接口。
参见图7所示,SOC的8个串行吉比特介质独立接口(Serial Gigabit Media Independent Interface,SGMII)通过8个端口物理层(Physical Level,PHY)元件连 接8个GE接口,SOC的1个SGMII通过以太网交换器件及其4个SGMII、4个端口物理层(Physical Level,PHY)元件连接4个GE接口,SOC的三个PCIe Gen2X2接口连接3个视频处理器,视频处理器1通过视频解串器1连接4个摄像头接口,视频处理器2通过视频解串器2连接4个摄像头接口,视频处理器3通过视频解串器3和视频解串器4连接8个摄像头接口。SOC通过其8个高速串行计算机扩展总线标准(Peripheral Component Interconnect Express,PCIe)Gen2X2接口连接8个AI处理器,8个AI处理器的8个精简吉比特介质独立接口(Reduced Gigabit Media Independent Interface,RGMII)经以太网交换器件及其1个RGMII连接MCU,MCU连接7个CAN-FD接口。MDC中的这些处理器和微控制器,均需要相应串口来实现其安装、调试和故障恢复,但是MDC的对外接口数量只有2个,无法提供更多的串口。
图8示出了包含串口切换装置100的MDC的示例性结构。参见图8所示,该串口切换装置100中包含两个切换逻辑单元110和一个RS232电平转换器件120,一个切换逻辑单元110通过RS232电平转换器件120连接到MDC的一个对外接口Console X1上,该切换逻辑单元110负责微控制器(Microcontroller Unit,MCU)、1个处理器片上系统(System On Chip,SOC)(包含3个处理器)、3个视频处理器之间的串口切换,另一个切换逻辑单元110通过RS232电平转换器件120连接到MDC的另一个对外接口Console X1上,该切换逻辑单元110负责8个AI处理器之间的串口切换。如此,利用串口切换装置100,定义2个热键即可在MDC中各处理器之间进行串口切换和串口加解锁,由此,使用2个对外接口借由串口切换即可实现MDC中所有处理器的安装、调试和故障恢复等操作。
本申请实施例还提供了一种车载系统,该车载系统可以包括串口切换装置100、前文的任一种电子设备、前文的计算机可读存储介质或者前文的计算设备600。
一些实施例中,车载系统可以包括:车载远程信息处理器(telematics box,T-BOX)、中央网关、车身域控制器(Body Control Module,BCM)、集成座舱控制器(Integrated Cockpit Controller,ICC)、高级驾驶辅助系统(Advanced Driving Assistance System,ADAS)和动力底盘域控制器(Power Distribution Control Unit,PDCU)和车载自动诊断系统(On-Board Diagnostic)。
中央网关可通过CAN-FD、ETH与T-BOX连接,ICC、ADAS和PDCU、车载自动诊断系统可分别通过CAN-FD、以太网(Ethernet,ETH)与中央网关连接,BCM可通过CAN-FD与中央网关连接。
本申请实施例中,ADAS中包含串口切换装置100,通过串口切换装置100可以通过少量外部接口来实现ADAS中多个处理器的安装、调试、维护和故障恢复等操作。一些实施例中,ADAS可以实现为图8所示的MDC。
T-BOX可用于接收全球定位系统(global positioning system,GPS)定位信息、和/或提供车内无线保真(WIFI)网络接入、和/或通过长期演进(Long Term Evolution,LTE)接入移动数据网络,是车辆与外界的连接总接口。
中央网关可用于提供CAN和车载以太网的交换,是车内网络的连接中心。
BCM可用于对转向灯、大灯、制动灯、雨刷、车门、安全带卡位等进行控制或状态上报。
ICC可用于接收用户指令,并将信息展现到显示界面;
ADAS可用于接收各种传感器的感知数据,通过复杂计算得出控制车辆动作指令,下发到PDCU以完成自动驾驶动作;
PDCU可负责转向、刹车、加减速等车辆控制动作以及状态的上报。
本申请实施例还提供一种车辆,该车辆可包括:串口切换装置100、上述任一项电子设备、计算设备600、上述的计算机可读存储介质、上述的计算机程序产品或者上述的车载系统。
本申请实施例中的“车辆”可以是但不限于私人汽车、商用汽车、公共汽车、客运车、高铁、地铁、无人车、物流运输车、无人机等,“车辆”的动力类型可以为燃油驱动、纯电动、氢燃料电池驱动、混合动力等。此外,这里的“车辆”可以是人为驾驶的车辆、自动驾驶的车辆、无人驾驶的车辆或其他类型的车辆。本领域技术人员可以理解,任何类似的交通运输工具均可视为本申请实施例的“车辆”。
本申请实施例还提供了一种框式系统,框式系统可以包括串口切换装置100、上述的任一种电子设备、上述的计算机可读存储介质或者上述的计算设备600。
图9示出了本申请实施例框式系统900的示例性结构图。参加图9所示,框式系统900中可以包括H个控制板910、J块业务板920和背板930,H个控制板910和J块业务板920通过背板930互连。
一些实施例中,为了实现框式系统900的串口切换功能,可以在各控制板910中设置串口切换装置100,该串口切换装置100连接在控制板910上的面板Console口与控制板910中P个CPU(即,CPU 0~CPU P)的串口之间。由此,可以实现控制板910内部P个CPU(即,CPU 0~CPU P)之间的串口切换,同时因控制板910与各个业务板920互联,因此还可同时通过控制板910内部的串口切换装置100实现各业务板920中Q个CPU(即,CPU 0~CPU Q)之间的串口切换。这里,P和Q均可以为大于或等于1的整数。
具体地,用户在调测设备上操作切换热键,调测设备向面板Console口输入对应切换热键的字符,响应于该对应切换热键的字符,控制板910中的串口切换装置100将控制板910中的P个CPU(即,CPU 0~CPU P)、以及当前锁定的业务板920中Q个(即,CPU 0~CPU Q)之间进行串口切换。
具体地,用户在调测设备上操作加解锁热键,调测设备向面板Console口输入对应加解锁热键的字符,响应于该对应加解锁热键的字符,控制板910中的串口切换装置100可以锁定或解锁当前CPU的串口,该当前CPU是控制板910中的P个CPU(即,CPU 0~CPU P)和当前锁定的业务板920中Q个(即,CPU 0~CPU Q)中之一。
一些实施例中,还可通过加解锁热键来实现业务板920的锁定或解锁。例如,用户在调测设备上操作加解锁热键,调测设备向面板Console口输入对应加解锁热键的字符,响应于该对应加解锁热键的字符,控制板910中的串口切换装置100可以解锁或锁定当前的业务板920。
一些实施例中,还可通过切换热键实现各个业务板920之间的切换。具体的切换过程与前文串口切换类似,不再赘述。
由上可见,通过控制板910中串口切换装置100,不仅可在框式系统900生产过 程中实现每个控制板910的调试、测试、维护和故障恢复等操作,同时还可实现框式系统900的成品中控制板910和业务板920的调试、测试、维护和故障恢复等操作。由此,通过只需用一个Console口(即面板Console口)即可针对整个框式系统900进行调试、测试、维护和故障恢复等操作,业务板920的面板无需出调试串口,不仅节省了面板的端口资源,提高了维护的便捷度,而且单板结构更加简洁化。
一些实施例中,框式系统900中业务板920中可设置串口切换装置100,该串口切换装置100连接在业务板920上的板内Console口与业务板920内Q个CPU(即,CPU 0~CPU Q)串口之间,由此,可通过串口切换装置100实现业务板920内部Q个CPU(即,CPU 0~CPU Q)之间的串口切换,进而可实现例如框式系统900生产过程或拆卸维护过程等场景下针对某个业务板920的调试、测试、维护和故障恢复等操作。
本申请实施例提供的框式系统900可以实现为交换机、路由器、接入网或其他类似设备。对于框式系统900的具体形态、部署方式等,本申请实施例不做限制。
注意,上述仅为本申请的较佳实施例及所运用的技术原理。本领域技术人员会理解,本申请不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本申请的保护范围。因此,虽然通过以上实施例对本申请进行了较为详细的说明,但是本申请不仅仅限于以上实施例,在不脱离本申请的构思的情况下,还可以包括更多其他等效实施例,均属于本申请的保护范畴。

Claims (21)

  1. 一种串口切换装置,其特征在于,应用于计算设备,所述计算设备具有对外接口且包括G个处理器,所述串口切换装置包括一个或多个切换逻辑单元,所述切换逻辑单元连接在所述对外接口与所述计算设备中N个所述处理器之间,所述切换逻辑单元包括:第一数据选择器、第二数据选择器、第三数据选择器、热键检测模块和控制模块;
    所述第一数据选择器中,控制端连接所述控制模块,数据输出端连接所述对外接口,第一数据输入端连接所述第三数据选择器的数据输出端;
    所述第二数据选择器中,控制端连接所述控制模块,数据输入端连接所述对外接口,N个数据输出端与N个所述处理器的输入串口一一对应连接;
    所述第三数据选择器中,控制端连接所述控制模块,数据输出端连接所述第一数据选择器的一数据输入端,N个数据输入端与N个所述处理器的输出串口一一对应连接;
    所述热键检测模块,用于根据所述对外接口的输入字符进行热键检测,以确定所述输入字符对应的热键类型;
    所述控制模块,用于在所述热键类型为切换热键时,执行切换;所述切换包括:控制所述第一数据选择器和所述第三数据选择器以使N个所述处理器中下一处理器的输出串口与所述对外接口连通,以及控制所述第二数据选择器以使所述下一处理器的输入串口与所述对外接口连通;
    其中,G为大于或等于2的整数,N为小于或等于G的整数。
  2. 根据权利要求1所述的装置,其特征在于,所述控制模块,还用于在所述热键类型为加解锁热键时,更改锁状态,所述锁状态为加锁状态或未加锁状态,在所述加锁状态下所述控制模块不执行所述切换,在所述未加锁状态下所述控制模块能够在所述热键类型为切换热键时执行所述切换。
  3. 根据权利要求1或2所述的装置,其特征在于,
    所述切换逻辑单元还包括:空闲检测模块,用于对所述第三数据选择器的数据输出端进行空闲检测;
    所述控制模块,具体用于在所述热键类型为切换热键且所述空闲检测模块的空闲检测结果为空闲时,执行所述切换;或者,具体用于在所述热键类型为加解锁热键且所述空闲检测模块的空闲检测结果为空闲时,更改所述锁状态。
  4. 根据权利要求3所述的装置,其特征在于,所述控制模块,还用于执行超时控制,所述超时控制包括如下之一:
    在所述切换执行前,所述空闲检测模块的空闲检测结果为空闲检测超时,停止执行所述切换;
    在所述切换的执行过程中,所述空闲检测模块的空闲检测结果为空闲检测超时, 控制所述第一数据选择器、所述第二数据选择器和所述第三数据选择器回退到所述切换前的状态;
    在更改所述锁状态执行前,所述空闲检测模块的空闲检测结果为空闲检测超时,停止更改所述锁状态。
  5. 根据权利要求1-4任一项所述的装置,其特征在于,
    所述切换逻辑单元还包括:提示模块,连接所述第一数据选择器的第二数据输入端,用于在所述控制模块的控制下输出对应所述热键类型的提示信息给所述第一数据选择器;
    所述控制模块,还用于控制所述第一数据选择器选通所述提示模块,以使所述提示信息经所述第一数据选择器和所述对外接口被送至外部设备。
  6. 根据权利要求5所述的装置,其特征在于,所述控制模块,具体用于:
    在输出所述提示信息前,控制所述第一数据选择器选通所述提示模块,控制所述第三数据选择器选通下一处理器的输出串口;
    在输出所述提示信息后,控制所述第一数据选择器选通所述第三数据选择器,控制所述第二数据选择器选通所述下一处理器的输入串口,以使N个所述处理器中下一处理器的输出串口和输入串口均与所述对外接口连通。
  7. 根据权利要求1-6任一项所述的装置,其特征在于,所述串口切换装置还包括电平转换器件,连接在所述切换逻辑单元与所述对外接口之间。
  8. 一种串口切换方法,其特征在于,应用于计算设备,所述计算设备具有对外接口且包括G个处理器;
    所述方法通过串口切换装置实现,所述串口切换装置包括一个或多个切换逻辑单元,所述切换逻辑单元连接在所述对外接口与所述计算设备中N个所述处理器的串口之间,所述切换逻辑单元包括:第一数据选择器、第二数据选择器、第三数据选择器,所述第一数据选择器的数据输出端连接所述对外接口且第一数据输入端连接第三数据选择器的数据输出端,所述第二数据选择器的数据输入端连接所述对外接口且N个数据输出端与N个所述处理器的输入串口一一对应连接,所述第三数据选择器的数据输出端连接所述第一数据选择器的一数据输入端且N个数据输入端与N个所述处理器的输出串口一一对应连接;
    所述串口切换方法,包括:
    根据所述对外接口的输入字符进行热键检测,以确定所述输入字符对应的热键类型;
    在所述热键类型为切换热键时,执行切换,所述切换包括:控制所述第一数据选择器和所述第三数据选择器以使N个所述处理器中下一处理器的输出串口与所述对外接口连通,以及控制所述第二数据选择器以使所述下一处理器的输入串口与所述对外接口连通;
    其中,G为大于或等于2的整数,N为小于或等于G的整数。
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:
    在所述热键类型为加解锁热键时,更改锁状态,所述锁状态为加锁状态或未加锁状态,在所述加锁状态下所述控制模块不执行所述切换,在所述未加锁状态下所述控制模块能够在所述热键类型为切换热键时执行所述切换。
  10. 根据权利要求8或9所述的方法,其特征在于,
    所述方法还包括:对所述第三数据选择器的数据输出端进行空闲检测;
    在所述热键类型为切换热键时,执行切换,包括:在所述热键类型为切换热键且所述空闲检测的检测结果为空闲时,执行所述切换;或者,
    在所述热键类型为加解锁热键时,更改锁状态,包括:在所述热键类型为加解锁热键且所述空闲检测模块的空闲检测结果为空闲时,更改所述锁状态。
  11. 根据权利要求10所述的方法,其特征在于,所述方法还包括:执行超时控制,所述超时控制包括如下之一:
    在所述切换执行前,所述空闲检测结果为空闲检测超时,停止执行所述切换;
    在所述切换的执行过程中,所述空闲检测结果为空闲检测超时,控制所述第一数据选择器、所述第二数据选择器和所述第三数据选择器回退到所述切换前的状态;
    在更改所述锁状态执行前,所述空闲检测结果为空闲检测超时,停止更改所述锁状态。
  12. 根据权利要求9-11任一项所述的方法,其特征在于,
    所述串口切换装置还包括:提示模块,所述提示模块连接所述第一数据选择器的第二数据输入端;
    所述方法还包括:控制所述第一数据选择器选通所述提示模块,以使所述提示信息经所述第一数据选择器和所述对外接口被送至外部设备。
  13. 根据权利要求12所述的方法,其特征在于,
    所述控制所述第一数据选择器和所述第三数据选择器以使N个所述处理器中下一处理器的输出串口与所述对外接口连通,包括:在输出所述提示信息前,控制所述第一数据选择器选通所述提示模块,控制所述第三数据选择器选通下一处理器的输出串口;在输出所述提示信息后,控制所述第一数据选择器选通所述第三数据选择器,以使N个所述处理器中下一处理器的输出串口与所述对外接口连通;
    所述控制所述第二数据选择器以使所述下一处理器的输入串口与所述对外接口连通,包括:在输出所述提示信息后,控制所述第二数据选择器选通所述下一处理器的输入串口,以使所述下一处理器的输入串口与所述对外接口连通。
  14. 一种电子设备,其特征在于,包括:处理器和接口电路,所述处理器通过所 述接口电路访问存储器,所述存储器存储有程序指令,所述程序指令当被所述处理器执行时使得所述处理器执行权利要求8-13任一项所述的方法。
  15. 一种电子设备,其特征在于,包括处理器和存储器,所述存储器存储有程序指令,所述程序指令当被所述处理器执行时使得所述处理器执行权利要求8-13任一项所述的方法。
  16. 根据权利要求15所述的电子设备,其特征在于,所述处理器为复杂可编程逻辑器件CPLD。
  17. 一种计算机可读存储介质,其上存储有程序指令,其特征在于,所述程序指令当被计算机执行时使得所述计算机执行权利要求8-13任一项所述的方法。
  18. 一种计算设备,其特征在于,所述计算设备包括多个处理器,所述计算设备还包括权利要求1-7任一项所述的串口切换装置、权利要求14-16任一项所述的电子设备或者权利要求17所述的计算机可读存储介质。
  19. 一种框式系统,其特征在于,包括权利要求1-7任一项所述的串口切换装置、权利要求14-16任一项所述的电子设备、权利要求17所述的计算机可读存储介质或者权利要求18所述的计算设备。
  20. 一种车载系统,其特征在于,包括权利要求1-7任一项所述的串口切换装置、权利要求14-16任一项所述的电子设备、权利要求17所述的计算机可读存储介质或者权利要求18所述的计算设备。
  21. 一种车辆,其特征在于,包括权利要求1-7任一项所述的串口切换装置、权利要求14-16任一项所述的电子设备、权利要求17所述的计算机可读存储介质、权利要求18所述的计算设备或者权利要求20所述的车载系统。
PCT/CN2021/130358 2021-11-12 2021-11-12 串口切换装置、方法、设备、存储介质、系统和车辆 WO2023082184A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2021/130358 WO2023082184A1 (zh) 2021-11-12 2021-11-12 串口切换装置、方法、设备、存储介质、系统和车辆
CN202180008562.9A CN116710907A (zh) 2021-11-12 2021-11-12 串口切换装置、方法、设备、存储介质、系统和车辆

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/130358 WO2023082184A1 (zh) 2021-11-12 2021-11-12 串口切换装置、方法、设备、存储介质、系统和车辆

Publications (1)

Publication Number Publication Date
WO2023082184A1 true WO2023082184A1 (zh) 2023-05-19

Family

ID=86334874

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/130358 WO2023082184A1 (zh) 2021-11-12 2021-11-12 串口切换装置、方法、设备、存储介质、系统和车辆

Country Status (2)

Country Link
CN (1) CN116710907A (zh)
WO (1) WO2023082184A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117149694A (zh) * 2023-10-24 2023-12-01 南京芯驰半导体科技有限公司 基于多核异构的接口控制方法、装置及电子设备

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100121996A1 (en) * 2008-11-12 2010-05-13 Schmidt Eric R Automatically switching console connection
CN103455455A (zh) * 2012-05-30 2013-12-18 鸿富锦精密工业(深圳)有限公司 串口切换系统、服务器及串口切换方法
CN105005545A (zh) * 2015-07-28 2015-10-28 武汉烽火网络有限责任公司 线卡串口切换装置及方法
CN109597778A (zh) * 2018-11-02 2019-04-09 山东超越数控电子股份有限公司 一种多路串口信号单接口复用输出系统及其实现方法
CN110597749A (zh) * 2019-08-23 2019-12-20 锐捷网络股份有限公司 串口切换方法及装置
CN112015689A (zh) * 2019-05-29 2020-12-01 阿里巴巴集团控股有限公司 串口输出路径切换方法、系统及装置和交换机
CN213092307U (zh) * 2020-09-04 2021-04-30 深圳市中网信安技术有限公司 一种串口切换装置及电子设备

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100121996A1 (en) * 2008-11-12 2010-05-13 Schmidt Eric R Automatically switching console connection
CN103455455A (zh) * 2012-05-30 2013-12-18 鸿富锦精密工业(深圳)有限公司 串口切换系统、服务器及串口切换方法
CN105005545A (zh) * 2015-07-28 2015-10-28 武汉烽火网络有限责任公司 线卡串口切换装置及方法
CN109597778A (zh) * 2018-11-02 2019-04-09 山东超越数控电子股份有限公司 一种多路串口信号单接口复用输出系统及其实现方法
CN112015689A (zh) * 2019-05-29 2020-12-01 阿里巴巴集团控股有限公司 串口输出路径切换方法、系统及装置和交换机
CN110597749A (zh) * 2019-08-23 2019-12-20 锐捷网络股份有限公司 串口切换方法及装置
CN213092307U (zh) * 2020-09-04 2021-04-30 深圳市中网信安技术有限公司 一种串口切换装置及电子设备

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117149694A (zh) * 2023-10-24 2023-12-01 南京芯驰半导体科技有限公司 基于多核异构的接口控制方法、装置及电子设备
CN117149694B (zh) * 2023-10-24 2024-02-23 南京芯驰半导体科技有限公司 基于多核异构的接口控制方法、装置及电子设备

Also Published As

Publication number Publication date
CN116710907A (zh) 2023-09-05

Similar Documents

Publication Publication Date Title
US11842582B2 (en) Layered electrical architecture for vehicle diagnostics
CN108536121B (zh) 逻辑通道的建立方法、装置和交通工具通信接口vci
US10050864B2 (en) Operation mode transition method in network
CN110971453B (zh) 网络拓扑确定方法、装置、车辆网络拓扑结构及车辆
CN106649180A (zh) 一种解除i2c总线死锁的方法及装置
CN102032927A (zh) 一种检测can总线汽车仪表灵敏度的测试系统及方法
CN213715751U (zh) 一种域控制器
CN110609491B (zh) 电动汽车整车控制器半实物仿真事故鉴定方法及系统
CN105922872A (zh) 车辆控制系统和车辆
WO2023082184A1 (zh) 串口切换装置、方法、设备、存储介质、系统和车辆
CN113406946B (zh) 汽车诊断方法及装置、汽车诊断设备
CN110727264A (zh) 汽车控制系统
CN104683126B (zh) 基于can总线的网络管理方法
CN114089713A (zh) 一种基于uds的通信方法、ecu及上位机
CN105946747A (zh) 车辆中的控制方法和车辆主板
KR20200062594A (ko) 차량용 디버깅 시스템의 동작 방법
CN113347273A (zh) 一种车载以太网数据转换方法、装置、设备及介质
CN112181810B (zh) 一种基于tcn网络的单车智能调试系统
CN103116349A (zh) 调试系统、电子控制单元、信息处理单元、半导体封装以及收发器电路
WO2024021905A1 (zh) 分体式全液晶组合仪表、信息展示方法和车辆
KR102027922B1 (ko) 유무선 게이트웨이(Gateway)를 이용한 클러스터(Cluster) 고장 처리 시스템 및 그 방법
CN117076216A (zh) 通道分配方法及设备
CN115051975A (zh) 一种基于车载以太网的ecu远程升级方法
CN115980554B (zh) 一种芯片测试的方法及其电子设备
KR101039926B1 (ko) 차량용 자기진단 제어 시스템

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 202180008562.9

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21963632

Country of ref document: EP

Kind code of ref document: A1