Author Topic: OV5642 camera scaling issue  (Read 837 times)

0 Members and 1 Guest are viewing this topic.

Offline ksstmsTopic starter

  • Newbie
  • Posts: 8
  • Country: hu
OV5642 camera scaling issue
« on: February 03, 2021, 10:27:43 pm »
Hi!

I'm trying to use an OV5642 camera module with a PYNQ-Z2 FPGA board. I made a little test project which uses DMA to write frames to the CPU's memory, and the CPU sends it to the PC via ethernet.
All of this works fine, but I just can't figure out how to configure the camera properly.
My goal is to use it with RAW Bayer output at 640x480 resolution for now. (On this board I can't really connect a high-frequency parallel bus, and FPS is more important than resolution)

The scaling function doesn't seem to work. I always get a 640x480 pixel cropped part of the sensor array, which makes the FOV very narrow.
I started by copying the configs from ArduCAM's repo. The driver itself performs a soft reset, then applies the OV5642_1280x960_RAW and OV5642_640x480_RAW configs. (I have attached it to this post.)
This produces the cropped image. Then I started to experiment with the settings.
  • The scaling  (0x5001[5:4]) wasn't enabled, but enabling it doesn't make a difference.
  • Subsampling would also be fine for me. The vertical subsampling (0x3818[1:0]) works fine. Horizontal subsampling (0x5002[2]) produces a white image, both in averaging and skip mode (0x501C)
  • I also thought that maybe the scaler can only do integer ratios, so I have set the crop window size (0x3804-0x3807) to 1280x960. That didn't help either.
  • The OV5640 looks kind of similar, so I have checked out some configs for that, and tried to find the matching registers in the OV5642, but couldn't find any clues

Does anyone have experience with this module? At this point, I'm thinking that maybe my camera is faulty. Can you recommend a similar module (even a lower resolution one)?
- Tamas
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8366
Re: OV5642 camera scaling issue
« Reply #1 on: February 04, 2021, 02:43:17 pm »
These were commonly used in Androids, so perhaps searching for source code and inspecting that will give you some clues. There's also the datasheet, which is incomplete but may yield other useful hints.
 

Offline ksstmsTopic starter

  • Newbie
  • Posts: 8
  • Country: hu
Re: OV5642 camera scaling issue
« Reply #2 on: February 04, 2021, 03:30:16 pm »
Thanks for the tip. I've already spent 20+ hours reading the datasheet and tinkering with the settings.
I have found this Linux driver on multiple sites. There's a comment with the bad news:

Code: [Select]
/*
 * About OV5642 resolution, cropping and binning:
 * This sensor supports it all, at least in the feature description.
 * Unfortunately, no combination of appropriate registers settings could make
 * the chip work the intended way. As it works with predefined register lists,
 * some undocumented registers are presumably changed there to achieve their
 * goals.
 * This driver currently only works for resolutions up to 720 lines with a
 * 1:1 scale. Hopefully these restrictions will be removed in the future.
 */

I guess I'm going to buy a cheap OV7670 for the time being.
- Tamas
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf