2025-08-29 5:08 AM
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:
Assumed formula is:
Frame rate = Pixel clock / (HTS × VTS)
In my BSP driver, the default register values are:
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!