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
OV7670 camera to LCD, 25 fps at 320x240 RGB565
Re: OV7670 camera to LCD, 25 fps at 320x240 RGB565
Very nice write-up, thanks for sharing!
Re: OV7670 camera to LCD, 25 fps at 320x240 RGB565
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
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. 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
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. 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
Re: OV7670 camera to LCD, 25 fps at 320x240 RGB565
I am looking at some camera code on github and just seeing that there is something undocumented in I2S api like two lines from the idf library file (i2s.c)
I2S[i2s_num]->conf2.lcd_en = 0;
I2S[i2s_num]->conf2.camera_en = 0;
It seems like there is a dedicated functionality for camera and lcd in I2S api and it is not documented or maybe I just cannot find it.
The interesting thing is how those data bits from camera are transformed parallely to DMA as byte datas by I2S.
I guess it is dedicated behavior by selecting camera_en = true and also what exacly gpio_matrix_() does to the selected pins and what is the signal index value
I am just trying to understand how I2S works in such case
I2S[i2s_num]->conf2.lcd_en = 0;
I2S[i2s_num]->conf2.camera_en = 0;
It seems like there is a dedicated functionality for camera and lcd in I2S api and it is not documented or maybe I just cannot find it.
The interesting thing is how those data bits from camera are transformed parallely to DMA as byte datas by I2S.
I guess it is dedicated behavior by selecting camera_en = true and also what exacly gpio_matrix_() does to the selected pins and what is the signal index value
I am just trying to understand how I2S works in such case
Who is online
Users browsing this forum: No registered users and 28 guests