cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H747I-DISCO + OV5640 framerate

avburmel
Visitor

I have an STM32H747I-DISCO board and a B-CAMS-OMV camera module with the OV5640 sensor.

 

I'm trying to increase the frame rate using the BSP code from the example:
https://github.com/STMicroelectronics/stm32ai-modelzoo-services/tree/main

 

I managed to achieve a capture frame rate of 50 fps at 320x240 resolution by increasing the PCLK to 80 MHz.
Then, I tried switching the pixel format from OV5640_RGB565 to OV5640_Y8. This worked — I halved the buffer sizes and successfully displayed a grayscale image. However, the frame rate did not increase, even though the amount of data per frame was reduced by half. On the oscilloscope, I can see that the HSYNC pulse frequency remained unchanged.

After reading various forums and the OV5640 datasheet, I found that these registers affect the frame rate:

  • 0x380C TIMING HTS [11:8] (high byte)
  • 0x380D TIMING HTS [7:0] (low byte)
  • 0x380E TIMING VTS [15:8] (high byte)
  • 0x380F TIMING VTS [7:0] (low byte)

Assumed formula is:
Frame rate = Pixel clock / (HTS × VTS)

In my BSP driver, the default register values are:

 
{OV5640_TIMING_HTS_HIGH, 0x06},
{OV5640_TIMING_HTS_LOW, 0x40},
{OV5640_TIMING_VTS_HIGH, 0x03},
{OV5640_TIMING_VTS_LOW, 0xe8}
 

Which corresponds to HTS = 0x640 = 1600, VTS = 0x3E8 = 1000.
Using 80 MHz pixel clock: 80,000,000 / (1600 × 1000) = 50 fps — matches my measurement.

 

However, when looking at different OV5640 driver implementations, I see various values for HTS/VTS depending on the format, and I can't figure out the logic behind calculating these values.

 

Question 1: Why did changing the pixel format from 2-byte (RGB565) to 1-byte (Y8) not reduce the HSYNC interval or increase the frame rate?

 

Question 2: Is there a clear algorithm or method to correctly calculate HTS and VTS values based on the pixel format and resolution?

 

Question 3: Are there any other ways to further increase the frame rate with this hardware setup?

 

Any help or clarification would be greatly appreciated!

0 REPLIES 0