Setting frame rate of OV5640

Hello. I’m confused about how setting the frame rate for OV5640 works. There is no set_framerate() function in the ov5640 driver (like in mt9m114.c for example). But AFAIK setting the framerate should involve PLL adjustments, as in OV5640 application note:

720p 30fps
// YUV 1280x720 30fps
// Input Clock = 24Mhz, PCLK = 84MHz
//same settings as 1280x720 15fps, except the following settings
write_i2c(0x3035, 0x21); // PLL

We just drop frames for it in software via the driver. This happens when you set the frame rate.

Adjusting the PLL register as you did above is the best way to control the frame rate and not have wasted frames. However, changing the PLL around often causes… other issues. So, we avoid doing that usually.

Unless you need to save a minor amount of power I wouldn’t downspeed the sensor. If you are trying to make it go faster we’ve already pushed it to the brink. Any faster and things start to fall over.

Thanks for the answer!
So if I understand correctly, ov5640 is configured to stream as fast as it can given the resolution, and is limited probably by the DCMI (~80Mhz I think). In case I want some particular frame rate for my algorithms, the frames would be skipped to match the requested frame rate. So the time interval between frames returned by the driver after skipping frames would be irregular?

So the time interval between frames returned by the driver after skipping frames would be irregular?

Yes, the frames are irregularly skipped to produce the requested frame rate. However, we basically hit what you want almost perfectly. So, your application will get that FPS. You can see how well it works by setting a frame rate with the hello world demo program.

Note that it’s not like the camera, per se, delivers a regular frame rate. The exposure time for frames adjusts by itself which means there’s jitter anyway.