cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U575I-EV DCMI OV5640, maximize frame rate for 720p/1080p JPEGs

afok-esmart
Associate III

I previously made another post regarding minimal adjustments to the DCMI example from the v1.4.0 MCU package. I've made several changes since and now, instead of determining the expected performance, would like to maximize the performance, namely the FPS, of the OV5640 (w/ both 720p and 1080p JPEGs). 

I've gotten as far as 720p JPEGs coming in around 24fps, solely from increasing OV5640 PCLK (and I'm still working on correctly configuring for 1080p images). Whether it be adjustments to OV5640 configuration, code optimizations, STM clock frequencies, or more, I would like to ask about any and all suggestions for what I can look into.

--------

The general changes I've made so far:

  • Use JPEG format for images (i.e., w/ DCMI 'JPEG mode' enabled)
  • Use multiple buffers (4 of them, each 38,400 bytes) as described in AN5020 Rev 3 Ch6.4.9 (HAL seems to automatically handle this in HAL_DCMI_Start_DMA())
  • Increase resolution of images (ex: for 720p, I set OV5640_TIMING_DVPHO_HIGH to 0x05, OV5640_TIMING_DVPHO_LOW to 0x00, OV5640_TIMING_DVPVO_HIGH to 0x02, and OV5640_TIMING_DVPVO_LOW to 0xD0)
  • Increase OV5640 PCLK to 96MHz (I set OV5640_SC_PLL_CONTRL2 to 0x60, and OV5640_SC_PLL_CONTRL3 to 0x13)
  • Measure frame rate using an LED (turns on when first enters GPDMA1_Channel12_IRQHandler(), turns off when exits handler)
    • For example - If I see the LED toggle on/off 36 times in 1 second (via logic analyzer), that's 36 * 38,400 bytes = 1.4MB of data in 1 second. I had sandbox code for this same setup that could produce 720p JPEGs as large as 170KB. If each image is 170KB, that's 1.4MB/170KB = 7.8 JPEGs per second (almost 8fps).

--------

Helpful links:

--------

Development Environment:

  • Windows 10
  • STM32CubeIDE 1.14.1

 

 

3 REPLIES 3
KDJEM.1
ST Employee

Hello @afok-esmart ,

The OV5640 imposes the clock frequency on the DCMI peripherical (the OV module is a master and the DCMI is a slave) to increase the fps rate we need to set up correctly the ov5640.

Also, in this case, the DMA must be configured to support the high resolution. 

For that could you please check the DMA configuration?

Thank you

Kaouthar

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Here is my GPDMA1 mode/configuration, based on my CubeMX file:

  • Channel 12 in linked-list mode, all other channels disabled
  • Ch12 configuration for linked list
    • Priority - Low
    • Execution Mode - Circular
    • Linked List Execution Mode - The List is fully executed
    • Allocated Port for Transfer - Port 1
    • Transfer Event Generation - The TC (and the HT) event is generated at the (respectively half) end of the last linked-list item

If it helps, I've also updated my original post w/ details about the IDE version I'm using.

Hi. Just checking to see if anyone has any updates about this.