Multi-bus automatic switching system and method for debugging vehicle-mounted equipment, storage medium and vehicle-mounted equipment
Through the multi-bus automatic switching system, the voltage difference and pulse signals are monitored in real time by using the microcontroller unit and the voltage comparison circuit, the problems of redundant interfaces, cumbersome operation and insufficient detection capabilities in vehicle-mounted equipment debugging are solved, and the automatic precise matching of the bus and the improvement of debugging efficiency are achieved.
Patent Information
- Application Number
- CN202510433867.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-08-01
AI Technical Summary
During the debugging process of existing vehicle equipment, there are problems such as interface redundancy and space limitations, cumbersome operation and poor compatibility, single function and insufficient electrical characteristic detection capabilities, resulting in low debugging efficiency and risk of misjudgment.
The multi-bus automatic switching system is adopted, and the voltage difference and pulse signals are monitored in real time by using microcontroller units, voltage comparison circuits and differential amplifier circuits. The automatic switching of different buses is achieved through analog switches, and the matching is ensured through handshake protocols, reducing user misoperation, and improving debugging efficiency and safety.
It realizes automatic and accurate matching of different buses, reduces hardware resource waste, improves debugging efficiency and security performance, reduces misjudgment rate, and improves system robustness.
Smart Images

Figure CN120407375A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of in-vehicle device debugging, and particularly to a multi-bus automatic switching system, method, storage medium, and in-vehicle device for in-vehicle device debugging. Background Art
[0002] With the rapid development of automotive electronics technology, the functions of in-vehicle devices have become increasingly complex, and their internal bus architectures usually integrate multiple communication protocols (such as CAN bus, LIN bus, FlexRay bus, etc.) and debugging interfaces (such as RS-232, RS-485, etc.).
[0003] During the development, testing, and later maintenance of in-vehicle devices, engineers need to frequently interact with the in-vehicle system through external debugging devices, including error troubleshooting in the development stage, verifying the compatibility of hardware and software, handling complex communication protocols, ensuring real-time performance and security, production testing, on-site fault diagnosis, meeting industry standards, and supporting long-term maintenance and upgrades. In the absence of an external debugging port, it is almost impossible to effectively debug the device and collect effective program operation data. It may be necessary to analyze the device under destructive disassembly, which greatly reduces the efficiency of finding problems and also has a high risk, and is not conducive to mass production.
[0004] Therefore, in the prior art, a debugging port is usually set outside the in-vehicle device, and specific external interfaces need to be independently designed for different bus types (such as CAN bus and RS-232 bus), which easily leads to the following problems: Interface redundancy and space limitation: The in-vehicle device needs to configure a dedicated physical interface for each bus type, or set multiple discretely arranged debugging interfaces to avoid direct attacks on the debugging interface. For example, the utility model patent with the authorization announcement number CN214540747U causes waste of hardware resources in the limited device space, and at the same time increases the complexity and cost of the wiring harness.
[0005] Complicated operation and poor compatibility: During the debugging process, engineers usually need to manually select the corresponding physical interface and switch the cable according to the target bus type. If the interface is selected incorrectly or misconnected, it may lead to communication failure, or even device damage due to level mismatch. In addition, the traditional interface cannot automatically identify the type of external debugging device and relies on manual intervention, significantly reducing the debugging efficiency.
[0006] Functional singularity: Existing interfaces usually only serve a single scenario (such as only for communication) and lack reusability. For example, the debugging interface is idle during non-debugging stages, while the communication interface cannot be compatible with debugging requirements, resulting in low utilization rate of hardware resources.
[0007] In addition, in the prior art, the electrical characteristic detection ability for automatic interface switching is insufficient, lacking the comprehensive analysis ability for dynamic voltage difference and pulse timing, resulting in a relatively high misjudgment rate. Summary of the Invention
[0008] Therefore, to solve the above problems, the present invention provides a multi-bus automatic switching system, method, storage medium and vehicle-mounted device for vehicle-mounted device debugging.
[0009] The present invention is realized through the following technical solutions: A multi-bus automatic switching system for vehicle-mounted device debugging, comprising: A control module, including a microcontroller unit and a first bus, a second bus and an IO port provided on the microcontroller unit, the first bus is connected to a first level conversion module, and the second bus is connected to a second level conversion module; A general-purpose plugging module, including two internal connection ports and two external connection ports for connecting an external debugging device; A voltage comparison circuit for real-time monitoring of voltage pulse data on the current line, including a voltage comparator and a first ADC acquisition module, an input end of the voltage comparator is connected to a first internal connection port of the general-purpose plugging module, an output end of the voltage comparator is connected to an input end of the first ADC acquisition module, and an output end of the first ADC acquisition module is connected to the microcontroller unit; A differential amplification circuit for real-time monitoring of voltage difference data on the current line, including a differential amplifier and a second ADC acquisition module, an input end of the differential amplifier is connected to a second internal connection port of the general-purpose plugging module, an output end of the differential amplifier is connected to an input end of the second ADC acquisition module, and an output end of the second ADC acquisition module is connected to the microcontroller unit; An analog switch is respectively connected to the first level conversion module, the second level conversion module, the IO port, and the first internal connection port and the second internal connection port of the general-purpose plugging module; the microcontroller unit controls the analog switch to access or disconnect the first level conversion module and the second level conversion module through the IO port, so that the external debugging device can be selectively connected to the first bus or the second bus.
[0010] Preferably, the first bus is a CAN bus, the second bus is an RS-232 bus, the first level conversion module is a CAN level conversion module, and the second level conversion module is an RS-232 level conversion module.
[0011] A multi-bus automatic switching method for vehicle-mounted device debugging, applied to the multi-bus automatic switching system for vehicle-mounted device debugging as described above, comprising the following steps: S1: Connect the external debugging device to the two external connection ports of the general-purpose plugging module; S2: Preset a timeout judgment time, and continuously collect the voltage pulse signal and voltage difference signal of the external debugging device within the timeout judgment time, and judge the interface type of the external debugging device according to the obtained electrical signals; S21: Preset a timeout judgment time; S22: Continuously collect the voltage pulses of the first internal connection port through a voltage comparator, and judge whether the voltage pulse value at each collection point is less than the voltage pulse threshold. Within the timeout judgment time, record the number N of times the voltage pulse value exceeds the voltage pulse threshold through the first ADC acquisition module, and input N into the microcontroller unit; S23: Continuously collect the voltage difference between two ports at its input through a differential amplifier, and input the voltage difference at each sampling point into the microcontroller unit through the second ADC acquisition module, and calculate the average value V of all the voltage differences recorded within the timeout judgment time through the microcontroller unit; S24: The microcontroller unit judges whether the interface of the external debugging device matches the CAN bus or the RS-232 bus according to the number N of times the voltage pulse value exceeds the voltage pulse threshold and the magnitude of the absolute value of the average value V of the voltage values; S3: Automatically connect to the bus matching the current interface type according to the interface type of the external debugging device, and communicate with the external debugging device through a handshake protocol, and debug the vehicle-mounted device after normal communication.
[0012] Preferably, the timeout judgment time is 100 ms, and the voltage pulse threshold is -5 V.
[0013] Preferably, step S24 includes: The microcontroller unit judges whether the number N of times the voltage pulse value exceeds the voltage pulse threshold within the timeout judgment time is 0; If N≠0, then further judge whether N is greater than 20. If so, initially determine that the interface of the external debugging device corresponds to the RS-232 bus. If not, repeat steps S22 - S24; If N = 0, then further judge whether the absolute value of the average value V of all the voltage differences recorded within the timeout judgment time is less than 2. If so, initially judge that the interface of the external debugging device corresponds to the CAN bus; if not, repeat steps S23 - S24.
[0014] Preferably, when initially determining that the interface of the external debugging device corresponds to the RS-232 bus, step S3 includes the following steps: S31: The microcontroller unit initializes the RS-232 bus port; S32: The microcontroller unit controls the analog switch to access the RS-232 level conversion module through the IO port, and maps the RS-232 bus port to the RS-232 bus driver interface layer; S33: The microcontroller unit creates a custom handshake communication protocol, sends the data 0x55 to the external debugging device through the RS-232 bus, and waits for a reply from the external debugging device; If the external debugging device replies with the online data 0xAA, it is determined that normal communication is established between the RS-232 bus and the external debugging device, and the debugging console status is logged in; If the external debugging device does not reply with the online data, the baud rate of the RS-232 bus is switched, and the baud rate cyclic scan configuration is performed to attempt a communication connection, and then steps S31 - S33 are repeated until normal communication is established between the RS-232 bus and the external debugging device, and then the debugging console status is logged in.
[0015] Preferably, when initially determining that the interface of the external debugging device corresponds to the CAN bus, step S3 includes the following steps: S31: The microcontroller unit initializes the CAN bus port; S32: The microcontroller unit controls the analog switch to access the CAN level conversion module through the IO port, and maps the CAN bus port to the CAN bus driver interface layer; S33: The microcontroller unit determines whether the CAN bus can normally receive the heartbeat signal of the external debugging device; If the heartbeat signal of the external debugging device is normally received, it is determined that normal communication is established between the CAN bus and the external debugging device, and the debugging console status is logged in; If the heartbeat signal of the external debugging device cannot be normally received, the baud rate of the CAN bus is switched, and the baud rate cyclic scan configuration is performed to attempt a communication connection, and then steps S31 - S33 are repeated until normal communication is established between the CAN bus and the external debugging device, and then the debugging console status is logged in.
[0016] A storage medium stores computer instructions for causing a computer to execute the multi-bus automatic switching method for in-vehicle device debugging as described above.
[0017] An in-vehicle device includes the storage medium as described above.
[0018] The beneficial effects of the technical solution of the present invention are mainly reflected in: 1. The multi-bus automatic switching system for in-vehicle device debugging uses a general plug-in module and realizes the switching between different buses through analog switches, enabling the general plug-in module to adapt to at least two different debugging devices, thereby reducing the number of socket holes on the in-vehicle device. On the one hand, it improves the integration degree of external ports, which is beneficial to enhancing standards such as waterproof and dustproof performance. On the other hand, through the voltage comparison circuit and differential amplifier circuit, the voltage difference and voltage pulse signal are monitored in real time, and the microcontroller unit is used to calculate and achieve the adaptive matching of different buses, reducing the possibility of user misoperation and improving the debugging work efficiency and safety performance.
[0019] 2. In the multi-bus automatic switching method for in-vehicle device debugging, the voltage comparison circuit and differential amplifier circuit are used to monitor the voltage difference and voltage pulse signal in real time, and the bus matched by the external debugging device is accurately distinguished as the CAN bus or the RS-232 bus through these two signals. Among them, the CAN bus uses differential signal transmission (the voltage difference between CAN_H and CAN_L for the dominant level is about 2V, and the recessive level is close to 0V), while the RS-232 bus uses single-ended signals (logic positive is -12V, logic negative is +12V). There are significant differences between the two in terms of voltage range and signal mode. Therefore, multiple judgments through the voltage difference and voltage pulse signal can avoid judgment errors and achieve the automatic and accurate matching of the external debugging device and the bus.
[0020] 3. In the multi-bus automatic switching method for in-vehicle device debugging, through software handshake communication combined with baud rate cyclic scanning configuration, it further ensures the matching of the external debugging device to the bus, further judges the accuracy of the access device interface judgment, makes the bus switching more stable, improves the robustness of the system, and avoids incorrect switching. Brief Description of the Drawings
[0021] Figure 1 is a schematic structural diagram of the multi-bus automatic switching system for in-vehicle device debugging; Figure 2 is a flowchart of the multi-bus automatic switching method for in-vehicle device debugging; Figure 3 is a schematic flow diagram of steps S2 - S3 of the multi-bus automatic switching method for in-vehicle device debugging. Detailed Embodiment
[0022] To clearly and detailedly show the purpose, advantages, and features of the present invention, it will be illustrated and explained through the non-restrictive description of the following preferred embodiments. This embodiment is only a typical example of applying the technical solution of the present invention, and all technical solutions formed by equivalent substitution or equivalent transformation fall within the scope of protection required by the present invention.
[0023] At the same time, it is stated that in the description of the solution, it should be noted that the terms "first" and "second" are only used for descriptive purposes and should not be construed as indicating or implying a ranking of importance or implicitly specifying the quantity of the indicated technical features. Therefore, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the present invention, the meaning of "a plurality" is two or more, unless otherwise specifically defined.
[0024] The present invention discloses a multi-bus automatic switching system for in-vehicle device debugging, as Figure 1 shown, including: A control module, including a microcontroller unit 5 and a first bus, a second bus, and an IO port provided on the microcontroller unit 5. The first bus is connected to a first level conversion module 12, and the second bus is connected to a second level conversion module 13.
[0025] A general-purpose plug-in module 6, including two internal connection ports and two external connection ports for connecting to an external debugging device. As shown in the figure, it includes a first internal connection port 2, a second internal connection port 4, a first external connection port 1, and a second external connection port 3. Among them, the internal and external ports of the general-purpose plug-in module 6 can not only achieve normal communication between the bus and the external debugging device, but also achieve debugging of the in-vehicle device.
[0026] A voltage comparison circuit for real-time monitoring of voltage pulse data on the current line, including a voltage comparator 7 and a first ADC acquisition module 9. The input end of the voltage comparator 7 is connected to the first internal connection port 2 of the general-purpose plug-in module 6, the output end of the voltage comparator 7 is connected to the input end of the first ADC acquisition module 9, and the output end of the first ADC acquisition module 9 is connected to the microcontroller unit 5. Among them, the voltage comparator 7 generally includes two input ends, one is the non-inverting input end (+), the other is the inverting input end (-), and there is also an output end. The voltage comparator 7 converts the continuous analog signal into a discrete voltage pulse signal by comparing the input signal with a reference voltage. The working principle of the voltage comparator 7 is prior art and will not be elaborated here. Thus, the voltage pulse data on the current voltage comparison circuit is collected in real time, and the voltage pulse data is recorded in real time through the first ADC acquisition module 9, and the recorded data is input into the microcontroller unit 5.
[0027] Differential amplifier circuit, used for real-time monitoring of voltage difference data on the current line, including a differential amplifier 8 and a second ADC acquisition module 10. The input end of the differential amplifier 8 is connected to the second internal connection port 4 of the general-purpose plug-in module 6, the output end of the differential amplifier 8 is connected to the input end of the second ADC acquisition module 10, and the output end of the second ADC acquisition module 10 is connected to the microcontroller unit 5. Among them, the differential amplifier 8 generally includes two input ends, one is the non-inverting input end (+), the other is the inverting input end (-), and there is also an output end. The differential amplifier 8 makes the output voltage proportional to the difference between the two input voltages by reasonably configuring the resistor network. The working principle of the differential amplifier 8 is prior art and will not be elaborated here. The voltage difference data is recorded by the second ADC acquisition module 10, and then the voltage difference data is transmitted to the microcontroller unit 5 in real time through the second ADC acquisition module 10.
[0028] The analog switch 11 can adopt a general analog switch, such as a multiplexer, and is respectively connected to the first level conversion module 12, the second level conversion module 13, the IO port, and the first internal connection port 2 and the second internal connection port 4 of the general-purpose plug-in module 6. In one embodiment, the connection point of the analog switch 11 and the first internal connection port 2 is located on the voltage comparison circuit and between the input end of the voltage comparator 7 and the first internal connection port 2. The connection point of the analog switch 11 and the second internal connection port 4 is located on the differential amplifier circuit and between the input end of the differential amplifier 8 and the second internal connection port 4. The microcontroller unit 5 controls the analog switch 11 to connect or disconnect the first level conversion module 12 and the second level conversion module 13 through the IO port, so that the external debugging device can be selectively connected to the first bus or the second bus.
[0029] In one embodiment, the microcontroller unit 5 (MCU) is a device with data processing capabilities, including but not limited to a CPU (Central Processing Unit central processor), etc. Among them, the CPU is at least used to collect the voltage pulse data and voltage difference data sent by the first ADC acquisition module 9 and the second ADC acquisition module 10 to the microcontroller unit 5, calculate the average value V of the voltage difference in real time, and realize the initialization of the first bus or the second bus to ensure the normal communication of the first bus or the second bus.
[0030] In one embodiment, the first bus is a CAN bus, the second bus is an RS-232 bus, the first level conversion module is a CAN level conversion module, and the second level conversion module is an RS-232 level conversion module. Since the CAN bus uses differential signal transmission (the dominant level is the voltage difference between CAN_H and CAN_L, approximately 2V, and the recessive level is close to 0V), while the RS-232 bus uses single-ended signals (logic positive is -12V, logic negative is +12V), there are significant differences in voltage range and signal mode between the two. Therefore, multiple judgments based on voltage difference and voltage pulse signals can avoid judgment errors and achieve automatic and precise matching between the external debugging device and the bus. Among them, the CAN bus includes a CANH interface and a CANL interface, the RS-232 bus includes a TX interface and an RX interface, and the external debugging device has two interfaces. One of the interfaces is connected to the first external port 1 of the general-purpose plug-in module 6, and the other interface of the external debugging device is connected to the second external port 3 of the general-purpose plug-in module 6. Among them, the two interfaces of the external debugging device can correspond to the CANH interface and the CANL interface of the CAN bus or the TX interface and the RX interface of the RS-232 bus, and the bus is automatically switched according to the types of the two interfaces of the external debugging device.
[0031] The present invention also discloses a multi-bus automatic switching method for in-vehicle device debugging, as Figure 2 、 Figure 3 shown, which applies the multi-bus automatic switching system for in-vehicle device debugging as described above, and includes the following steps: S1: Connect the external debugging device to the two external ports of the general-purpose plug-in module 6. Specifically, one of the interfaces of the external debugging device is connected to the first external port 1 of the general-purpose plug-in module 6, and the other interface of the external debugging device is connected to the second external port 3 of the general-purpose plug-in module 6.
[0032] S2: Preset a timeout judgment time, and in real time collect the voltage pulse signal and the voltage difference signal of the external debugging device within the timeout judgment time, and judge the interface type of the external debugging device according to the obtained electrical signals. Among them, as Figure 3 shown, step S2 specifically includes the following steps: S21: Preset a timeout judgment time; S22: Use a voltage comparator 7 to collect the voltage pulse of the first internal port 2 in real time, and judge whether the voltage pulse value at each collection point is less than the voltage pulse threshold. Within the timeout judgment time, record the number N of times the voltage pulse value exceeds the voltage pulse threshold through the first ADC acquisition module 9, and input N into the microcontroller unit 5; S23: Continuously collect the voltage difference between two ports at the input end of the differential amplifier 8, and input the voltage difference of each sampling point into the microcontroller unit 5 through the second ADC acquisition module 10, and calculate the average value V of all the voltage differences recorded within the timeout judgment time through the microcontroller unit 5; S24: The microcontroller unit 5 determines whether the interface of the external debugging device matches the CAN bus or the RS-232 bus according to the number N of times exceeding the voltage pulse threshold and the magnitude of the absolute value of the average value V of the voltage values.
[0033] In some embodiments, the timeout judgment time is 100 ms, and the voltage pulse threshold is -5V. Therefore, in step S22, the voltage pulse value of each acquisition point within 100 ms is collected in real time through the voltage comparator 7, and the voltage pulse value of each acquisition point is recorded into the microcontroller unit 5 by the first ADC acquisition module 9, and the CPU in the microcontroller unit 5 records each voltage pulse value less than -5V, and the counter records the number N of voltage pulse values less than -5V.
[0034] In a preferred embodiment, step S24 includes: The microcontroller unit 5 determines whether the number N of times the voltage pulse value exceeds the voltage pulse threshold within the timeout judgment time is 0; If N≠0, then further determine whether N is greater than 20. If so, it is initially determined that the interface of the external debugging device corresponds to the RS-232 bus. If not, repeat steps S22 - S24 to further ensure the accuracy of the matching between the external debugging device and the bus and avoid matching errors caused by limited errors; If N = 0, then further determine whether the absolute value of the average value V of all the voltage differences recorded within the timeout judgment time is less than 2. If so, it is initially determined that the interface of the external debugging device corresponds to the CAN bus; if not, repeat steps S23 - S24. Since the potential difference of the CAN bus is 2.00V, when the absolute value of the average value V of the voltage difference of the external debugging device is less than 2, it can be initially determined that the interface of the external debugging device corresponds to the CAN bus.
[0035] S3: Automatically connect to the bus matching the current interface type according to the interface type of the external debugging device, and communicate with the external debugging device through the handshake protocol, and debug the in-vehicle device after normal communication.
[0036] Among them, as Figure 3 shown, when the interface type of the external debugging device matches different buses, different communication methods are adopted: In one embodiment, when it is initially determined that the interface of the external debugging device corresponds to the RS-232 bus, step S3 includes the following steps: S31: The microcontroller unit 5 initializes the RS-232 bus port. Specifically, the CPU initializes the RS-232 bus port. S32: The microcontroller unit 5 controls the analog switch 11 to access the RS-232 level conversion module through the IO port. The method of the IO port controlling the analog switch 11 adopts the existing technology and will not be elaborated here. At the same time, the RS-232 bus port is mapped to the RS-232 bus driver interface layer. This step ensures that the upper-layer application can directly try various baud rates through the driver layer interface, thus helping to switch the baud rate subsequently. In addition, the driver layer can also detect bus errors in real time and feedback them to the upper-layer application. Therefore, if an error frequently occurs after trying a certain baud rate, the baud rate can be quickly excluded to improve the scanning efficiency. S33: The microcontroller unit 5 creates a custom handshake communication protocol and sends the data 0x55 to the external debugging device through the RS-232 bus, and waits for the external debugging device to reply. If the external debugging device replies with the online data 0xAA, it is determined that the RS-232 bus has established normal communication with the external debugging device, and the debugging console status is logged in. If the external debugging device does not reply with the online data, the baud rate of the RS-232 bus is switched, and the baud rate cyclic scan configuration is performed to attempt a communication connection, and then steps S31 - S33 are repeated until the RS-232 bus has established normal communication with the external debugging device and the debugging console status is logged in.
[0037] In an embodiment, when initially determining that the interface of the external debugging device corresponds to the CAN bus, step S3 includes the following steps: S31: The microcontroller unit 5 initializes the CAN bus port. Specifically, the CPU initializes the CAN bus port. S32: The microcontroller unit 5 controls the analog switch 11 to access the CAN level conversion module through the IO port. The method of the IO port controlling the analog switch 11 adopts the existing technology and will not be elaborated here; at the same time, the CAN bus port is mapped to the CAN bus driver interface layer. S33: The microcontroller unit 5 determines whether the CAN bus can normally receive the heartbeat signal of the external debugging device. If the heartbeat signal of the external debugging device is normally received, it is determined that the CAN bus has established normal communication with the external debugging device, and the debugging console status is logged in. If the heartbeat signal of the external debugging device cannot be normally received, the baud rate of the CAN bus is switched, and the baud rate cyclic scan configuration is performed to attempt a communication connection, and then steps S31 - S33 are repeated until the CAN bus has established normal communication with the external debugging device and the debugging console status is logged in.
[0038] The present invention also discloses a storage medium storing computer instructions for causing a computer to execute the multi-bus automatic switching method for in-vehicle device debugging as described above.
[0039] The present invention also discloses an in-vehicle device including the storage medium as described above.
[0040] There are still various implementation manners of the present invention, and all technical solutions formed by using equivalent transformations or equivalent changes fall within the protection scope of the present invention.
Claims
1. A multi-bus automatic switching system for in-vehicle equipment debugging, characterized in that: Including: A control module, including a microcontroller unit, a first bus, a second bus, and an IO port provided on the microcontroller unit. The first bus is connected to a first level conversion module, and the second bus is connected to a second level conversion module; A general-purpose plug-in module, including two internal connection ports and two external connection ports for connecting an external debugging device; A voltage comparison circuit for real-time monitoring of voltage pulse data on the current line, including a voltage comparator and a first ADC acquisition module. The input end of the voltage comparator is connected to the first internal connection port of the general-purpose plug-in module, the output end of the voltage comparator is connected to the input end of the first ADC acquisition module, and the output end of the first ADC acquisition module is connected to the microcontroller unit; A differential amplification circuit for real-time monitoring of voltage difference data on the current line, including a differential amplifier and a second ADC acquisition module. The input end of the differential amplifier is connected to the second internal connection port of the general-purpose plug-in module, the output end of the differential amplifier is connected to the input end of the second ADC acquisition module, and the output end of the second ADC acquisition module is connected to the microcontroller unit; An analog switch is respectively connected to the first level conversion module, the second level conversion module, the IO port, and the first and second internal connection ports of the general-purpose plug-in module. The microcontroller unit controls the analog switch to connect or disconnect the first level conversion module and the second level conversion module through the IO port, so that the external debugging device can be selectively connected to the first bus or the second bus.
2. The multi-bus automatic switching system for in-vehicle device debugging according to claim 1, wherein: The first bus is a CAN bus, the second bus is an RS-232 bus, the first level conversion module is a CAN level conversion module, and the second level conversion module is an RS-232 level conversion module.
3. Multi-bus automatic switching method for in-vehicle device debugging, characterized in that: Applying the multi-bus automatic switching system for in-vehicle device debugging as described in claim 2, including the following steps: S1: Connect the external debugging device to the two external connection ports of the general-purpose plug-in module; S2: Preset a timeout judgment time, and within the timeout judgment time, collect the voltage pulse signal and voltage difference signal of the external debugging device in real time, and judge the interface type of the external debugging device according to the obtained electrical signals; S21: Preset a timeout judgment time; S22: Collect the voltage pulse of the first internal connection port in real time through the voltage comparator, and judge whether the voltage pulse value at each collection point is less than the voltage pulse threshold. Record the number N of times the voltage pulse value exceeds the voltage pulse threshold within the timeout judgment time through the first ADC acquisition module, and input N into the microcontroller unit; S23: Continuously collect the voltage difference between the two ports at the input end through the differential amplifier, input the voltage difference at each sampling point into the microcontroller unit through the second ADC acquisition module, and calculate the average value V of all the voltage differences recorded within the timeout judgment time through the microcontroller unit; S24: The microcontroller unit judges whether the interface of the external debugging device matches the CAN bus or the RS-232 bus according to the number N of times the voltage pulse threshold is exceeded and the magnitude of the absolute value of the average value V of the voltage values; S3: Automatically connect to the bus that matches the current interface type according to the interface type of the external debugging device, and communicate with the external debugging device through the handshake protocol. After normal communication, debug the in-vehicle device.
4. The multi-bus automatic switching method for in-vehicle device debugging according to claim 3, wherein: The timeout judgment time is 100 ms, and the voltage pulse threshold is -5V.
5. The multi-bus automatic switching method for in-vehicle device debugging according to claim 4, characterized in that: Step S24 includes: The microcontroller unit judges whether the number N of times the voltage pulse value exceeds the voltage pulse threshold within the timeout judgment time is 0; If N≠0, then further judge whether N is greater than 20. If so, initially determine that the interface of the external debugging device corresponds to the RS-232 bus. If not, repeat steps S22-S24; If N = 0, then further judge whether the absolute value of the average V of all voltage differences recorded within the timeout judgment time is less than 2. If so, initially judge that the interface of the external debugging device corresponds to the CAN bus; if not, repeat steps S23-S24.
6. The multi-bus automatic switching method for in-vehicle device debugging according to claim 5, wherein: When initially determining that the interface of the external debugging device corresponds to the RS-232 bus, step S3 includes the following steps: S31: The microcontroller unit initializes the RS-232 bus port; S32: The microcontroller unit controls the analog switch to access the RS-232 level conversion module through the IO port, and maps the RS-232 bus port to the RS-232 bus driver interface layer; S33: The microcontroller unit creates a custom handshake communication protocol, and sends the data 0ⅹ55 to the external debugging device through the RS-232 bus, and waits for the external debugging device to reply; If the external debugging device replies with the online data 0ⅹAA, it is judged that the RS-232 bus has established normal communication with the external debugging device, and the debug console status is logged in; If the external debugging device does not reply with the online data, switch the baud rate of the RS-232 bus, and perform baud rate cyclic scan configuration to attempt communication connection, and then repeat steps S31-S33 until the RS-232 bus has established normal communication with the external debugging device and then log in to the debug console status.
7. The multi-bus automatic switching method for in-vehicle device debugging according to claim 5, characterized in that: When initially judging that the interface of the external debugging device corresponds to the CAN bus, step S3 includes the following steps: S31: The microcontroller unit initializes the CAN bus port; S32: The microcontroller unit controls the analog switch to access the CAN level conversion module through the IO port, and maps the CAN bus port to the CAN bus driver interface layer; S33: The microcontroller unit judges whether the CAN bus can normally receive the heartbeat signal of the external debugging device; If the heartbeat signal of the external debugging device is normally received, it is judged that the CAN bus has established normal communication with the external debugging device, and the debug console status is logged in; If the heartbeat signal of the external debugging device cannot be normally received, switch the baud rate of the CAN bus, and perform baud rate cyclic scan configuration to attempt communication connection, and then repeat steps S31-S33 until the CAN bus has established normal communication with the external debugging device and then log in to the debug console status.
8. Storage medium, characterized in that: Stores computer instructions, and the computer instructions are used to make a computer execute the multi-bus automatic switching method for in-vehicle device debugging according to any one of claims 3-7.
9. Vehicle-mounted device, characterized in that: Includes the storage medium as described in claim 8.
Citation Information
Patent Citations
Debugging interface connecting device and network connection terminal equipment
CN214540747U