Re: Issues with ov5640 camera on i.MX6Q

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Eric and Eugen,

On 7/23/19 9:51 AM, Eugen.Hristev@xxxxxxxxxxxxx wrote:


On 22.07.2019 19:25, Eric Nelson wrote:
Hi Laura,

On 7/22/19 8:50 AM, Laura Nao wrote:
Thanks Fabio!

I tried tweaking the PLL configuration in the driver and did some
further tests on 5.2 kernel.

I was finally able to capture RAW frames that match the test pattern
for 1280x720 and 1920x1080 resolutions. The 2592x1944 frame is still
not perfectly aligned, but it looks much closer to the test pattern.

I uploaded the images here:

https://imgur.com/a/ywHokMf

The changes I made in the driver are below. Not sure these changes
make much sense, but they seem to fix 1280x720 and 1920x1080 frames.

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 759d60c6..cfa678e 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -795,13 +795,13 @@ static int ov5640_mod_reg(struct ov5640_dev
*sensor, u16 reg,
    * FIXME: to be re-calcualted for 1 data lanes setups
    */
   #define OV5640_MIPI_DIV_PCLK    2
-#define OV5640_MIPI_DIV_SCLK    1
+#define OV5640_MIPI_DIV_SCLK    2

   /*
    * This is supposed to be ranging from 1 to 2, but the value is always
    * set to 2 in the vendor kernels.
    */
-#define OV5640_PLL_ROOT_DIV            2
+#define OV5640_PLL_ROOT_DIV            1
   #define OV5640_PLL_CTRL3_PLL_ROOT_DIV_2        BIT(4)

   /*
@@ -836,8 +836,8 @@ static unsigned long ov5640_compute_sys_clk(struct
ov5640_dev *sensor,
       unsigned long sysclk = sensor->xclk_freq / pll_prediv * pll_mult;

       /* PLL1 output cannot exceed 1GHz. */
-    if (sysclk / 1000000 > 1000)
-        return 0;
+    // if (sysclk / 1000000 > 1000)
+    //     return 0;

       return sysclk / sysdiv;
   }
@@ -1818,7 +1824,7 @@ static int ov5640_set_mode(struct ov5640_dev
*sensor)
        * All the formats we support have 16 bits per pixel, seems to
require
        * the same rate than YUV, so we can just use 16 bpp all the time.
        */
-    rate = mode->vtot * mode->htot * 16;
+    rate = mode->vtot * mode->htot * 8;
       rate *= ov5640_framerates[sensor->current_fr];
       if (sensor->ep.bus_type == V4L2_MBUS_CSI2_DPHY) {
           rate = rate / sensor->ep.bus.mipi_csi2.num_data_lanes;


How many frames per second are you getting out of this?

If I'm reading this right, the change to ov5640_set_mode is reducing
the frame rate (to 7.5 fps?), but I don't follow how the changes
to OV5640_MIPI_DIV_SCLK and OV5640_PLL_ROOT_DIV are affecting things
and the data sheet isn't very clear.


I'm getting 15fps for 640x480 and 1280x720 resolutions, 7.5 fps for 1920x1080. For the higher 2592x1944 resolution I'm getting 1.15fps, which is quite low.

I obtained these values from v4l2-utils.


Hello ,

Are you using parallel or csi2 interface for this sensor ?

During my tests with atmel image sensor controller (parallel),  I could
not get RAW frames at all. they were all garbled, as you described.

I would be happy to test patches if you fixed the RAW formats for this
sensor.
(currently, it works in YUV422 and RGB565 directly from the sensor for me)

Thanks,

Eugen


I'm using CSI-2 interface. I cannot test capture on parallel interface at the moment, but I'll be happy to share a patch if we find out a valid register configuration for RAW8 format.

Best regards,

Laura



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux