Image acquisition system realized by FIFO chip and single chip microcomputer

Publisher:phi31Latest update time:2012-05-29 Source: 单片机与嵌入式系统 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Introduction
In the microcontroller application system, it is quite difficult to completely store an image of 30 fps and 640×480 pixels due to the limitations of image acquisition speed, program memory and data memory addressing space. This paper uses a high-performance 16-bit Freescale microcontroller to directly acquire images at ultra-high frequency, but can only acquire 320 pixels per line, lose images, and cannot obtain a complete image. This paper solves this problem better by adding a FIFO chip AL422B in the image acquisition process, which reduces the cost of the image acquisition system compared to the expensive DSP. 1

Monocular point light source ranging principle
When working in the field, it is necessary to know the distance between the front benchmark and the observation point during movement. This paper makes the benchmark into an equally spaced infrared point light source benchmark, which meets the requirements of the pinhole imaging principle ranging model based on a single-frame static image, reduces the amount of image processing, and improves the real-time and all-weather performance of the measurement. H is the actual distance of each point light source benchmark; n is the number of point light sources, which can be obtained through image processing; f is the focal length of the camera; the actual pixel physical distance h of the ruler is obtained by camera calibration. The schematic diagram of the long-distance ranging principle is shown in Figure 1, where the entire point light source pole is within the camera's field of view. The schematic diagram of the short-distance ranging principle is shown in Figure 2, where only part of the point light source pole is within the camera's field of view. From Figure 1, the distance D between the front pole and the observation point can be calculated. The imaging geometry of the camera can also be approximately expressed by the pinhole imaging principle:
a.JPG

b.JPG

c.JPG [page]

2 Hardware Design of Image Acquisition System
According to the requirements of monocular vision ranging, a black and white camera is required to collect the point light source benchmark of the front vehicle in real time, and the distance of the front vehicle is calculated by the pixel distance of the point light source on the ruler. In order to read the image completely, this paper adds a FIFO chip, and the schematic diagram of the image acquisition principle is shown in Figure 3. The single-chip microcomputer monitors the line/field signal of the camera and controls the FIFO to read the corresponding image; after reading all the lines, the FIFO image reading function is turned off, and the single-chip microcomputer starts to read the image data from the FIFO and performs corresponding image processing. According to the complexity of the image processing, the time ratio of image processing and image acquisition is determined. Since FIFO is first-in-first-out, the single-chip microcomputer only needs to enable the line/field signal through an interrupt when reading data, and the single-chip microcomputer can be used for image processing most of the time. This paper adopts that after collecting a frame of image, the single-chip microcomputer uses the idle time of two frames of image and the next frame of FIFO acquisition time, a total of about 3 frames of time for image processing and control, the result is that the image changes from the original 30 fps to 10fps. Although the frame rate is slow, analysis shows that at 100 km/h, the lag distance is 2.8 m, which meets the requirements.

d.JPG


2.1 Freescale 16-bit MCU MC9S12DG128
This article uses Freescale 16-bit MCU MC9S12DG128 as the main control chip. This chip is an enhanced, automotive-grade 16-bit microcontroller in the S12 series of microcontrollers launched by Freescale. The on-chip bus clock frequency can reach up to 25 MHz. It integrates 8 KB RAM, 128KB Flash, and 2 KB EEPROM. It has high integration and rich resources.
2.2 Camera chip OV7670
OV7670 is a Camerachiptm image sensor launched by OmniVision. It has a small size and low operating voltage. The VGA image can reach up to 30fps. Its main features are:
◆ Photosensitive array (a total of 656×488 pixels, and the effective pixels in YUV mode are 640×480);
◆ High sensitivity is suitable for low-light applications and is sensitive to infrared light;
◆ Standard SCCB interface, compatible with I2C bus interface;
◆ RawRGB, RGB (GRB4:2:2, RGB565/555/444), YUV (4:2:2) and YCbCr (4:2:2) output formats;
◆ Support VGA, CIF and various sizes from CIF to 40×30.
2.3 FIFO chip AL422B
AL422B is a FIFO storage chip with a storage capacity of 393 216 bytes × 8 bits launched by AverLogic. All of its addressing, refreshing and other operations are completed by the control system integrated in the chip. The internal functional structure block diagram of AL422B is shown in Figure 4.

e.JPG


The main features of AL422B are:
◆ The storage body of AL422B is 3 Mb (393 21 6 bytes × 8 bits);
◆ It can store one frame of graphics information in VGA, CCIR, NTSC, PAL and HDTV formats;
◆ Independent read and write operations, can accept different I/O rates;
◆ High-speed asynchronous serial access;
◆ Read and write cycle is 20 ns;
◆ Access time is 15 ns;
◆ Internal DRAM self-refresh.

[page]

3 Image acquisition system program design
3.1 System implementation
To realize static storage of digital images in the single-chip microcomputer application system, two major problems must be solved: storage speed and storage capacity. For the speed problem, it is necessary to analyze the data output timing of OV7670 to meet the requirements. The VGA timing diagram is shown in Figure 5. PCLK is the pixel clock, and its frequency is consistent with the main frequency, that is, 27 MHz. The data output is valid on the rising edge; VSYNC is the field signal;

f.JPG


HREF is the horizontal reference signal, which is high when the pixel is valid in the window, otherwise it is low; HSYNC is the row signal; D[7:0] is the 8-bit data output.
The timing diagram of AL422B write operation is shown in Figure 6. WCK is the write clock of AL422B, with a maximum cycle of 1000 ns and a minimum cycle of 20 ns (corresponding to a main frequency of 50 MHz); data is written at its rising edge, and the write pointer automatically increases as the clock is input into it. It can be seen that the speed of AL422B meets the design requirements. In specific operations, the write enable/WE of AL422B is controlled by the I/O port of the microcontroller to be low, enabling the write function, and the data terminal DI7~0 writes data at the rising edge of WCK. After writing an image, the write reset/WRST is controlled by the I/O port of the microcontroller to be low, enabling reset, and the data write address pointer will return to the 0 address position.

g.JPG


The timing diagram of AL422B read operation is shown in Figure 7. RCK is the read clock of AL422B, with a maximum cycle of 1000 ns and a minimum cycle of 20 ns. When /RE and /OE are valid, the data is valid on its rising edge. With the input of this clock, its internal read pointer automatically increases. When the main frequency of the microcontroller is 25 MHz, it cannot directly provide a clock to the system clock XCLK of OV7670. We use an external crystal oscillator to provide a 27 MHz same frequency signal to OV7670.

h.JPG

[page]

The schematic diagram of the image acquisition circuit is shown in Figure 8. The pixel clock PCLK of OV7670 is directly connected to the data read clock WCK of AL422B. In specific operation, the I/O port of the microcontroller controls the read enable/RE and output data enable/OE of AL422B to make them low level; enable the data read function, and the data terminal DO7~0 outputs the data to the microcontroller at the rising edge of RCK. After reading an image, the I/O port of the microcontroller controls the write reset/RRST to make it low level, enable reset, and the data read address pointer will return to the 0 address.

i.JPG


3.2 Programming
The programming flow is shown in Figure 9. When the MCU detects that the field signal is updated, it starts to monitor the arrival of the line signal, then enables /WE and starts to read the image sequentially. After reading a frame of image, turn off /WE, enable /RE and start to read 640 pixels in the first line of image. This paper adopts the method of reading and processing, which better solves the problem of up to 3 MB of a frame of image. Point
light The infrared light emitted by the source benchmark presents several halo areas on the image. The image coordinates of the point light source can be found by finding the center of the halo. For this purpose, each pixel point is compared with the threshold while reading. The pixel point less than the threshold is a suspected point light source and the corresponding coordinates are recorded; when a row of pixels is read, a group of pixel positions of the suspected point light source coordinates are obtained, which are statistically averaged to obtain the coordinates of the point light source in the row, which is up to 12 bytes (6 for the front benchmark and 6 for the side benchmark), which is much less than 640 bytes of the entire row.

j.JPG


When a frame of pixels is read, a maximum of 12×480 bytes are obtained, which can be fully stored in the 64 KB capacity of the microcontroller. Finally, the rows are averaged to obtain the final point light source coordinates. It has been verified that the total time required is completed within 2.15 frames of image.

Conclusion
This paper discusses the point light source image acquisition system based on FIFO chip and microcontroller, describes the monocular point light source ranging principle, image acquisition system hardware and software design methods, and focuses on the bridge role of FIFO chip in image acquisition. Through the system prototype test, it can meet the requirements and achieve the expected effect.

Reference address:Image acquisition system realized by FIFO chip and single chip microcomputer

Previous article:Design of real-time acquisition of all-digital images based on USB2.0 microcontroller
Next article:Microcontroller extended RAM read and write timing experiment

Recommended ReadingLatest update time:2024-11-16 17:49

STM32F4 USART1 TX RX FIFO
USART1 TX RX FIFO /* ********************************************************************************************************* *                                    * Module name: Serial port driver module     * File name: bsp_uart.c * Version: V1.0 * Description: Implement printf and scanf functions redirected to se
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号