The content of the invention
In view of this, the present invention is directed to propose a kind of CAN test system and method, with solve it is above-mentioned in the prior artTesting tool is expensive and manually manufactures the problem of various bus failures influence test result.
To reach above-mentioned purpose, the technical proposal of the invention is realized in this way:
A kind of CAN test system, wherein the CAN test system includes:Controller module, for receivingCAN interference configuration signal, and control the control of CAN interference modules to believe according to the CAN interference configuration signal outputNumber;CAN interference modules, for being disturbed according to the control signal the CAN signal that CAN module is sent;And instituteController module is stated to be additionally operable to receive and export the CAN signal after interference.
Further, the CAN interference modules include multiple relays, the control signal control of the controller module outputThe on off state of the multiple relay is made, to realize that the CAN signal sent to CAN module disturbs.
Further, the CAN test system also includes coder module, be arranged on the controller module withBetween CAN interference modules, the control signal for being exported to the controller module is exported to the CAN after being extended and disturbedModule.
Further, before the CAN interference configuration signal is received, the controller module is additionally operable to receive and surveyedPing and rate selecting signal, and judged according to Current communications passage and speed in the TCH test channel and rate selecting signalWhether the passage and speed of instruction are correct, and activate indicated passage in the right circumstances with indicated rate communications.
Relative to prior art, CAN test system of the present invention has the advantage that:
CAN test system of the present invention can be believed according to being received according to the CAN interference configurationThe control signal of number output control CAN interference modules, and then realize that the CAN signal sent to CAN module disturbs, fromAnd the CAN signal after being disturbed.Thus, it is without using expensive test equipment and various total without manually manufactureLine failure, the accuracy and testing efficiency of test can be improved while cost is reduced.
, can not be to specifying message and report with solution another object of the present invention is to propose a kind of CAN test systemThe problem of specified location in text is tested.
To reach above-mentioned purpose, the technical proposal of the invention is realized in this way:
A kind of CAN test system, the CAN test system include controller module, the controller moduleFor receiving CAN message interference configuration signal, wherein CAN message interference configuration signal includes instruction CAN letterThe information for treating interference position in number in the mark and the message to be disturbed of message to be disturbed;The controller module is alsoFor determining message to be disturbed in CAN signal according to the CAN message interference configuration signal and described waiting to disturbMessage in treat interference position and export interference signal to the CAN signal;And the controller module is additionally operable toReceive and export the CAN signal after interference.
Further, the controller module is additionally operable to judge pre- timing before the CAN signal after output is disturbedIn bus communication state it is whether normal, and bus communication state within the scheduled time it is abnormal in the case of exportCAN signal after interference.
Relative to prior art, CAN test system of the present invention has the advantage that:
CAN test system of the present invention can determine message to be disturbed in CAN signal and described treatTreat interference position in the message of interference and export interference signal to the CAN signal, so as to realize to specifying reportThe interference of text and specified location in message and the CAN signal after being disturbed.
Another object of the present invention is to propose a kind of CAN method of testing, to solve above-mentioned to test in the prior artTool expensive and manually manufacture the problem of various bus failures influence test result.
To reach above-mentioned purpose, the technical proposal of the invention is realized in this way:
A kind of CAN method of testing, the CAN method of testing include:Controller module receives CAN interferenceSignal is configured, and the control signal of CAN interference modules is controlled according to the CAN interference configuration signal output;The CAN is doneModule is disturbed to disturb the CAN signal that CAN module is sent according to the control signal;And the controller module connectsReceive and export the CAN signal after interference.
Further, the CAN method of testing also includes:The controller module is done in the reception CANTCH test channel and rate selecting signal are received before disturbing configuration signal, and the test is judged according to Current communications passage and speedWhether the passage and speed indicated in passage and rate selecting signal be correct, and activates indicated passage in the right circumstancesWith indicated rate communications.
The CAN method of testing is with the first above-mentioned CAN test system relative to possessed by prior artDominant Facies are same, will not be repeated here.
, can not be to specifying message and report with solution another object of the present invention is to propose a kind of CAN method of testingThe problem of specified location in text is tested.
To reach above-mentioned purpose, the technical proposal of the invention is realized in this way:
A kind of CAN method of testing, the CAN method of testing include:Receive CAN message interference configuration letterNumber, wherein CAN message interference configuration signal includes in instruction CAN signal the mark of message to be disturbed and described treatedThe information for treating interference position in the message of interference;CAN signal is determined according to the CAN message interference configuration signalIn treat interference position and export interference signal to the CAN to believe in message to be disturbed and the message to be disturbedNumber;And receive and export the CAN signal after interference.
Further, the CAN method of testing also includes:Judge before the CAN signal after output is disturbedWhether the bus communication state in the scheduled time is normal, and the abnormal situation of bus communication state within the scheduled timeCAN signal after lower output interference.
The CAN method of testing is with above-mentioned second of CAN test system relative to possessed by prior artDominant Facies are same, will not be repeated here.
Other features and advantages of the present invention will be described in detail in subsequent specific embodiment part.
Embodiment
It should be noted that in the case where not conflicting, the feature in embodiment and embodiment in the present invention can phaseMutually combination.
Describe the present invention in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is the block diagram of the CAN test system described in the embodiment of the present invention.
As shown in figure 1, a kind of CAN test system provided in an embodiment of the present invention includes:Controller module 12, is used forCAN interference configuration signal is received, and CAN interference modules 14 are controlled according to the CAN interference configuration signal outputControl signal;CAN interference modules 14, the CAN signal for being sent according to the control signal to CAN module 16 are doneDisturb;And the controller module 12 is additionally operable to receive and exports the CAN signal after interference.
CAN test system of the present invention can be believed according to being received according to the CAN interference configurationThe control signal of number output control CAN interference modules, and then realize that the CAN signal sent to CAN module disturbs, fromAnd the CAN signal after being disturbed.Thus, it is without using expensive test equipment and various total without manually manufactureLine failure, the accuracy and testing efficiency of test can be improved while cost is reduced.
In the present invention, controller module 12 can be single-chip microcomputer SCM, that is, microcontroller.It is whole that SCM, which is mainly,The normal work of CAN test system provides various control signals and judges signal, and effect in the present invention is to realize intelligenceCan the communication between terminal and CAN test system and the communication between CAN network.
For example, hardware circuit can use 8 automobile specifieds of the U.S. micro- core (Microchip) company productionPIC18F26J50 microcontrollers can carry out the acquisition and communication of LIN signals and analog signal as master chip.Main featureHave:With CAN communication interface, directly can be connected with CAN driver, into CAN network;, can with LIN UART interfacesRe-synchronized automatically with realizing LIN master/slave mode of operation and can realize;With IIC interfaces, it is directly connected to carry out with memoryThe amendment of data and the storage of data;With spi bus interface, it can make it that the rate of interaction with control chip reaches10Mbit/s;Its normal working temperature can reach 150 DEG C, meet vehicle demand.
According to one embodiment of the present invention, the CAN interference modules 14 can include multiple relays, the controllerThe control signal that module 12 exports controls the on off state of the multiple relay, to realize that the CAN sent to CAN module 16 is totalLine signal is disturbed.
According to one embodiment of the present invention, the CAN module 16 can include CAN high-speed modules (CANH) and CAN is lowFast module (CANL).
Wherein high-speed module can for example use in the market relatively common and can be compatible CAN_FD (flexibleData rate, flexible data rate) TJA1044 transceivers, it supports 3.3V and 5V, supports Remote Wake Up and low simultaneouslyThe features such as power consumption.The peripheral circuit of high-speed module is as shown in Figure 2.
As shown in Fig. 2 wherein U0 is high-speed transceiver, its effect is to be converted into the TTL that ECAN modules are sent in SCMCAN signal, while CAN signal can be converted into TTL signal and be sent to SCM.Terminal 1,2 and 3 in Fig. 2,4 ends can be distinguishedBeing connected to the output pin of relay, (for example, terminal 1 and 2 is connected to the output end of a relay, terminal 3 and 4 is connected toThe output end of another relay), so as to select terminal resistance according to being actually needed, and according to the difference of external networkSwitch over.In the present invention, CAN module 16 can for example use 4 high-speed modules.
Also, the pin connection in high-speed module can support sleep to call out according to TJa1043datasheet (tables of data)Wake up, the record of mistake can also be supported.
Wherein low-speed module can for example use in the market relatively common and the TJA1054 of sleep awakening can be supported to receive and dispatchDevice, while the purpose of terminal coupling can be realized according to the resistance for being actually needed selection terminal resistance.For example, between terminal 5 and 7Connected by relay output end, the function that resistance selects is accomplished by relay connection between terminal 6 and 8, while can be withSupport single-wire communication.The peripheral circuit of low-speed module is as shown in Figure 3.
Similarly, the pin connection in low-speed module can be supported to sleep according to TJa1054datasheet (tables of data)Wake up, the record of mistake can also be supported.
The resistance for treating selection can be included according to one embodiment of the present invention, in the CAN interference configuration signalSize and relay switch state.
According to one embodiment of the present invention, the CAN test system also includes coder module 18, is arranged on instituteState between controller module 12 and the CAN interference modules 14, the control signal for being exported to the controller module 12 is enteredExported after row extension to the CAN interference modules 14.
By setting coder module, it is possible to achieve the CAN test of a variety of test patterns.
For example, the requirement under every kind of different test pattern to circuit is completely different, so causing number of relaysIncrease, and the control signal of oneself is required for per relay all the way, so if used completely on central control unit MCUThe GPIO (common input/output interface) in face is far from being enough, furthermore MCU workload also is difficult to meet to require.In view ofThis, employs coder module in the present invention and GPIO is extended.For example, in the case where having used coder module, makeRealize that the control to 8 output signals realizes its normal work come control relay with 3 GPIO cans.
To sum up, this hardware design disclosure satisfy that every test of CAN part of detecting, disclosure satisfy that different CANECU every test.
Wherein, by CAN test system of the present invention and intelligent terminal (for example, computer, mobile phone, flat board etc.) evenConnect, the operation to the test system can be realized by the intelligent terminal.
For example, as shown in figure 1, CAN interference configuration signal can be sent to described via USB interface 20 by computerController module 12, wherein setting USB adapter circuits 22, the USB adapter circuits between USB interface 20 and controller module 1222 are used to the signal of computer output being converted into TTL signal delivery value controller module 12, and for by controller module 12The signal of output is converted into usb signal and exported to computer.
Also, as shown in figure 1, CAN test system of the present invention is also provided with Wifi modules 24 and bluetooth mouldBlock 26, so that mobile phone and flat board can realize the transmission of signal by Wifi modules or bluetooth module.
In addition, the CAN signal after the interference that controller module 12 exports can be adapted to via the SD card shown in Fig. 1Circuit 28 is stored in SD card, is achieved in the storage to disturbed test result.Alternatively, what controller module 12 exported is dryCAN signal after disturbing can also be converted into usb signal via USB adapter circuits 22 and export to computer.
CAN test system of the present invention also includes external power supply (such as can provide 12V power supplys) 30, power supplySelection circuit 32 and power module 34.External power supply 30 and USB interface (such as can provide 5V power supplys) 20 can be the CANEach module in bus testing system is powered, and the selection of power supply can be specifically realized by selection circuit 32 of powering.
For example, power supply selection circuit 32 first detects whether external power supply 30 be present, if there is just disconnection USB interface 20Powered using the external power supply 30;Otherwise powered using USB interface 20.
When being powered using external 12V power supplys, transformation chip that power module 34 contains by 12V voltage conversion into 5V or3.3V voltages are powered for single-chip microcomputer, and 12 voltages directly can also be directly connected to CAN interference modules 14 and supply CAN by power module 34Signal is shorted to power supply use.
When being powered using USB, now power module 34 is directly powered for single-chip microcomputer, and the boost chip that it contains is defeated by USBThe 5V voltage conversions gone out are connected to CAN interference modules 14 into 12V voltages and are shorted to power supply for CAN signal.
According to one embodiment of the present invention, before the CAN interference configuration signal is received, the controller mouldBlock 12 is additionally operable to receive TCH test channel and rate selecting signal, and judges the TCH test channel according to Current communications passage and speedAnd whether the passage and speed indicated in rate selecting signal be correct, and indicated passage is activated in the right circumstances with instituteThe rate communications of instruction.
Pass through the control of the on off state to multiple relays, it is possible to achieve at least one of following test pattern is (i.e.,Realize the dependence test of physics layer line part of detecting):
CANH and CANL short circuits, CANH and GND short circuits, CANH and VCC short circuits, CANH and VBAT short circuits, CANL and GND are shortRoad, CANL and VCC short circuits and CANL and VBAT short circuits.
The principle of CAN interference sections in test pattern may refer to Fig. 4.
Wherein, VCC refers to USB power supplies (for example, can be 5V power supplys), VBAT refer to external power supply (for example,Can be 12V power supplys).
It will be appreciated by those skilled in the art that the description for each module model being related in the above-mentioned embodiment of the present invention, onlyOnly it is exemplary, is not intended to limit the present invention.
In embodiments of the present invention, when CAN interference modules do not work, whole system enters message monitoring pattern, i.e. justOften receive CAN signal.
The embodiment of the present invention additionally provides a kind of CAN test system, and the CAN test system includes controllerModule 12, the controller module 12 are used to receive CAN message interference configuration signal, and wherein CAN message interference is matched somebody with somebodyConfidence number includes treating interference position in the mark and the message to be disturbed of message to be disturbed in instruction CAN signalInformation;The controller module 12 is additionally operable to be determined in CAN signal according to the CAN message interference configuration signalTreat interference position in message to be disturbed and the message to be disturbed and export interference signal to the CAN signal;And the controller module 12 is additionally operable to receive and exports the CAN signal after interference.
CAN test system of the present invention can determine message to be disturbed in CAN signal and described treatTreat interference position in the message of interference and export interference signal to the CAN signal, so as to realize to specifying reportThe interference of text and specified location in message and the CAN signal after being disturbed.
According to one embodiment of the present invention, the controller module 12 is additionally operable to the CAN letter after output is disturbedJudge whether the bus communication state in the scheduled time is normal before number, and the bus communication state within the scheduled time is notCAN signal in the case of normal after output interference.
Fig. 5 is the flow chart of the CAN method of testing described in the embodiment of the present invention.
As shown in figure 5, a kind of CAN method of testing provided in an embodiment of the present invention includes:
S500, controller module receive CAN interference configuration signal, and according to the CAN interference configuration signalThe control signal of output control CAN interference modules;
S502, the CAN interference modules are done according to the control signal to the CAN signal that CAN module is sentDisturb;And
S504, the controller module receive and export the CAN signal after interference.
Thus, without using expensive test equipment and without manually manufacture various bus failures, cost is being reducedThe accuracy and testing efficiency of test can be improved simultaneously.
According to one embodiment of the present invention, before step S500, the CAN method of testing also includes:
S506, the controller module receive TCH test channel and rate selecting signal;
S508, the passage for judging to indicate in the TCH test channel and rate selecting signal according to Current communications passage and speedWhether (i.e., if selection is correct) correct with speed, if correctly going to step S510, otherwise go to step S506;
S510, indicated passage is activated with indicated rate communications.
The judgment mode of specific correctness can use existing mode in the prior art, and the present invention is not carried out to thisLimit.
Alternatively, it is also possible to CAN interference configuration information is write with a brush dipped in Chinese ink in single-chip microcomputer in advance, and in monolithic machine testingStart to perform follow-up disturbed test process when having data transfer to CAN network, now can be understood as local test pattern.The detection whether CAN network has data transfer voltage jump can occur to realize by detecting CAN module and whether depositing.
Fig. 6 is the flow chart of the CAN method of testing described in the embodiment of the present invention.
As shown in fig. 6, a kind of CAN method of testing provided in an embodiment of the present invention includes:
S600, CAN message interference configuration signal is received, wherein CAN message interference configuration signal includes instructionThe information for treating interference position in CAN signal in the mark and the message to be disturbed of message to be disturbed;
S602, message to be disturbed in CAN signal and institute are determined according to the CAN message interference configuration signalState in message to be disturbed and treat interference position;
S604, output interference signal to the CAN signal (that is, start interference), such as interference signal be with it is currentThe opposite signal of signal level;And
S606, receive the CAN signal after interference;
S608, the CAN signal after output interference.
CAN test system of the present invention can determine message to be disturbed in CAN signal and described treatTreat interference position in the message of interference and export interference signal to the CAN signal, so as to realize to specifying reportThe interference of text and specified location in message and the CAN signal after being disturbed.
In the method, step S602 includes:
S6020, the mark of the message in CAN signal is detected, detect ID;
S6022, judge to be detected identifies whether as the mark of message to be disturbed, if going to S6024, otherwise to returnReturn S6020;
S6024, detect the position of the message to be disturbed in CAN signal;
S6026, judge whether detected position is to treat interference position, if going to S6028, otherwise goes to S6024;
S6028, treat that interference position moves to right scheduled volume (for example, 0.5TQ), go to step S604.
According to one embodiment of the present invention, before S608, the CAN method of testing also includes:
S610, judge whether the bus communication state in the scheduled time (for example, 20s) is normal, if normally going to stepS6028, otherwise go to step S608.
For example, when CAN adopts sampled point of 1/16 width of a position as one position, when the non-sampled point of interferenceBus, when being moved to sampling point position, because level is disturbed, therefore false alarm can occur with normal communication when positionText, the error message will be output.So can be by determining the position of sampled point to the detection of communication state.
Above-mentioned method is corresponding with foregoing system respectively, refers to portion is corresponded in method for the detailed description of methodPoint, it will not be repeated here.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present inventionGod any modification, equivalent substitution and improvements made etc., should be included in the scope of the protection with principle.