Anyone used an OV5640 at 90fps? - Page 1
Forum section: electronics / general

author: daveshah
author_rank: Unknown
timestamp: March 22, 2016, 07:08:26 pm
content: I am working on project using an FPGA to process image data from an OV5640 camera module, and the nature of the project means a high frame rate would be ideal.At the moment the maximum I am able to achieve is about 45fps, and tweaking timing parameters generally causes either serious glitches (such as overlapping double images) or a complete loss of sync outputs and pixel data. If anyone has ever used one at 640x480x90fps it would be very interesting to see what register values were used, particularly with regards to DVP timing (registers 0x3800-0x3821) and PLL configuration.

author: nctnico
author_rank: Super Contributor
timestamp: March 22, 2016, 07:15:44 pm
content: You can't ask support? I did a project with an OV5642 modules a couple of years ago but this module is limited to 640x480 @60fps. I think the limit is in how much data the downscaling hardware can handle. Also the parallel image port was a bottleneck for that particular project.

author: daveshah
author_rank: Unknown
timestamp: March 22, 2016, 07:45:05 pm
content: Quote from: nctnico on March 22, 2016, 07:15:44 pmI have contacted them, but as I'm a student and not likely to be ordering 1000s of them any time soon I'm not sure if they'll bother replying. I think I can get around the image port bottleneck at least to a degree by doing debayering in the FPGA (this is what I am doing at the moment), so only one byte needs to be transferred per pixel. It does claim to be capable of 90fps in the datasheet, although a bit suspiciously none of the Linux drivers I can find have anything above 30fps.

author: nctnico
author_rank: Super Contributor
timestamp: March 22, 2016, 09:47:11 pm
content: Do you have the extended user manual? Even with that it takes a lot of trial&error to get these modules to do what you want! The OV5642 can do 120fps at 320x240 (QVGA) so maybe that is where 90fps for the OV5640 is coming from.

author: daveshah
author_rank: Unknown
timestamp: March 23, 2016, 04:47:26 pm
content: Ok if anyone ever finds this I was able to get this working, and in fact by exceeding the rated clocks (obviously YMMV) I was able to push things even further (to around 110fps with 36MHz input clock, 126MHz pixel clock). It is quite noisy if not very well lit at these framerates. There is also a mysterious fixed pattern visible at lower light levels, that I suspect could be fixed in the camera configuration.Here are the timing parameters I used - the PLL, etc. all used fairly standard settings that can be found elsewhere in Linux drivers, but PM me if you want a full config:Code:0x380c == 0x070x380d == 0x680x380e == 0x02 *0x380f == 0x60 *0x3814 == 0x710x3815 == 0x350x3803 == 0x040x3821 == 0x010x3806 == 0x070x3807 == 0x9b0x3808 == 0x020x3809 == 0x800x380a == 0x010x380b == 0xe00x3813 == 0x06*VTS is higher than it needs to be to match the vertical period of my LCD, thus avoiding the need for a frame buffer. You could try reducing this for even higher framerates.For raw bayer output, also set 0x4300 to 0x00 and 0x501f to 0x03. I have not experimented with YUV or RGB565 at these framerates, although I suspect that would be pushing the pixel clock too far (it may be possible over MIPI however). There is also a function called "CIP RAW output" that may be of use, if anyone knows how to use it (when I try to enable it the output of my Bayer decoder is greyscale...).Another note for anyone interested - 2 OV5640s given the same input clock and I2C data sequence will stay in sync with each other, at least for time periods in the order of minutes (again YMMV).Extra note: the screen I was using, at the exact same timings (horizontal pixel count, vertical frame count and pixel clock) as the cameras was an LMS480JC01 which works well at these timings, despite again being way out of spec.

author: david-IT
author_rank: Contributor
timestamp: March 24, 2016, 10:36:10 am
content: more details?

author: amyk
author_rank: Super Contributor
timestamp: March 24, 2016, 11:03:40 am
content: Quote from: daveshah on March 23, 2016, 04:47:26 pmThat's not surprising, since they're synchronised to the clock input for internal scanning and data readout.

