OV7670 camera to LCD, 25 fps at 320x240 RGB565

cspwcspw
Posts: 15
Joined: Mon Apr 16, 2018 5:08 pm

OV7670 camera to LCD, 25 fps at 320x240 RGB565

Postby cspwcspw » Sat Sep 08, 2018 6:55 pm

Hi

I got my OV7670 camera delivering 25 frames per second through the ESP32 to an 320x240 pixel LCD screen.
Each pixel is RGB565 format (2 bytes).

The code and some docs are at https://github.com/cspwcspw/ESP32_CamToLCD

Peter

ESP_igrr
Posts: 1142
Joined: Tue Dec 01, 2015 8:37 am

Re: OV7670 camera to LCD, 25 fps at 320x240 RGB565

Postby ESP_igrr » Sun Sep 09, 2018 2:54 pm

Very nice write-up, thanks for sharing!

cspwcspw
Posts: 15
Joined: Mon Apr 16, 2018 5:08 pm

Re: OV7670 camera to LCD, 25 fps at 320x240 RGB565

Postby cspwcspw » Fri Sep 21, 2018 4:43 pm

On the OV7670 camera, I think I've partially understood the HSTART and HSTOP registers. In the I2S camera code, (and indeed on a few different solutions working with the camera), the authors typically say

Code: Select all

frameControl(196, 52, 8, 488); //no clue why horizontal needs such strange values

So here is a clue: the horizontal timing is such that a VGA scan line takes 784 PCLKs (640 + 144 PCLK times between lines). So HSTOP must be 640 bigger than HSTART, but modulus 784. So for any HSTART value, we can compute HSTOP as (HSTART + 640) % 784. This has worked nicely for me. My experiments also indicate that HSTOP points to the pixel beyond the last one. (HSTART + 639) % 768 just slews my images.
Camera_specs.png
Camera_specs.png (36.56 KiB) Viewed 314 times


Now why does HSTART begin at such a weird value? I'm still puzzed. I suspect it counts PCLKs relative to HSYNC (which is not broken out onto a pin, or easily observable), but I cannot find any obvious synchonization point or timing that explains HSTART.

Any ideas or extra insights, please let me know. If you can tell me how to get HSTART, I thinnk I can tell you how to get HSTOP.

Peter

Who is online

Users browsing this forum: No registered users and 3 guests