cancel
Showing results for 
Search instead for 
Did you mean: 

How to improve DCMI frame rate: An example using a ov5640 camera module

KDJEM.1
ST Employee

Improving DCMI frame rate with a ov5640

Introduction 

The main objective of this article is to provide a step-by-step guide on how to improve DCMI frame rate. This demo uses a STM32U575I-EV that is mounted to a ov5640 camera module, but it can be easily tailored for other microcontrollers. In this communication, the camera module is the controller and the DCMI interface is a client, meaning that the camera module imposes the clock frequency on the DCMI. To improve the DCMI frame rate, we recommend this set-up for the ov5640 to reach the required frames per second (fps) rate.

The aim of this article is to increase the DCMI frame rate of an existing example, which is DCMI_ContinousCap_EmbeddedSynchMode in STM32CubeU5 package, from 7.5 fps to 15 fps.

Prerequisites

Hardware:

  • STM32U575I-EV, mounted to a ov5640 camera module 
  • Micro USB cable to power and program the board

Software:

Guide

  • Download the STM32CubeU5 package.
  • Open the ov5640.c file in STM32Cube_FW_U5_Vx.x.x\Drivers\BSP\Components\ov5640 folder and modify this line of code. 
  {OV5640_SC_PLL_CONTRL2, 0x30},   /* 7.5 fps*/

 Modify to:

  {OV5640_SC_PLL_CONTRL2, 0x60},   /* 15 fps*/

Open the main.c file in STM32Cube_FW_U5_Vx.x.x\Projects\STM32U575I-EV\Examples\DCMI\DCMI_ContinousCap_EmbeddedSynchMode\Src folder.

Increase the pixel clock frequency from 12MHz to 24MHz to improve the framerate from 7.5 fps to 15 fps after ov5640 initialization as shown in the code below: 

/*Initialize*/
    if(OV5640_Init(&OV5640Obj, CAMERA_R320x240, CAMERA_PF_RGB565) != OV5640_OK)
    {
      status = OV5640_ERROR;
    }
    OV5640_SetPCLK(&OV5640Obj, OV5640_PCLK_24M);

After following this brief guide, you should now be able to improve the frame rate. If you encounter any issues, do not hesitate to create a post in the ST community for further assistance.

Related links

STM32CubeU5 MCU package

OV5640 Datasheet

STM32U575I-EV product page

Version history
Last update:
‎2024-03-11 02:03 AM
Updated by: