Академический Документы
Профессиональный Документы
Культура Документы
cn
Abstract
Using the OmniVision OV7620 CMOS image sensor as photoelectric imaging device,
glueless connecting was achieved between the USB2.0 controller CY7C68013A and
the sensor by general programmable interface (GPIF). The simple high efficiency and
low-cost hardware which be apt for high speed image capture was designed and the
software system was also compiled based on the multi-thread technology. The image
processing system with acquisition, transmission and display was designed based on
the new type CMOS image sensor and USB2.0 controller.
KeywordsCMOS image sensorUSBCY7C68013AGPIF
1 Introduction
Because of the rapid development of the semiconductor technics, Complementary Metal Oxide
Semiconductor (CMOS) [1-3] image sensor makes progress quickly in recent years because of its low cost,
small volume, light weight, low power consumption and single chip integration compared with traditional
CCD [4-5] sensor. It has become the key facility of image processing technology and has been applied to a
great many fields such as video camera, digital camera, mobile communication, safeguard, and pattern
recognize. In illustration of USB Image acquisition system, OmniVision single chip OV7620 is described
in this paper, including its features, operate mode and usages.
The Universal Serial Bus (USB) has gained wide acceptance as the connection method of choice for PC
peripherals. Equally successful in the Windows and Macintosh worlds, USB has delivered on its promises
of easy attachment, an end to configuration hassles, and true plug-and-play operation. USB brings the
ultimate in implicity when connecting peripheral devices. The longer needs to determine the right
connection for the mouse versus the keyboard. There isnt a different cable for the monitor, printer, or high
storage capacity external disk drive. The user never has to determine if the connection is a parallel or serial
port. In the world of USB, there are no longer dip switches, jumpers, IRQ conflicts, and DMA conflicts. In
fact, users will always be able to connect or disconnect a new device when the PC is up and running. Now
thats true Plug and Play! Because of this consistency and simplicity of connection, USB will make it easy
to add peripheral image acquisition system that was previously thought to be too difficult for the average
user.
To sum up, it has been very important and necessary to integrate all the advantages of CMOS image sensor
and USB interface into the image acquisition system. In this paper, we use the OmniVision OV7620 CMOS
[6] image sensor and Cypress FX2LP high-speed USB2.0 CY7C68013A [7-8]as the main chips to achieve
our design.
2 Hardware Design
2.1 CMOS Image Sensor
OmniVision OV7620 is a highly integrated high resolution (640x480) Interlaced / Progressive Scan
CMOS digital color /black&white video camera chip. The digital video port supports 60Hz YCrCb
-1-
http://www.paper.edu.cn
4:2:2 16Bit / 8 Bit format [9], ZV Port output format, RGB raw data 16Bit/8Bit output format and
CCIR601/CCIR656[10-11] format. The builtin SCCB interface provides an easy way of controlling
the builtin camera functions.
Referring to Fig 1.
http://www.paper.edu.cn
3. Software Design
3.1 Firmware
In order to simplify the design and make the engineers concentrate their attention on the function not
to waste their time on the complex protocol, it is necessary and convenient to use the integrate
framework. The framework is helpful to the research worker to realize the most parts of the USB
protocol. According to peripheral device and requirement, we just need to write different functions to
finish our design. To be aimed at the high-speed data and the USB 2.0 protocol, there are several
aspects in our firmware software design:
3.1.1 Initial The USB Port and Fifo Register:
Set the 8051 CPU clock to 48MHz. Set the endpoint2 IN, bulk, size 512, 4x buffered. Set NAKALL
bit to NAK all transfers from host. Reset EP2 FIFO and clear NAKALL bit to resume normal
operation. Set EP2FIFOCFG register auto in mode, disable PKTEND zero length send, word ops.
-3-
http://www.paper.edu.cn
Initialize GPIF registers For EP2IN, GPIF uses FF flag. Initialize global FLOWSATES register. Parts
of the program are as follows.
CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1);
SYNCDELAY;
EP2CFG = 0xA0;
SYNCDELAY;
FIFORESET = 0x80;
SYNCDELAY;
FIFORESET = 0x02;
SYNCDELAY;
FIFORESET = 0x00;
SYNCDELAY;
EP2FIFOCFG = 0x10;
GpifInit ();
EP2GPIFFLGSEL = 0x01;
SYNCDELAY;
EP6GPIFFLGSEL = 0x02;
FLOWLOGIC = FlowStates[19];
FLOWSTB = FlowStates[22];
GPIFHOLDAMOUNT = FlowStates[26];
FLOWSTBEDGE = FlowStates[24];
FLOWSTBHPERIOD = FlowStates [25];
SYNCDELAY;
http://www.paper.edu.cn
{
GPIFTCB1 = 0x01;
SYNCDELAY;
GPIFTCB0 = 0x00;
SYNCDELAY;
}
Setup_FLOWSTATE_Read();
SYNCDELAY;
GPIFTRIG = GPIFTRIGRD | GPIF_EP2;
SYNCDELAY;
while( !( GPIFTRIG & 0x80 ) )
{
;
}
SYNCDELAY;
There is another software GPIF TOOL use to generate the C code file which was compiled in the
firmware project. Referring to Fig 2.
GPIF is an internal master to the CY7C68013As endpoint FIFOs. It replaces the external glue logic
which might otherwise be required to build an interface between the CY7C68013A and the outside
world. At the GPIFs core is a programmable state machine which generates up to six control and
nine address outputs, and accepts six external and two internal ready inputs. Four user-defined
Waveform Descriptors control the state machine; generally (but not necessarily), one is written for
FIFO reads, one for FIFO writes, one for single-byte/word reads, and one for single-byte/word
writes.Only the FIFO reads waveform have been used in our design. Referring to Fig 3.
-5-
http://www.paper.edu.cn
In order to achieve the maximum USB 2.0 High-speed bandwidth, the CPU (in this case an enhanced
8051) should never be directly involved in moving the payload data from the external slave device to
the USB host and vice versa. The CPU would clearly be the largest bottleneck in a High-speed design.
So instead we adopt an Auto-Transfer mode, whereby the payload data is auto-committed from the
external slave device to the USB host and likewise in the other direction. The GPIF engine uses this
Auto-Transfer mode to move data to and from the external slave device.
As mentioned above, the GPIF engine generates the GPIF waveform descriptors that implement the
physical bus timing. The GPIF engine can implement multiple waveform behaviors, which can then be
assigned to four waveform types. The assignment is made through the GPIFWFSELECT register
setting. Each descriptor is 32 bytes long and resides in a special GPIF waveform descriptor area in
on-chip memory space, once loaded by the CPU. When we finish the GPIF design, these descriptors
will be add to firmware project and compiled soon.
http://www.paper.edu.cn
prompt for a driver, it has already matched the device to a driver itself. In this case, manually instruct
Windows to use that driver.
The application software was compiled by Borland C++ Builder 6.0. CYAPI.H [16] and CYAPI.LIB
was cited in the software for opening the device and transmiting data.
Take accout of the high-speed data rates, double buffer technology and scanline method were adopt in
the multi-thread software. Parts of the program are as follows.
Graphics::TBitmap*tmpBitmap=newGraphics::TBitmap();
tmpBitmap->Assign((TPersistent*)Image1->Picture->Graphic);
tmpBitmap->PixelFormat=pf24bit;
USBDevice->BulkOutEndPt->XferData(buf, length);
//Asynchronous transfer mode.
BeginDataXfer(buffer, length, &outOvLap);
BeginDataXfer is an advanced method for performing asynchronous IO. This method sets-up all the
parameters for a data transfer, initiates the transfer, and immediately returns, not waiting for the
transfer to complete. BeginDataXfer allocates a complex data structure and returns a pointer to that
structure. FinishDataXfer de-allocates the structure. Therefore, it is imperative that each
BeginDataXfer call have exactly one matching FinishDataXfer call.
There are two threads in the application software. Capturing the image data occupy one thread
specially. With this method, we can get the image data smoothly and avoid no respond to system when
transmit the USB data. The application software display interface. Referring to Fig.4
http://www.paper.edu.cn
4. Summary
This USB image acquisition system adopt the new type CMOS image sensor OV7620 and USB 2.0
highspeed controller CY7C68013A to realize the design which has created a very cost-effective,
simple high efficiency and low-cost solution compare with the traditional method. It can be applied to
a great many fields such as video camera, automatic device, robot, mobile communication, safeguard,
and pattern recognize conveniently and flexibly.
References
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
Abbas El, Gamal Helmy Eltoukhy, CMOS image sensors, IEEE Circuits & Devices, pp. 6-20, May/June 2005.
B. Fowler, A. El Gamal, and D.X.D. Yang, A CMOS area image sensor with pixel-level A/D conversion, IEEE
Int. Solid-State Circuits Tech, Dig., pp. 226227, 1994.
N. Stevanovic, M. Hillegrand, B.J. Hostica, and A. Teuner, A CMOS image sensor for high speed imaging, in
ISSCC Tech. Dig., vol. 43, pp. 104105, 2000.
N. S. Saks, A technique for suppressing dark current generated by interface states in buried channel CCD
imagers, IEEE Electron Device Lett, vol. 1, pp. 131133, July 1980.
OV7620 Product Specifications-Rev. 1.3 2000.http://www.ovt.com.
CY7C68013 EZ-USB FX2 USB Microcontroller Data Sheet Rev. *B. Cypress Semiconductor Corporation, June
2002.
The EZ-USB FX2 Technical Reference Manual Version 2.1. Cypress Semiconductor Corporation, 2001.
Cliff Reiter, "With J: image processing 2: color spaces,"
ACM SIGAPL APL Quote Quad, Vol.34, Issue 3,
pp3-12, June 2004.
James M. Kasson, Wil Plouffe, "An analysis of selected computer interchange color spaces," ACM Transactions
on Graphics (TOG), Vol.11, Issue 4, pp373-405, October 1992.
Didier Le Gall, "MPEG: a video compression standard for multimedia applications,"
Communications of the
ACM, Vol.34, Issue 4, pp47-58, April 1991.
EZ-USB FX2 GPIF Primer. Cypress Semiconductor Corporation, March 2003.
B. Hill, Th. Roger, F. W. Vorhagen, "Comparative analysis of the quantization of color spaces on the basis of the
CIELAB color-difference formula,"ACM Transactions on Graphics (TOG), Vol.16, Issue 2, pp109-154, April
1997.
Cypress CyUsb.sys Programmer's Reference.2003
Cypress USB Console Users' Guide.2003.
Cypress CyAPI Programmer's Reference.2003.
-8-