It is adapted to the multi-protocols diagnostic module and its control method of OBD interfacesTechnical field
The present invention relates to automotive electronic technology, and in particular to a kind of multi-protocols diagnostic module of adaptation OBD interfaces and its controlMethod processed.
Background technology
OBD is the abbreviation of English On-Board Diagnostic, i.e. " onboard diagnostic system ".This system can be supervised at any timeThe operation conditions of engine and the working condition of exhaust gas aftertreatment system are controlled, once find the feelings for being possible to cause discharge exceededCondition, can at once send warning.When system breaks down, trouble light (MIL) or inspection engine (Check Engine) are alertedLamp is bright, while fault message can be stored in memory by OBD system, can be with failure by the diagnostic instrments and diagnosis interface of standardThe form of code reads relevant information.According to the prompting of DTC, maintenance personal targetedly go to check relevant position, element andCircuit, can quickly and accurately determine property and the position of failure.
OBD technologies originate from the U.S. of the eighties earliest, and the OBD technologies at initial stage are reminded by appropriate technical approachFailure or failure that driver occurs.First generation OBD(OBD I)System, due to the OBD of each Main Auto factory of the worldSystem is different with its engine management system difference, and this causes larger inconvenience to after-sale service maintenance.California, USAAir resource portion(CARB)Took the lead in importing OBDII while LEV Abgasgesetzs are implemented in 1996.European Union and Japan are 2000OBD technologies are introduced after year, it is desirable to which all zero-mileage cars and light truck car (less than 2.5 tons) must be provided with EOBD systems.Second generation OBDWith EOBD standard (EOBD of OBD, ISO european version of U.S.'s version of SAE), perfect monitoring category are unified, it is also expressly that tightThe discharge specific aim of lattice.
As shown in figure 1, the OBD interface diagnosises seat of all vehicles of the standards of OBD II requirement is 16PIN, shape, size specification systemOne.OBD II has unified each car type same fault code and meaning, with numerical analysis data transmission function, including driving recordingDevice, again show memory DTC, the functions such as DTC can be directly removed by instrument, vehicle OBD interfaces are basic in the marketOn be all the standard interfaces of OBD II.
In order to preferably obtain OBD diagnostic datas, traditional vehicle-mounted OBD information is all obtained by OBD diagnosis boxes;The OBD diagnosis boxes of the model ELM27 for such as occurring on the market, it supports many agreements, can read number from OBD with self adaptationAfter according to bag, automatically select the agreement of support to parse, then with RS232 serial manners export, RS232 serial ports interface withELM327 obtains diagnostic message by interacting, but such OBD diagnosis boxes volume is larger, is unfavorable for secondary development or collectionInto amateur senior to be difficult to directly obtain information of vehicles by OBD while OBD diagnostic techniques has certain technical threshold.
The content of the invention
First by providing a kind of multi-protocols diagnostic module of adaptation OBD interfaces, the module is carried the application by selectionThe MCU of CAN transceiver function used as main control chip, by CAN transceiver realized and branch by the various OBD standard agreements of automatic adaptationThe car communication of CAN OBD interfaces is held, 3.3V or 5V signals and vehicle mounted electric can be realized by K/L electrical level transferring chips or circuitFlat turn is changed, and realizes being communicated with the car of K/L line OBD interfaces is supported, in addition, by encipherment protection and encapsulation, in the way of general purpose I C,The threshold that OBD technologies are used can be reduced, it is widely applied to the fields such as car networking, Internet of Things.
In order to achieve the above object, the application is achieved using following technical scheme:
A kind of multi-protocols diagnostic module of adaptation OBD interfaces, its it is critical only that including:MCU module, CAN transceiver, level conversionModule and encryption chip, the MCU module, CAN transceiver, level switch module and encryption chip are connected respectively simultaneouslyOverall package is integrated IC.
Further, the MCU module outwards leads to VCC pin, TX pins, RX pins, MODE pins and EN and drawsPin, wherein:
The VCC pin is used to realize the power supply supply of module;
The TX pins are used to realize that the signal of serial protocol to send;
The RX pins are used to realize that the signal of serial protocol to be received;
The MODE pins are used to realize the switching of mode of operation;
The EN pins are used to receive enable signal, realize the drive control of module.
Further, the MCU module is connected with CAN transceiver, the CAN transceiver outwards lead to CANH pins andCANL pins, wherein:
CANH pins are used to realize that CAN agreement high level signal is received and dispatched;
CANL pins are used to realize that CAN agreement low level signal is received and dispatched.
Further, the level switch module is connected with the MCU module, and the level switch module outwards leads to KWire pin, L wire pins, BAT+ pins and BAT- pins;
The K wire pins are used to realize K wire protocol signal transmissions;
The L wire pins are used to realize L wire protocol signal transmissions;
The BAT+ pins are used to realize that automobile power source positive pole is connected;
The BAT- pins are used to realize that automobile power source negative pole is connected.
Further, the encryption chip is connected with the MCU module, for realizing cryptographic check, the encryption chip toGND pin is led to outward, the connection for realizing whole modular power source ground wire.
Further, the VCC pin, MODE pins, GND pin, EN pins, CANH pins, CANL pins, BAT+ drawPin, BAT- pins, L wire pins, K wire pins, RX pins and TX pins on the integrated IC successively according to 1-12 pinSequence is encapsulated successively.
Alternatively, the integrated IC is the square modules of 28mm × 28mm.
Alternatively, it is L9637D that the level switch module uses chip model.
Based on foregoing circuit topological structure, the invention allows for a kind of multi-protocols diagnostic module of adaptation OBD interfacesControl method, specifically follows the steps below:
Step 1:Upper electricity, system initialization;
Step 2:Detection MCU module enables the driving condition of pin, if enabling pin drive signal effectively, starts Working mouldFormula, otherwise continues cycling through detection into standby mode;
Step 3:After starting mode of operation, the driving condition of MCU module mode signal pin is judged, if mode signal pin hasEffect, then into debugging efforts pattern, return to step 2 repeats;If mode signal pin is invalid, into normal work mouldFormula;
Step 4:Into after normal mode of operation, MCU module verifies AES by the encryption chip, after verifying successfully,Into step 5;Otherwise, the circulation of return to step 2 is performed;
Step 5:MCU module scans corresponding agreement Auto-matching vehicle successively according to default protocol type, while recordWith the time, if matching time-out, return to step 2 is re-executed;Otherwise judge whether agreement matching succeeds into next step;
Step 6:Judge whether agreement matching succeeds, if it fails, then return to step 5 is changed another agreement and matched;If the match is successful, the instruction that parsing user sends, and diagnostic data is obtained according to the instruction;
Step 7:The diagnostic data for returning is parsed, and draws OBD diagnostic results.
Further, in the MCU module default protocol type include the bits 500kbps of ISO15765 id 11,ISO15765 id 29 bits 500kbps、ISO15765 id 11 bits 250kbps、ISO15765 id 29 bits250kbps, ISO14230 fast init 10.4kbps, ISO14230 5 Baud init 10.4kbps and ISO91415 Baud init auto Baud。
Compared with prior art, remarkable result of the invention is:
Main control chip is used as by MCU of the selection with CAN controller function, the module can be with the various OBD standards of automatic adaptationAgreement, realizes being communicated with the vehicle of CAN OBD interfaces is supported, by K/L electrical level transferring chips or electricity by CAN transceiverRoad can realize 3.3V or 5V signals and vehicle-mounted level conversion, realize being communicated with the vehicle of K/L line OBD interfaces is supported, according to differenceVoltage class, different CAN controllers can be encapsulated, in addition, protected to system by encryption chip, while using collectionInto the encapsulation of IC forms, module is very easy to use.
Brief description of the drawings
Fig. 1 is OBD interface model figures;
Fig. 2 is the pin assignments figure of the multi-protocols diagnostic module of adaptation OBD interfaces proposed by the present invention;
Fig. 3 is the inside annexation figure of the multi-protocols diagnostic module of adaptation OBD interfaces proposed by the present invention;
Fig. 4 is control flow chart of the invention.
Specific embodiment
It is right below in conjunction with Figure of description and specific embodiment in order to be better understood from above-mentioned technical proposalAbove-mentioned technical proposal is described in detail.
As shown in Fig. 2-Fig. 3, a kind of multi-protocols diagnostic module of adaptation OBD interfaces, including MCU module, CAN transceiver,Level switch module and encryption chip, the MCU module, CAN transceiver, level switch module and encryption chip are right respectivelyShould connect and overall package is integrated IC.
From figures 2 and 3, it will be seen that in specific implementation process, the MCU module outwards leads to VCC pin, TX and drawsPin, RX pins, MODE pins and EN pins, wherein:
The VCC pin is used to realize the power supply supply of module;
The TX pins are used to realize that the signal of serial protocol to send;
The RX pins are used to realize that the signal of serial protocol to be received;
The MODE pins are used to realize the switching of mode of operation;
The EN pins are used to receive enable signal, realize the drive control of module.
The MCU module is connected with CAN transceiver, and the CAN transceiver outwards leads to CANH pins and CANL pins, itsIn:
CANH pins are used to realize that CAN agreement high level signal is received and dispatched;
CANL pins are used to realize that CAN agreement low level signal is received and dispatched.
The level switch module is connected with the MCU module, and it is L9637D that the level switch module uses chip model,And outwards lead to K wire pins, L wire pins, BAT+ pins and BAT- pins;
The K wire pins are used to realize K wire protocol signal transmissions;
The L wire pins are used to realize L wire protocol signal transmissions;
The BAT+ pins are used to realize that automobile power source positive pole is connected;
The BAT- pins are used to realize that automobile power source negative pole is connected.
The encryption chip is connected with the MCU module, and for realizing cryptographic check, the encryption chip outwards leads toGND pin, the connection for realizing whole modular power source ground wire.
By Fig. 2 it can also be seen that the module is encapsulated as after integrated IC being 12 pin square modules, size be 28mm ×28mm, the VCC pin, MODE pins, GND pin, EN pins, CANH pins, CANL pins, BAT+ pins, BAT- pins,The pin sequence of L wire pins, K wire pins, RX pins and TX pins successively according to 1-12 on the integrated IC is sealed successivelyDress.
As shown in figure 4, foregoing circuit topological structure is based on, the invention allows for a kind of multi-protocols of adaptation OBD interfacesThe control method of diagnostic module, specifically follows the steps below:
Step 1:Upper electricity, system initialization;
Step 2:Detection MCU module enables the driving condition of pin, is generally provided using EN pins and enables signal, if enable is drawnPin drive signal effectively, then starts mode of operation, otherwise continues cycling through detection into standby mode;
Step 3:After starting mode of operation, the driving condition of MCU module mode signal pin is judged, generally carried using MODE pinsChange signal for pattern, if mode signal pin is effectively, into debugging efforts pattern, return to step 2 repeats;IfMode signal pin is invalid, then into normal mode of operation;
Step 4:Into after normal mode of operation, MCU module verifies AES by the encryption chip, after verifying successfully,Into step 5;Otherwise, the circulation of return to step 2 is performed;
Step 5:MCU module scans corresponding agreement Auto-matching vehicle successively according to default protocol type, while recordWith the time, if matching time-out, return to step 2 is re-executed;Otherwise judge whether agreement matching succeeds into next step;
Step 6:Judge whether agreement matching succeeds, if it fails, then return to step 5 is changed another agreement and matched;If the match is successful, the instruction that parsing user sends, and diagnostic data is obtained according to the instruction;
Step 7:The diagnostic data for returning is parsed, and draws OBD diagnostic results, during specific implementation, the data for gathering can enteredRow treatment and analysis, are calculated driving behavior, vehicle prediction data etc., such as:Vehicle urgency acceleration and deceleration number of times statistics, Fuel Oil RemainingMileage etc..
Further, in the MCU module default protocol type include the bits 500kbps of ISO15765 id 11,ISO15765 id 29 bits 500kbps、ISO15765 id 11 bits 250kbps、ISO15765 id 29 bits250kbps, ISO14230 fast init 10.4kbps, ISO14230 5 Baud init 10.4kbps and ISO91415 Baud init auto Baud。
The circuit module for providing of the invention is except realizing being communicated with vehicle-mounted CAN bus, K/L lines and system and encryption IC friendshipsMutually protection is outer, while devising the functions such as capacitor filtering, MCU are enabled and mode of operation is selected, can be adapted to multiple standards diagnosisAgreement simultaneously obtains vehicle diagnosis information by OBD interfaces, is IC chip by integration packaging, using more facilitating, by advanceConfiguration multiple standards agreement, when communication connection is set up, is matched by way of scanning one by one with vehicle-mounted agreement, untilWith success, encryption chip is pre-set in module, when product is used, by providing the form of SDK kits, realize that encryption is testedCard, it is ensured that security performance.
It should be pointed out that described above is not limitation of the present invention, the present invention is also not limited to the example above,Change, modified, addition or replacement that those skilled in the art are made in essential scope of the invention, also shouldBelong to protection scope of the present invention.