1
\$\begingroup\$

I made a platform with LPC1788 (Cortex M3) which had external 8MB NOR flash and external 32MB (16bit) SDRAM. I connected them a CF7670C-V3 (OV7670+AL422B (FIFO)) camera module and I capture QVGA,QQVGA frames in RGB565 format to FIFO and then I save images data to SDRAM perfectly. also I wrote a software on PC and save image data via USART and then show that. I have a big problem with VGA(640x480) resolution. At VGA resolution with RGB565 format, All the time I have picture ,like a on "OV7670 frames are 640x308 not 640x480" post. I search about a Algorithm that I capture a whole color VGA(640x480) frame data in the SDRAM. What can I do? How can I control FIFO_WEN and FIFO_RRST signals to get image data and save in to the SDRAM?

CF7670C-V3 Schematic link

\$\endgroup\$
0
\$\begingroup\$

I often wonder why people don't read the datasheet. You will find that the al422 has 384kb of ram (384*1024)<(640*480*2). You need to get the module to output raw bayer data so that (384*1024)>(640*480) and use a demosaicing algorithm to get a full color image. You have plenty of ram and a fast processor to do such.

\$\endgroup\$
  • \$\begingroup\$ Thanks for your good hint; Of course I don’t know about Raw Bayer format and its quality compare with RGB565 format because of its size (VGA, RGB565 => 640*480*2 bytes but Raw Bayer => 640*480 bytes). I haven’t any sample source code about OV7670 raw Bayer format data and its configuration And how to convert ray Bayer Image format to RGB888 to show in PC after data transmission. Alternatively, I think about a way to read 480 rows of a VGA frame in several step. \$\endgroup\$ – Mohammad reza Amini Jul 14 '15 at 10:23
  • \$\begingroup\$ I want captured images for image processing such as EDGE detection, so I don't know raw Bayer format is OK for that or not?! \$\endgroup\$ – Mohammad reza Amini Jul 14 '15 at 10:46
  • \$\begingroup\$ Using even a somewhat naive demosaicing algorithm will get you better results than rgb565 because you will end up with an rgb888 image. There are libraries that can do the conversion if you do not want to implement your own. \$\endgroup\$ – user3462295 Jul 20 '15 at 17:41
1
\$\begingroup\$

My guess would be that although the FIFO chip can hold a complete VGA frame, your CPU isn't fast enough to unload the data before it gets overwritten. Therefore, you'll be limited to capturing single frames, rather than continuous video.

You'll need to synchronize the frame capture with the video sync signal from the camera. The easiest thing to do would be to connect the VSYNC output of the camera to an interrupt input on your CPU, and toggle the WEN signal high in the ISR for one frame only. After the second interrupt, when you turn WEN off, is when you can transfer the captured frame from the FIFO to your SDRAM.

You could also set up a simple sequential circuit using a couple of flip-flops to do the same thing in hardware, triggered by a pulse of some sort from the CPU.

\$\endgroup\$
  • \$\begingroup\$ Thanks Mr. Dave Tweed, I had implemented exactly what you say about syncing and using interrupt to detect start and end of a frame. It’s OK for QVGA (320x240) resolution and down scaled size with RGB565 (2 byte for each pixel) format, but about VGA (640x480) resolution, It’s not OK because of FIFO size. Sequential circuit, It was good idea for hardware implementing. \$\endgroup\$ – Mohammad reza Amini Jul 14 '15 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.