A kind of compatibility automated test macro of USB flash disk of vehicular transreceiver and method
Technical field
The present invention relates to the compatibility automated test macro of a kind of USB device, specifically refer to the compatibility automated test macro of a kind of USB device of vehicular transreceiver; The invention still further relates to a kind of USB device compatibility automated test method.
Background technology
At present, the USB flash disk compatibility test of cassette car radio is all manually come, in manual operation process, a USB device can only be tested at every turn, namely artificial by a USB flash disk insertion cassette car radio, and judge that whether this USB flash disk is compatible with cassette car radio according to whether the sound signal of cassette car radio output is identical with the signal be stored in advance in USB flash disk, when testing different brands, the USB device of different capabilities and cassette car radio compatible, need repeatedly to plug USB device, repeatedly intercutting USB makes testing efficiency reduce, and cannot determine the reading time of USB.
Summary of the invention
To the object of the invention is to overcome in above-mentioned prior art existing manual operation efficiency low and can not determine the defect of the reading time of USB flash disk, the compatibility of the multiple USB flash disk of the fast automatic test of a kind of energy is provided and the compatibility automated test macro of USB flash disk and the method that USB flash disk reads the vehicular transreceiver of time can be tested.
The object of the invention is to be achieved through the following technical solutions: a kind of compatibility automated test macro of USB flash disk of vehicular transreceiver, comprises control center, vehicular transreceiver and USB flash disk to be measured, also comprise:
Multiple USB flash disk to be measured is connected to vehicular transreceiver, and switches the USB commutation circuit of the break-make of multiple USB flash disk to be measured and vehicular transreceiver;
Be connected between control center and described USB commutation circuit, for receiving the steering order of control center and controlling the usb communication circuit of the switching action of described USB commutation circuit;
Be connected between vehicular transreceiver and control center, the sound signal for being exported by vehicular transreceiver is converted to the audio conversion circuit of control center's discernible signal;
Be connected with control center, for stealing voltage from control center, and to the USB port stealing circuit that described USB commutation circuit and audio conversion circuit are powered;
Particularly, described usb communication circuit comprises control chip, multiple I/O mouths of control chip connect multiple switches of USB commutation circuit respectively, and control chip receives the control command that control center sends, by controlling the break-make of the level control USB commutation circuit switch of multiple different pin;
Particularly, described USB commutation circuit is provided with multiple switch, multiple pins of the control chip of above-mentioned usb communication circuit connect described multiple switch respectively by triode, be specially the base stage of the pin connecting triode of control chip, the emitter connecting valve of triode, the collector of triode connects USB port stealing circuit steals voltage output terminal from control center, one end corresponding USB interface respectively of described each switch, for connecting multiple USB flash disk to be measured, the other end of switch is all connected to vehicular transreceiver;
In order to accelerate the handoff procedure of USB flash disk, reduce electric quantity consumption, described switch adopts three open type dry-reed relays;
The input end of described audio conversion circuit is connected with the audio output of vehicular transreceiver, and the output terminal of audio conversion circuit is connected with the microphone interface of control center.Described audio conversion circuit forms primarily of an amplifier and signal acquisition module, signal acquisition module forms primarily of multiple sampling resistor, the output terminal that signal acquisition module and USB port stealing circuit steal voltage is connected the input end of described amplifier, and the output terminal of amplifier is connected with the microphone interface of control center.
In order to realize another goal of the invention of the present invention, the USB flash disk compatibility automated test method of a kind of vehicular transreceiver provided by the invention is as follows:
(1), in the controlling the heart pre-set number, the compatible time limit of USB flash disk to be measured and read the relevant parameters such as time limit, in each USB flash disk to be measured, prestore a fixed frequency value is the audio file of mKHz simultaneously;
(2), set test count N from 1, N is natural number;
(3), judge whether test count N is greater than the number of USB port in USB commutation circuit, if test count N is greater than the number of default USB flash disk to be measured, then terminate test; Otherwise, perform next step;
(4), judge whether current test USB flash disk is selected to connect with vehicular transreceiver, if this USB flash disk access failure, then test count N cumulative 1, and repeat step (3); If current test USB flash disk is selected to connect, then perform next step;
(5), the test procedure of control center sends control command, and usb communication circuit receives the steering order of control center, and the corresponding switch of control USB commutation circuit closes, the USB flash disk that turn on-switch is corresponding, and starts timing;
(6), judge whether control center receives the signal of mKHz, if control center does not receive the signal of mKz, perform step (7); If control center receives the signal of mKHz, then timing terminates, and performs step (8);
(7), judge whether timing time is greater than the compatible time limit, if be not more than the compatible time limit, then repeat step (6), if be greater than the compatible time limit, then export the result of " incompatible ", test count N cumulative 1, and repeat step (3);
(8), judge whether the reading time is greater than the reading time limit pre-set, if the reading time is greater than read the time limit, then export result and the time of reading of " NG "; Otherwise export " OK " result and the time of reading, described " NG " represents that current test USB flash disk needs the reading time longer, and compatible bad, " OK " represents that current test USB flash disk needs the reading time longer, compatible good;
(9), after control center outputs test result, test count N cumulative 1, and repeat step (3).
In said method, the described fixed frequency value of step (1) is the audio file of mKHz, is preferably the MP3 audio file of 1KHz.
The present invention has the following advantages and beneficial effect compared to existing technology:
1, the present invention utilizes programmed control test process, can accomplish that automatic test is compatible and read reading time of USB flash disk, saving manpower.
2, the present invention disposablely can carry out programmed control test to multiple USB flash disk, and testing efficiency is high, and can according to actual conditions to system extension to disposable test 64 even 128 USB flash disks.
3, the switch of USB commutation circuit uses dry-reed relay, accelerates handoff procedure, and the power voltage supply using stealing circuit to steal from PC testing, without the need to additional power supply, be easy to carry.
4, circuit component is cheap, and cost performance is high.
Accompanying drawing explanation
Fig. 1 is the hardware structure diagram of the compatibility automated test macro of USB flash disk of a kind of vehicular transreceiver of the present invention;
Fig. 2 is the schematic diagram of usb communication circuit;
Fig. 3 is the schematic diagram of USB commutation circuit;
Fig. 4 is the schematic diagram of audio conversion circuit;
Fig. 5 is test flow chart.
Embodiment
Below in conjunction with embodiment and accompanying drawing, the present invention is described in further detail, but embodiments of the present invention are not limited thereto.
Embodiment
As shown in Figure 1, a kind of compatibility automated test macro of USB flash disk of vehicular transreceiver, comprise control center, vehicular transreceiver and USB flash disk to be measured, control center is PC in this embodiment, and native system also comprises:
Multiple USB flash disk to be measured is connected to vehicular transreceiver, and switches the USB commutation circuit of the break-make of multiple USB flash disk to be measured and vehicular transreceiver;
Be connected between PC and described USB commutation circuit, for receiving the steering order of PC and controlling the usb communication circuit of the switching action of described USB commutation circuit;
Be connected between vehicular transreceiver and PC, the sound signal for being exported by vehicular transreceiver is converted to the audio conversion circuit of PC discernible signal;
Be connected with PC, for stealing voltage from PC, and to the USB port stealing circuit that described USB commutation circuit and audio conversion circuit are powered;
As shown in Figure 2, described usb communication circuit comprises MW2332 chip, 32 I/O mouths (P00 ~ P37 pin) of MW2332 chip connect 32 switches of USB commutation circuit respectively, usb communication circuit is also connected with PC by USB A, MW2332 chip receives the control signal that PC sends, and control P00 ~ P37 pin sends the break-make of the height control USB commutation circuit switch of level respectively;
As shown in Figure 3, described USB commutation circuit is provided with 32 switches (S1 ~ S32), described switch is specially three open type dry-reed relays, 32 pins (P00 ~ P37) of above-mentioned usb communication circuit MW2332 chip connect described switch (S1 ~ S32) respectively by a triode, be specially the base stage of the pin connecting triode of MW2332 chip, the emitter connecting valve of triode, the collector of triode connects the 5V voltage output end that USB port stealing circuit is stolen from PC, one end corresponding USB interface (USB1 ~ USB32) respectively of described each switch (S1 ~ S32), for connecting multiple USB flash disk to be measured, the other end of switch all connects vehicular transreceiver by USB port.
Described USB commutation circuit performs switching action, the connecting and disconnecting of every road USB flash disk to be measured and vehicular transreceiver are controlled respectively by the break-make of switch (S1 ~ S32), when in usb communication circuit, the pin of MW2332 chip is high level, by triode ON, after the coil electricity of dry-reed relay, dry reed attracts each other, and switch closes thus connects circuit, and now USB flash disk and vehicular transreceiver are connected; When pin sends low level, triode ends, and after the coil blackout of dry-reed relay, dry reed separately, and switch opens is by circuitry cuts, and USB flash disk disconnects the connection with vehicular transreceiver.
Change-over switch adopts dry-reed relay matrix, accelerates the handoff procedure of USB flash disk, reduces electric quantity consumption, and uses PC power and test by USB port stealing circuit, without the need to additional power supply, makes test convenient.
As shown in Figure 4, the input end of described audio conversion circuit is connected with the audio output (SPEAKER+, SPEAKER-) of vehicular transreceiver, and the output terminal (OUT) of audio conversion circuit is connected with the microphone interface of PC.Described audio conversion circuit forms primarily of an amplifier UTC4558 and signal acquisition module 100, signal acquisition module 100 forms primarily of sampling resistor 220R, R302 and R304, the 5V voltage output end that signal acquisition module 100 and USB port stealing circuit are stolen is connected the input end of amplifier UTC4558, and the output terminal of amplifier UTC4558 is connected with the microphone interface of PC.After sampling resistor 220R carries out dividing potential drop sampling to the sound signal that vehicular transreceiver exports, by sampled signal input amplifier UTC4558, sampled signal is just converted to the sound signal that PC can identify safely after amplifier UTC4558 carries out amplifying process, and be input in PC, judged by the sound signal of inner test procedure to input by PC, obtain compatibility test result and the reading time of USB flash disk.
The present invention can disposable test 32 different capabilities, different brands the compatibility of USB flash disk, and can according to actual needs system to be expanded, easily extensible disposable test 64 or 128 USB flash disks.
Present invention also offers a kind of USB flash disk compatibility automated test method of vehicular transreceiver, the reading time after the method is accessed by the USB flash disk compatibility and USB flash disk adopting the various different brands of test procedure automatically testing, different capabilities, as shown in Figure 5, its concrete steps are as follows:
Step S101, pre-setting the number of USB flash disk to be measured, compatible time limit, reading the time limit and in each USB flash disk to be measured, prestore a fixed frequency value is the audio file of mKHz, described fixed frequency value is the audio file of mKHz in the present embodiment, is preferably the MP3 audio file of 1KHz;
Step S102, setting test count N is from 1;
Step S103, judge whether test count N is greater than the number of USB port in USB commutation circuit, in the present embodiment, USB commutation circuit is not expanded, therefore USB commutation circuit has 32 USB port, if test count N is greater than 32, then performs step S110, namely terminates test; Otherwise, perform step S104;
Step S104, judges whether current test USB flash disk is selected to connect with vehicular transreceiver, if current test USB flash disk and vehicular transreceiver access failure, then performs step S109; If this USB flash disk is selected to connect, then perform step S105;
Step S105, the test procedure of PC sends control command, and usb communication circuit receives instruction, and the corresponding switch of control USB commutation circuit closes, the USB flash disk that turn on-switch is corresponding, and starts timing;
Step S106, judge whether PC receives the signal of 1KHz, when turn on-switch, if USB flash disk and radio and tape player compatibility, then radio and tape player starts the audio file that reads in USB flash disk, and the 1KHz signal of loudspeaker output audio file by radio and tape player, the power conversion through audio conversion circuit is input to the microphone of PC, the 1KHz signal that PC receives audio file then timing terminates, and performs step S108; If USB flash disk and radio and tape player incompatible, radio and tape player cannot read the audio file in USB flash disk, and PC cannot receive the 1KHz signal of audio file, then perform step S107;
Step S107, judges whether timing time is greater than the compatible time limit, if be not more than the compatible time limit, then repeats step S106, if be greater than the compatible time limit, then export the result of " incompatible ", perform step S109;
Step S108, judges whether the reading time is greater than the reading time limit pre-set, if the reading time is greater than read the time limit, then exports result and the time of reading of " NG "; Otherwise export " OK " result and the time of reading;
Step S 109, test count N cumulative 1, and repeat step S103.
By this test procedure, achieve compatibility and the reading time of automatic test USB flash disk, save manpower, effectively improve testing efficiency.
Above-described embodiment is the present invention's preferably embodiment; but embodiments of the present invention are not restricted to the described embodiments; change, the modification done under other any does not deviate from Spirit Essence of the present invention and principle, substitute, combine, simplify; all should be the substitute mode of equivalence, be included within protection scope of the present invention.