Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without any inventive effort, are intended to be within the scope of the invention.
It should be noted that, in the embodiments of the present invention, all directional indicators (such as up, down, left, right, front, and rear are used only to explain the relative positional relationship, movement conditions, and the like between the components in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indicators correspondingly change, and the connection may be a direct connection or an indirect connection.
Furthermore, descriptions such as those referred to as "first," "second," and the like, are provided for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implying an order of magnitude of the indicated technical features in the present disclosure. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be considered to be absent and not within the scope of protection claimed in the present invention.
In one embodiment, as shown in fig. 1, an application environment diagram of the impedance adapting method in one embodiment is shown. The impedance setting module 120 is connected between pins of the vehicle 110 or the vehicle diagnostic apparatus 110.
The vehicle may be any vehicle and the signal acquisition module 130 may specifically be coupled between pins of an instrument panel of the vehicle. Or the signal acquisition module 130 accesses pins of an OBD (On Board Diagnostics, on-board self-diagnostic system). The signal acquisition module 130 may be an ADC (Analog to Digital Converter, analog-to-digital converter), etc.
A CAN controller and microprocessor unit (Microcontroller Unit, MCU) may be included in the processor 140. The CAN controller is used for analyzing the digital signals according to the CAN protocol to obtain an analysis result. The processor 140 may be a micro control unit (Microcontroller Unit, MCU) or the like.
The two ends of the impedance setting module 120 are respectively connected between two pins of the vehicle or between two pins of the vehicle diagnostic apparatus. The impedance setting module 120 may include different impedances. For example, the impedance setting module 120 includes an impedance adapted to the low-speed CAN bus, an impedance adapted to the high-speed CAN bus, and an impedance adapted to the single-wire CAN bus. Because the impedance setting module comprises different impedances which are already adapted to the CAN bus of the vehicle, the impedance which is adapted to the vehicle or the vehicle diagnostic instrument CAN be obtained rapidly through switching, and the impedance self-adaptation efficiency is improved.
It is understood that the impedance adapted to the low speed CAN bus, the impedance adapted to the high speed CAN bus, and the impedance adapted to the single wire CAN bus may each comprise an impedance within a range. For example, the impedance adapted to the high speed CAN bus may include resistances of 100 ohms, 110 ohms, 120 ohms, 130 ohms, 140 ohms, and 150 ohms, the impedance adapted to the low speed CAN bus may include pull-up resistances of 450 ohms, 460 ohms, 500 ohms, 510 ohms, etc., and the impedance adapted to the single wire CAN bus may be a resistance of 50 ohms, 100 ohms, or 150 ohms to ground, etc. The switching of each impedance in the impedance setting module 120 may be implemented by a switch or a MOS (Metal Oxide Semiconductor FIELD EFFECT Transistor, metal-oxide-semiconductor field effect Transistor) tube, or the like. In vehicle diagnosis, a 120 ohm resistor is usually added to a high-speed CAN bus communication CANH and a CANL bus, a low-speed CAN is connected with a 510 ohm resistor to be pulled up to 5V, a CANL is connected with the 510 ohm resistor to be grounded, and a single-wire CAN bus is connected with a 100 ohm resistor to be grounded. The architecture in fig. 1 is suitable for various vehicles and vehicle diagnostic apparatuses, and has strong versatility.
In one embodiment, as shown in fig. 2, a flow chart of an impedance adapting method in one embodiment includes:
Step 202, analyzing a digital signal according to a CAN protocol to obtain an analysis result, wherein the digital signal is obtained by collecting an output signal by a signal collecting module and converting the output signal, the output signal is sent by a vehicle or a vehicle diagnostic instrument and is obtained by an impedance setting module, and the impedance setting module is connected between pins of the vehicle or the vehicle diagnostic instrument.
The analysis result includes an arbitration section, a control section, a data section, a CRC (Cyclic Redundancy Check ) separator, and the like. The output signal is in particular an analog signal. The impedance setting module is connected between pins of the vehicle or between pins of a diagnostic apparatus of the vehicle.
The signal acquisition module acquires an output signal of the impedance setting module and converts the output signal into a digital signal under the condition that the impedance setting module sets the current set impedance. The processor receives the digital signal sent by the signal acquisition module, analyzes the data according to the CAN protocol, and obtains an analysis result.
And 204, when the analysis result does not accord with the CAN protocol, sending a control signal to control the impedance setting module to switch the impedance until the analysis result accords with the CAN protocol, and obtaining the target impedance adapted to the pin.
Specifically, when the analysis result cannot pass the CRC of the CAN protocol, the processor sends out a control signal to control the impedance setting module to switch from the current impedance to another impedance. And the processor returns to execute the step of acquiring an analysis result obtained by the CAN controller analyzing the digital signal according to the CAN protocol, and takes the impedance when the analysis result accords with the CAN protocol as the target impedance of the pin of the vehicle or the vehicle diagnostic instrument.
According to the impedance self-adaption method, the digital signal is analyzed according to the CAN protocol to obtain the analysis result, when the analysis result does not accord with the CAN protocol, a control signal is sent to control the impedance setting module to switch the impedance, whether the impedance is matched with the pins of the vehicle or the vehicle diagnostic instrument is verified through the switching impedance, the impedance self-adaption of various CAN buses related to the vehicle in a vehicle scene CAN be realized, and the target impedance is not only determined through a voltage value, but also obtained through actual verification, so that the accuracy is high.
In one embodiment, the impedance self-adaption method further comprises the step of reserving the current set impedance in the impedance setting module as the target impedance adapted to the pin when the analysis result accords with the CAN protocol.
Specifically, the processor CAN controller analyzes the digital signal according to the CAN protocol, and when the analysis result accords with the CAN protocol, the processor reserves the current set impedance in the impedance setting module as the target impedance of the pin which is adapted to the vehicle or the vehicle diagnostic instrument. In this embodiment, when the analysis result directly accords with the CAN protocol, the current set impedance in the impedance setting module is reserved, the target impedance is obtained without switching, and the switching efficiency is improved.
In one embodiment, analyzing the digital signal according to the CAN protocol to obtain an analysis result comprises verifying according to the voltage value and the waveform of the output signal acquired by the signal acquisition module, and analyzing the digital signal according to the CAN protocol to obtain the analysis result when the voltage value and the waveform of the output signal accord with the CAN waveform characteristics.
Specifically, the processor is connected with the signal acquisition module. CAN waveforms transmitted over the CAN bus have certain characteristics. For example, the high level of the electric signal is 2.5v to 5v, the low level of the electric signal is 0 to 1v, etc., and the waveform has square wave characteristics, differential signal characteristics, etc. The processor verifies according to the voltage value and the waveform of the output signal obtained by the signal acquisition module, and when the voltage value and the waveform of the output signal accord with the CAN waveform characteristics, the digital signal is analyzed according to the CAN protocol, and an analysis result is obtained. Optionally, the processor may verify based on the voltage difference and the waveform of the output signal obtained by the signal acquisition module.
In this embodiment, verification is performed according to the voltage value and the waveform of the output signal, and when the voltage value and the waveform of the output signal meet the characteristics of the CAN waveform, the control signal acquisition module transmits the digital signal to the CAN controller, so that some waveforms which do not meet the requirements CAN be filtered, frequent impedance switching is avoided, and switching accuracy is improved.
In one embodiment, after obtaining the target impedance adapted to the pin, the impedance adaptation method further comprises:
And sending the confirmation character to the CAN transceiver, so that the CAN transceiver sends the confirmation character to the vehicle or the vehicle diagnostic instrument, and the vehicle or the vehicle diagnostic instrument stops sending data according to the confirmation character.
Wherein the acknowledgement character (Acknowledge Character, ACK) is a transmission type control character that the receiving station sends to the transmitting station in data communication, indicating that the sent data has been acknowledged without errors. The processor, the CAN transceiver and the impedance setting module are connected in sequence.
Specifically, when the output signal of the vehicle or the vehicle diagnostic apparatus after passing through the impedance setting module is error-free, the processor transmits a confirmation character as a digital signal to the CAN transceiver. The CAN transceiver converts the confirmation character of the digital signal into the confirmation character of the analog signal, and then sends the confirmation character of the analog signal to the vehicle or the vehicle diagnostic apparatus through the impedance setting module, and the vehicle or the vehicle diagnostic apparatus stops sending data according to the confirmation character.
In this embodiment, the validation character is sent to the vehicle or vehicle diagnostic instrument via the CAN transceiver, which is capable of converting the character format and avoiding the vehicle or vehicle diagnostic instrument from always sending data.
In one embodiment, transmitting the acknowledge character to the CAN transceiver includes determining a CAN bus type based on a voltage value of the output signal and transmitting the acknowledge character to the CAN transceiver corresponding to the CAN bus type.
The CAN bus types comprise a single-wire CAN bus, a high-speed CAN bus and a low-speed CAN bus. The CAN transceiver includes a high-speed CAN transceiver, a low-speed CAN transceiver, a SCAN transceiver, etc.
Specifically, the processor acquires a voltage value of an output signal corresponding to the target impedance obtained by the signal acquisition module, and determines the type of the CAN bus according to the voltage value and a voltage range in which the type of the CAN bus is located. It CAN be appreciated that the output signal corresponding to the target impedance complies with the CAN protocol standard. For example, the CANH voltage of the high-speed CAN bus fluctuates between 2.5v and 3.5v, and the CANL voltage fluctuates between 1.5v and 2.5 v. Then the CAN bus type is determined to be a high speed CAN bus when the output signal conforms to the CAN protocol and CANH is 3V and CANL is 2V and CANH and CANL exhibit differential signal characteristics. The processor sends an acknowledge character to the CAN transceiver corresponding to the CAN bus type.
In this embodiment, as shown in fig. 3, an application environment diagram of an impedance adaptive method in another embodiment is shown. In fig. 3, the MCU and the CAN controller are not integrated on the same chip. Including a vehicle or vehicle diagnostic, an impedance setting module, ADC, MCU, CAN controller, a high-speed CAN transceiver, a low-speed CAN transceiver, and a SCAN transceiver. The vehicle or the vehicle diagnostic apparatus outputs a signal, and the signal is transmitted to the signal acquisition module through the impedance setting module. The signal acquisition module converts the output signal into a digital signal. And a CAN controller in the processor analyzes the digital signals according to a CAN protocol to obtain an analysis result. When the analysis result does not accord with the CAN protocol, the MCU sends a control signal to control the impedance setting module to switch the impedance until the analysis result output by the CAN controller accords with the CAN protocol, and the target impedance adapted to the pin is obtained. After switching to the target impedance, the MCU sends a confirmation character and a CAN bus type to the CAN controller, the CAN controller converts the confirmation character formatted as an analog signal into a confirmation character of a digital signal, and the confirmation character of the digital signal is sent to a CAN transceiver corresponding to the CAN bus type. I.e. to a high speed CAN transceiver, a low speed CAN transceiver or a SCAN transceiver. The CAN transceiver may send a confirmation character to the vehicle or vehicle diagnostic instrument via the impedance setting module such that the vehicle or vehicle diagnostic instrument ceases to send data.
In the embodiment, the CAN bus type is determined according to the voltage value of the output signal, the acknowledgement character is sent to the CAN transceiver corresponding to the CAN bus type, the data transmission is carried out according to the data of different CAN bus types, and the vehicle or the vehicle diagnostic instrument is ensured to be capable of receiving the acknowledgement character and stop sending the data.
In one embodiment, an impedance adaption method comprises:
And a1, verifying according to the voltage value and the waveform of the output signal acquired by the signal acquisition module, and analyzing the digital signal according to a CAN protocol to obtain an analysis result when the voltage value and the waveform of the output signal accord with the CAN waveform characteristics. The digital signal is obtained by collecting and converting the output signal by the signal collecting module, and the output signal is sent by a vehicle or a vehicle diagnostic instrument and is obtained by the impedance setting module.
And a2, when the analysis result does not accord with the CAN protocol, sending a control signal to control the impedance setting module to switch the impedance until the analysis result accords with the CAN protocol, and obtaining the target impedance adapted to the pin.
And a step a3, when the analysis result accords with the CAN protocol, reserving the current set impedance in the impedance setting module as the target impedance adapted to the pin.
And a4, when the analysis result accords with the CAN protocol, reserving the current set impedance in the impedance setting module as the target impedance of the pin which is adapted to the vehicle or the vehicle diagnostic instrument.
And a step a5, determining the type of the CAN bus according to the voltage value of the output signal.
And a6, transmitting an acknowledgement character to the CAN transceiver corresponding to the CAN bus type.
And a7, transmitting the confirmation character to the CAN transceiver, so that the CAN transceiver transmits the confirmation character to the vehicle or the vehicle diagnostic apparatus, and the vehicle or the vehicle diagnostic apparatus stops transmitting data according to the confirmation character.
According to the impedance self-adaption method, the digital signal is analyzed according to the CAN protocol to obtain the analysis result, when the analysis result does not accord with the CAN protocol, a control signal is sent to control the impedance setting module to switch the impedance, whether the impedance is matched with the pins of the vehicle or the vehicle diagnostic instrument is verified through the switching impedance, the impedance self-adaption of various CAN buses related to the vehicle in a vehicle scene CAN be realized, and the target impedance is not only determined through a voltage value, but also obtained through actual verification, so that the accuracy is high.
In one embodiment, the impedance setting module automatically switches to a target impedance between the known pins if the target impedance is known.
In one embodiment, as shown in fig. 4, a flow chart of an impedance adapting method in another embodiment is shown. After the main program is started, a module initializing operation is performed.
Module initialization operation-for example, setting the II pin of all OBDs does not configure any impedance of the OBDs. Pins that CAN occur are determined. Pins that CAN occur for CAN may be 1-9, 6-14, 3-8, 3-11, 12-13, etc.
The signal acquisition module acquires a voltage value and a waveform on a corresponding pin.
And the processor makes preliminary judgment according to the voltage value and the waveform acquired by the signal acquisition module, and judges whether the current pin is likely to be CAN data or not based on the voltage fluctuation of the CAN channel pin.
When the waveform characteristics of the CAN are met, binary data, namely digital signals, are obtained by respectively making differences between CANH and CANL according to the CAN channel pins known to appear in vehicle diagnosis, and are input to the CAN controller. After receiving the binary data, the CAN controller analyzes the data according to the CAN protocol, if the binary data accords with the CAN protocol, a normal analysis result is fed back, and if the binary data does not accord with the CAN protocol, an abnormal analysis result is fed back. And when the voltage value does not accord with the CAN waveform characteristics, returning to the step of acquiring the voltage value on the corresponding pin by the execution signal acquisition module.
Judging whether the data accords with the CAN protocol, wherein the processor decides whether the impedance needs to be switched according to the analysis result returned by the CAN controller. When the analysis result accords with the CAN protocol, the current impedance is reserved as the target impedance adapted to the pin. When the analysis result does not accord with the CAN protocol, the impedance setting module is controlled to switch the impedance, and the step of acquiring the voltage value on the corresponding pin by the signal acquisition module is returned to be executed.
In this embodiment, a processor, a signal acquisition module, a CAN controller, and an impedance setting module are used to form an impedance adaptive device. The method comprises the steps of collecting the pin voltage of a vehicle or a vehicle diagnostic instrument through a signal collecting module to conduct primary fluctuation judgment, pre-judging the possible CAN pin combination, inputting digital signals after the signal collecting module is converted into a CAN controller, checking whether the digital signals accord with CAN protocol standards through the CAN controller, and informing an MCU after the digital signals pass through the CAN controller. And when the CAN data analysis is successful and the impedance matching is successful, otherwise, the CAN controller checks that the CAN protocol is not met, and the MCU controls the impedance setting module to perform impedance switching. Repeating the above steps until the data is received normally or no data is present on the bus. Through the steps, compared with the traditional method that whether the voltage on a certain pin is used for judging whether the voltage is a certain path of data of the CAN bus or not CAN be automatically adapted to various vehicles or vehicle diagnostic apparatuses, and the obtained impedance is more accurate.
It should be understood that, although the steps in the flowcharts of fig. 2 and 4 described above are sequentially shown as indicated by arrows, and the steps a1 to a6 are sequentially shown as indicated by numerals, these steps are not necessarily sequentially performed in the order indicated by the arrows or numerals. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps in fig. 2 and 4 may include a plurality of steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily sequential, but may be performed in rotation or alternatively with at least a portion of the steps or stages in other steps or other steps thereof.
In one embodiment, the impedance self-adapting device comprises an impedance setting module, a signal acquisition module, a CAN controller, a processor and an impedance setting module which are sequentially connected, wherein the impedance setting module is connected between pins of a vehicle or a vehicle diagnostic instrument;
The signal acquisition module is used for acquiring output signals of pins of the vehicle or the vehicle diagnostic instrument through the impedance setting module and converting the output signals into digital signals;
the CAN controller processor is used for analyzing the digital signals according to a CAN protocol to obtain an analysis result;
And the processor is used for sending out a control signal to control the impedance setting module to switch the impedance when the analysis result does not accord with the CAN protocol until the analysis result accords with the CAN protocol, and obtaining the target impedance adapted to the pin.
According to the impedance self-adapting device, the digital signal is analyzed according to the CAN protocol to obtain the analysis result, when the analysis result does not accord with the CAN protocol, a control signal is sent to control the impedance setting module to switch the impedance, whether the impedance is matched with the pins of the vehicle or the vehicle diagnostic instrument is verified through the switching impedance, the impedance self-adapting of various CAN buses related to the vehicle CAN be realized under the vehicle scene, and the target impedance is obtained through the actual verification rather than the voltage value, so that the accuracy is high.
In one embodiment, the CAN controller is further configured to, when the analysis result conforms to the CAN protocol, reserve a currently set impedance in the impedance setting module as a target impedance adapted to the pin.
In this embodiment, when the analysis result directly accords with the CAN protocol, the current set impedance in the impedance setting module is reserved, the target impedance is obtained without switching, and the switching efficiency is improved.
In one embodiment, the processor is further connected to the output end of the signal acquisition module, and the processor is used for verifying according to the voltage value and the waveform of the output signal acquired by the signal acquisition module, and analyzing the digital signal according to the CAN protocol when the voltage value and the waveform of the output signal accord with the CAN waveform characteristics.
In the embodiment, verification is performed according to the voltage value and the waveform of the output signal, and when the voltage value and the waveform meet the CAN waveform characteristics, the control signal acquisition module transmits the digital signal to the CAN controller, so that some waveforms which do not meet the requirements CAN be filtered out in the front section, frequent impedance switching is avoided, and switching accuracy is improved.
In one embodiment, the device further comprises a CAN transceiver, one end of the CAN transceiver is connected with the processor, and the other end of the CAN transceiver is connected with the impedance setting module;
the processor is further configured to send an acknowledgement character to the CAN transceiver after obtaining the target impedance;
the CAN transceiver is used for sending the confirmation character to the vehicle or the vehicle diagnostic instrument;
The vehicle or the vehicle diagnostic apparatus is used to stop transmitting data according to the confirmation character.
In this embodiment, the validation character is sent to the vehicle or vehicle diagnostic instrument via the CAN transceiver, which is capable of converting the character format and avoiding the vehicle or vehicle diagnostic instrument from always sending data.
In one embodiment, the processor is configured to determine the CAN bus type based on the output signal;
The processor sends an acknowledge character to the CAN transceiver corresponding to the CAN bus type.
In the embodiment, the CAN bus type is determined according to the voltage value of the output signal, the acknowledgement character is sent to the CAN transceiver corresponding to the CAN bus type, the data transmission is carried out according to the data of different CAN bus types, and the vehicle or the vehicle diagnostic instrument is ensured to be capable of receiving the acknowledgement character and stop sending the data. For specific limitations of the impedance adaption device, reference may be made to the above limitation of the impedance adaption method, which is not repeated here. The various modules in the impedance adaption apparatus described above may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods in accordance with the embodiments may be accomplished by way of a computer program stored in a non-transitory computer readable storage medium, which when executed may comprise the steps of the above described embodiments of the methods. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the invention, and all equivalent structures or equivalent processes using the descriptions and drawings of the present invention or directly or indirectly applied to other related technical fields are included in the scope of the invention.