author: NovaNis
author_rank: Newbie
timestamp: September 11, 2016, 07:59:29 pm
content: Hello there,I've been using an OV5640 for a project for some time now... I'm using the camera through MIPI/CSI -2 lanes- . My objective was to capture images of at least 2Mpx resolution (4:3 aspect ratio) at at least 30fps. So far I've been able to tweak the driver (I'm developing on a Yocto based linux system) to capture 1280x960 at 30fps by capturing full sensor array and then using a 2x2 binning. So I'm getting a mere 1.2Mpx... I also added an UXGA mode 1600x1200 but could only get 15fps, by capturing full sensor array and then using onboard scaling... I guess I could only get 15fps because scaling is slower than binning... But nothing to acertain that fact in the obscure OV5640 documentation. Any idea about how to pump more fps from this device ?Driver says that sysclk clock is set to 8.4Mhz. Relation between MIPI clock, pixel clock (and clock dividers regs, etc.) and FPS is still very unclear after reading the documentation. If anyone could explain to me clearly how that works, that could be of great help.For example, here are my regs values for both 1280x960 and 1600x1200 if anyone can spot what's wrong... :static struct reg_value ov5640_setting_30fps_1280_960[] = {{0x3035, 0x14, 0, 0}, {0x3036, 0x54, 0, 0}, {0x3c07, 0x08, 0, 0},{0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0},{0x3820, 0x46, 0, 0}, {0x3821, 0x01, 0, 0}, {0x3814, 0x31, 0, 0}, // 0x3820 > 44 pour VFLIP{0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x10, 0, 0},{0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},{0x3805, 0x2f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},{0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0},{0x380b, 0xe0, 0, 0}, {0x380c, 0x08, 0, 0}, {0x380d, 0x98, 0, 0},{0x380e, 0x05, 0, 0}, {0x380f, 0x00, 0, 0}, {0x3810, 0x00, 0, 0},{0x3811, 0x08, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},{0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},{0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},{0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x0e, 0, 0},{0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0},{0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0},{0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0},{0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0},{0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, {0x3503, 0x00, 0, 0},{0x3808, 0x05, 0, 0}, {0x3809, 0x00, 0, 0}, {0x380a, 0x03, 0, 0},{0x380b, 0xc0, 0, 0}, {0x3035, 0x11, 0, 0},};static struct reg_value ov5640_setting_30fps_UXGA_1600_1200[] = {{0x3035, 0x11, 0, 0}, {0x3036, 0x54, 0, 0}, {0x3c07, 0x08, 0, 0},{0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0},{0x3820, 0x46, 0, 0}, {0x3821, 0x00, 0, 0}, {0x3814, 0x11, 0, 0},{0x3815, 0x11, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},{0x3802, 0x00, 0, 0}, {0x3803, 0x00, 0, 0}, {0x3804, 0x0a, 0, 0},{0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9f, 0, 0},{0x3808, 0x04, 0, 0}, {0x3809, 0x00, 0, 0}, {0x380a, 0x03, 0, 0},{0x380b, 0x00, 0, 0}, {0x380c, 0x0b, 0, 0}, {0x380d, 0x1c, 0, 0},{0x380e, 0x07, 0, 0}, {0x380f, 0xb0, 0, 0}, {0x3810, 0x00, 0, 0},{0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0},{0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},{0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},{0x3a03, 0xd8, 0, 0}, {0x3a08, 0x00, 0, 0}, {0x3a09, 0x93, 0, 0},{0x3a0a, 0x00, 0, 0}, {0x3a0b, 0x7b, 0, 0}, {0x3a0e, 0x0d, 0, 0},{0x3a0d, 0x10, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0},{0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0},{0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0},{0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, {0x3503, 0x00, 0, 0},{0x3808, 0x05, 0, 0}, {0x3809, 0xa0, 0, 0}, {0x380a, 0x04, 0, 0},{0x380b, 0x38, 0, 0}, {0x3035, 0x12, 0, 0},};Thanks in advance !

author: daveshah
author_rank: Unknown
timestamp: September 12, 2016, 09:28:48 am
content: I haven't used the OV5640 in CSI mode; although I have recently used another the OV13825 with CSI and it seems even more picky than parallel mode. You might be able to get 2MPx at 30fps with cropping by adjusting the settings in 0x3800-0x3813, in particular reducing the end addresses; output size and HTS/VTS; although from experience with the OV13825 it can be very unpredictable about what values are allowed. I've also had success overclocking (just by increasing the input clock) the OV5640 by 1.5x but obviously that's inadvisable for anything commerical and YMMV.

author: Scrts
author_rank: Frequent Contributor
timestamp: September 12, 2016, 12:21:56 pm
content: I have some experience with other image sensors and companion chips from OVT.In general, if you are holding SMPTE 640x480 timing, you are targeting Pixel clock of: 800pixels * 525lines * 90FPS * 2bppyuv422 = 75.6MHz, which sounds very do-able. The thing is to get PLL settings correctly, which will probably end up having some close, but other frequency than 75.6MHz. Play with the PLL first of all, but be sure not to write values, that are not allowed - imager will not work at all.

author: NovaNis
author_rank: Newbie
timestamp: September 13, 2016, 07:19:17 am
content: Quote from: daveshah on September 12, 2016, 09:28:48 amCan the input clock freq. be modified through SCCB... Sorry.. I2C ? I tried tweaking PLL multipliers/dividers... I could get 1024x768 (from full sensor array) at 40fps. Surprinsingly, with other modes, some PLL mul/divs were not allowed and made the camera crash. And that's also undocumented.

author: daveshah
author_rank: Unknown
timestamp: September 13, 2016, 07:26:19 am
content: Quote from: NovaNis on September 13, 2016, 07:19:17 amBy input clock frequency, I mean simply scaling the frequency you put into XCLK while keeping PLL settings the same - this would be adjusted in your SoC/MCU/FPGA settings/driver.

author: NovaNis
author_rank: Newbie
timestamp: September 13, 2016, 12:04:35 pm
content: Okay, so... specs from OVT said max XCLK is 27MHz. The nominal value that was used was 24MHz, so I overclocked to 1.5x and forced 36MHz and now I can get 1440x1080 at 30fps (and without cropping) without any problem (for now)... I had to push the PLL settings far beyond what the specs recommended, though... But it works

author: daveshah
author_rank: Unknown
timestamp: September 13, 2016, 12:10:17 pm
content: Quote from: NovaNis on September 13, 2016, 12:04:35 pmMy personal experience is that 36MHz input clock (with the PLL settings I was using) worked absolutely flawlessly on some OV5640s and resulted in visual artifacts on others (despite the modules being ordered at the same time so quite likely from the same batch), so it may be worth doing some testing. Given how cheap OV5640s are it seems quite viable to buy more than you need and select ones that work well.I haven't done any serious long term testing but they've probably had more than 20 powered on hours at 36MHz and I haven't noticed any change in performance.

author: NovaNis
author_rank: Newbie
timestamp: September 13, 2016, 12:34:10 pm
content: QuoteUsing infrared thermometer I get 60°C while capturing AND idle. I don't know if it's normal or any different than before the overclock.

author: daveshah
author_rank: Unknown
timestamp: September 13, 2016, 08:01:45 pm
content: Quote from: NovaNis on September 13, 2016, 12:34:10 pmThat sounds similar to what I was getting when overclocked, although I didn't actually measure. They are definitely hotter overclocked, but it's probably not hot enough to cause any issues.

author: Scrts
author_rank: Frequent Contributor
timestamp: September 14, 2016, 06:15:15 pm
content: Quote from: daveshah on September 13, 2016, 08:01:45 pmHigh temperature will have a negative effect on image quality as the dark current increases.