The fictitious oscillograph of USB interface based on CH371 is designed

Author Email: violit@netease.com

Summary: This text introduces the design plan of the fictitious oscillograph of interface of a USB, has introduced principle and application of USB bus interface chip CH371 especially, have reduced the threshold that USB system developed, and reach the satisfactory result.

Keyword: USB interface, fictitious oscillograph, CH371, the high-speed data are gathered

First, foreword

To the teaching experiment of the school and some particular demands, perhaps simulation and digital oscillograph on the market is not applicable at present, the price is high, the volume is larger and a lot of professional functions are impracticable. The popularization intensity of the computer reaches the suitable scale too now, adopt the module to realize a flexible and convenient fictitious oscillograph can meet the working, studying and developing of the great majority’s needs with computer and additional number, and can realize that handles the function in quite complicated signal through the hardware of lower cost and upgrade of the software, can realize that disposes the flexible intellectual instrument association with lower cost, smaller volume; Can well bind with portable computer, form and measure and maintain the work station portably. A computer combines the data collector of communication of port at present, but the application of USB is becoming more extensive and deepens, if merging USB function can realize higher data transmission rate, more convenient occupation mode inside, it is the superior performance of embodying the fictitious instrument even more.

Second, hardware are designed

The data collector of this fictitious oscillograph is made up of module of following function: The front signal varies the module, modulus at a high speed and changes the module, high-speed data and buffers the module, one-chip computer and controls module, USB interface module and power module. Front signal vary and high-speed data gather have ripe scheme and can according to index of need, for example sampling rate, range control, sampling the depth etc. to design, mainly discuss the development of USB interface part here.

The development of USB interface was a troubling question in the past, though a lot of designers yearned for the advantage that USB interface transmits at a high speed, supplies power independently, uses simultaneously, obstacle of developing and driving procedure making that but it is more difficult to go beyond its agreement firmware. In this scheme, I select one for use without needing agreement firmware of development and USB bus interface chip of the driver.

Nanjing ooze permanent Company ‘ www.winchiphead.com CH371 introduced is a common interface chip of a USB bus, it utilizes hardware logic to shield all agreements in USB communication, offer the end-to-end connection in the computer employs layer and local end controller. Because of CH371, the designer does not need to understand any USB agreement, firmware procedure and driver, can easily original and mouth, bunches of products of mouth upgrade to the intersection of USB and interface, enjoy the superiority that USB interface brings with lower risk and cost.

The end here while using, CH371 has 8 data bus and reading, writing, chip selection to control the line and stop exporting, hang on the systematic bus which is received controllers such as DSP, MCU,etc. conveniently as operating and generally setting up the chip outside; On the end of computer, the software kit of CH371 includes the common driver and employs software package, having offered the succinct operation interface apt to use, and the one-chip computer communication of local end is simple like reading and writing the file in the hard disk, the developer can use high-level languages such as VB, VC, C Builder,etc. to develop. Generally speaking, it considers USB communication agreement, firmware procedure, driver, disposes course, ground floor data transmission course to design USB products on the basis of CH371. What the designer will do works like products of design, mouth, one bunch of mouths, include two things: First, send out data transmission to ask and receive and reply from application layer of the computer; Second, when the controller of USB products is notified data transmission to ask, reply.

At the same time, direct management, directness of 16 addresses that CH371 has offered I2C device on the basis of offering transparent USB agreement read and write and is restored to the throne, guards the gate functions such as the dog,etc., the local end does not even use the one-chip computer to finish the simple control function, so have stronger function adaptability, can meet the needs of different occasions, effective systematic cost of reducing.

In this system what used is the products that SOP28 encapsulated, the foot of his tube is defined as follows:

According to different working ways, there can be the following aspects in the interface type of the chip: Interface, I2C main interface, top management way interface run side by side passively. It is the most frequently used way that among them the interface runs side by side passively, it offers the connections of one-chip computer and computer, CH371 is regarded as a passive peripheral hardware of the one-chip computer; I2C main interface read and write one the intersection of EEPROM and device directly through one-chip computer under the control of end procedure of the computer CH371 ‘ For example 24C04,etc. ,The product information that is often used in having outside USB is noted down; Top management way interface to use one-chip computer, directly control 16 8 data of address that CH371 offer, it reads and writes to be or a dozen the intersection of IO and the intersection of mouth and line by the intersection of computer and the intersection of end and procedure, this way is used mainly for finishing the relatively simple external control task. These kinds of interface ways are not totally opposite, can follow the flexible disposition of need. Use it in order to set up the device outside one of the one-chip computer in the fictitious oscillograph here, using A3 A0 for the top management way at the same time is controlled four LEDs by the computer.

The control of the one-chip computer to CH371 relies on the operation to 16 registers of its inside to realize. The addresses of these 16 registers have two kinds of definition ways. A is to have the electricity after resetting acquiescence is a direct address way, A3 is the register address the foot of four tubes of A0, this way is comparatively simple, but need to use one-chip computer more IO a resources; Another kind is switched over and replied and used address way after the rising that CH371 measures on ALE foot is along the signal, the register address is controlled by D3 D0 of the data bus, judge according to the jumping and changes of ALE a register is operated or the data are read and written. Because the high-capacity data are buffered to need using to 74373 and latching as the address in this design, so even use the direct address way not to need to take up more one-chip computer resources either, for come out, drive LED select A3 A0 for use, reply, spend address way sparingly.

According to the request of system we design the hardware as follows.

USB interface offer the data interchange and power supply with ‘ Used as AD at a high speed after varying appropriately ,CH371 shake, down time work frequently, offer until one-chip computer offer, guard the gate the dog is reset and outputted the function while in interface while being brilliant in 12M, I2C top management function was not used, A3 A0 can be calculated to control and drive 4 LEDs to reveal signals as the job. Mouth group P1 of the one-chip computer 89C52 is used for controlling the data to gather the module, including range changes control, AD and touches off signals, gathers the data and overflows signals etc.; Buffer 62256 and control preserving the result that AD at a high speed gathers through CPLD of the low consumption at a high speed, the one-chip computer reads the data among them to is conveyed to the data of the computer and reveals by CH371 and analyzes the software regularly, realize the fictitious oscillograph function. One-chip computer, CH371 and some principle pictures of RAM are as follows:

Fig. three One-chip computer, CH371 and some principle pictures of RAM

Third, software design

The end software of the one-chip computer:

The end software of the one-chip computer mainly finishes the data and gathers control, these two functions of the data report. Among them it gather data control according to computer end what software presume gain, when there control data not to be lasted module is base, touching off parameter, use the computer and send a small amount of control information to the one-chip computer inside; Data report function need one-chip computer convey first all data to gather cycle buffer, to the end software of the computer, this belongs to transmission of the data in enormous quantities. We put the focal point that recommend in the one-chip computer and communication of the computer.

One-chip computer and compunication are through operating realizing to the register of CH371, ask reference data manual about detailed conditions that register define its.

Need to pay attention to in employing, the one-chip computer that CH371 offers receives the buffering area as the 8 bytes, spread the data segmentation under the computer that exceeds 8 bytes; And the sending buffering area of the one-chip computer is the 8 bytes, the uploading data which exceed the 8 bytes need to divide numerous uploading. In addition, the break of CH371 is including uploading and accepting successfully, stop after taking place the concrete situation needs distinguishing by transmitting the state register; Disconnected level is single steady state among them meanwhile, an incident cuts off signals to jump and change after happening, but only resume once keeping a transient pulse, this is treatment that is done in order to cooperate with the processor of different speed.

USB subprogram example of the main function of communicating of one-chip computer and computer is as follows: the address that please join the corresponding register of CH371 while using is defined
file: //**********CH371 initialized procedure ******************************
void ch371_init
{
CH371_INT_SET =0; file: //CH371 cuts off the address skew that the data presume the register
CH371_LENGTH =0X0F; file: //It is 15 to put and upload the register of length of the data, show that there is no data to upload at the moment
save_length =0; file: //Keep and spread the length of the data
IT0 =1; file: //The outside signal, in order to drop along touching off
IE0 =0; file: //Clear to cut off the sign
PX0 =1; file: //Put high PRI
EX0 =1; file: //Allow to cut off
}
file: //***********Upload the data subprogram ********************************
void ch371_uploadunsigned char len file: //The parameter spreads into the length of the data
{
unsigned char i;
unsigned char *up_buf;
unsigned char *ch371_buf;
iflen! =0
{
up_buf =

Tags: , , , , , ,

This entry was posted on Friday, March 11th, 2011 at 4:13 am and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply