OV5640 iMX6ULL cant get MCLK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OV5640 iMX6ULL cant get MCLK

350 Views
ET_Dev
Contributor III

Hello,

I am working on a custom board with i.MX6ULL connected to a OV5640 camera module. 

My dts and config details are attached. 

I have looked at the various posts on related topics on the forum here and elsewhere and I am not sure where I am going wrong with this. Any pointers for trouble shooting this will help.

At this point I am not seeing any signal on the MCLK and hence no communication over I2C as well. So starting point for me is to get MCLK working.  

Adding relevant section details here as well. 

&i2c2 {
      clock_frequency = <100000>;
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_i2c2>;
      status = "okay";

       ov5640: ov5640@3c {
               compatible = "ov5640";
               reg = <0x3c>;
               pinctrl-names = "default";
               pinctrl-0 = <&pinctrl_csi1>;
               clocks = <&clks IMX6UL_CLK_CSI>;
               clock-names = "csi_mclk";
         //      pwn-gpios = <&gpio1 2 1>;
         //      rst-gpios = <&gpio1 1 0>;
               csi_id = <0>;
               mclk = <24000000>;
               mclk_source = <0>;
               status = "okay";
               port {
                       ov5640_ep: endpoint {
                               remote-endpoint = <&csi1_ep>;
                       };
               };
     	};

};

iomux details:

	pinctrl_csi1: csi1grp {
		fsl,pins = <
			MX6UL_PAD_CSI_MCLK__CSI_MCLK		0x10071
			MX6UL_PAD_CSI_PIXCLK__CSI_PIXCLK	0x1b088
			MX6UL_PAD_CSI_VSYNC__CSI_VSYNC		0x1b088
			MX6UL_PAD_CSI_HSYNC__CSI_HSYNC		0x1b088
			MX6UL_PAD_CSI_DATA00__CSI_DATA02	0x1b088
			MX6UL_PAD_CSI_DATA01__CSI_DATA03	0x1b088
			MX6UL_PAD_CSI_DATA02__CSI_DATA04	0x1b088
			MX6UL_PAD_CSI_DATA03__CSI_DATA05	0x1b088
			MX6UL_PAD_CSI_DATA04__CSI_DATA06	0x1b088
			MX6UL_PAD_CSI_DATA05__CSI_DATA07	0x1b088
			MX6UL_PAD_CSI_DATA06__CSI_DATA08	0x1b088
			MX6UL_PAD_CSI_DATA07__CSI_DATA09	0x1b088
		>;
	};

 details from .config

# Video4Linux options
#
CONFIG_VIDEO_V4L2_I2C=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y
# CONFIG_VIDEO_ADV_DEBUG is not set
# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
CONFIG_V4L2_JPEG_HELPER=m
CONFIG_V4L2_MEM2MEM_DEV=y
CONFIG_V4L2_FWNODE=y
CONFIG_V4L2_ASYNC=y
CONFIG_V4L2_CCI=m
CONFIG_V4L2_CCI_I2C=m
CONFIG_VIDEOBUF_GEN=y
CONFIG_VIDEOBUF_DMA_CONTIG=y
# end of Video4Linux options


# MXC Camera/V4L2 PRP Features support
#
CONFIG_VIDEO_MXC_IPU_CAMERA=y
CONFIG_MXC_CAMERA_OV5640=m
CONFIG_MXC_CAMERA_OV5640_V2=y
# CONFIG_MXC_CAMERA_OV5642 is not set
CONFIG_MXC_CAMERA_OV5640_MIPI=m
CONFIG_MXC_CAMERA_OV5640_MIPI_V2=m
# CONFIG_MXC_CAMERA_OV5647_MIPI is not set
CONFIG_MXC_TVIN_ADV7180=m
CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=y
# CONFIG_MXC_IPU_PRP_VF_SDC is not set
CONFIG_MXC_IPU_PRP_ENC=m
CONFIG_MXC_IPU_CSI_ENC=m
# end of MXC Camera/V4L2 PRP Features support

# CONFIG_VIDEO_MXC_OUTPUT is not set
CONFIG_VIDEO_MXC_PXP_V4L2=y

 

Labels (4)
Tags (3)
0 Kudos
Reply
7 Replies

148 Views
ET_Dev
Contributor III

Joanxie

After trying a few more things we are now at the following point.

root@imx6ul7d:~# gst-inspect-1.0 imxv4l2src====== IMXV4L2SRC: 4.9.0 build on May  8 2024 06:06:55. ======
Factory Details:
  Rank                     primary + 1 (257)
  Long-name                IMX Video (video4linux2) Source
  Klass                    Source/Video
  Description              Capture frames from IMX SoC video4linux2 device
  Author                   Multimedia Team <shmmmw@freescale.com>

Plugin Details:
  Name                     imxv4l2
  Description              IMX SoC v4l2-based video source/sink
  Filename                 /usr/lib/gstreamer-1.0/libgstimxv4l2.so
  Version                  4.9.0
  License                  LGPL
  Source module            imx-gst1.0-plugin
  Binary package           Freescle Gstreamer Multimedia Plugins
  Origin URL               http://www.freescale.com

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseSrc
                         +----GstPushSrc
                               +----GstImxV4l2Src

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw
                 format: YUY2
                  width: 640
                 height: 480
              framerate: { (fraction)15/1, (fraction)30/1 }
      video/x-raw
                 format: YUY2
                  width: 320
                 height: 240
              framerate: { (fraction)15/1, (fraction)30/1 }
      video/x-raw
                 format: YUY2
                  width: 720
                 height: { (int)576, (int)480 }
              framerate: { (fraction)15/1, (fraction)30/1 }
:
Plugin Details:
  Name                     imxv4l2
  Description              IMX SoC v4l2-based video source/sink
  Filename                 /usr/lib/gstreamer-1.0/libgstimxv4l2.so
  Version                  4.9.0
  License                  LGPL
  Source module            imx-gst1.0-plugin
  Binary package           Freescle Gstreamer Multimedia Plugins
  Origin URL               http://www.freescale.com

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseSrc
                         +----GstPushSrc
                               +----GstImxV4l2Src

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw
                 format: YUY2
                  width: 640
                 height: 480
              framerate: { (fraction)15/1, (fraction)30/1 }
      video/x-raw
                 format: YUY2
                  width: 320
                 height: 240
              framerate: { (fraction)15/1, (fraction)30/1 }
      video/x-raw
                 format: YUY2
                  width: 720
                 height: { (int)576, (int)480 }
              framerate: { (fraction)15/1, (fraction)30/1 }


root@imx6ul7d:~# gst-inspect-1.0  | grep "imx"
imxcompositor:  imxcompositor_pxp: IMX pxp Video Compositor
imxmp3enc:  imxmp3enc: imx mp3 audio encoder
imxv4l2:  imxv4l2sink: IMX Video (video4linux2) Sink
imxv4l2:  imxv4l2src: IMX Video (video4linux2) Source
imxvideoconvert:  imxvideoconvert_pxp: IMX pxp Video Converter

root@imx6ul7d:~# gst-launch-1.0 imxv4l2src device=/dev/video0  imx-capture-mode=0 num-buffers=1 ! 'video/x-raw,format=YUY2' ! jpegenc ! filesink location=test.jpg
WARNING: erroneous pipeline: no property "imx-capture-mode" in element "imxv4l2src"

root@imx6ul7d:~# v4l2-ctl --list-devices
i.MX6S_CSI (platform:21c4000.csi):
        /dev/video0

 

From what I read else where we should have the following as well, but we dont have this. 

pxp (pxp_v4l2_out):
/dev/video0

 

Can you please help with this, on what we might be missing. 

0 Kudos
Reply

277 Views
joanxie
NXP TechSupport
NXP TechSupport

if your customize board design is based on nxp imx6ull board, suggest that you can refer to the dts as below

https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/arch/arm/boot/dts/nxp/imx/imx6ul-14x14-evk.dtsi

ov5640: ov5640@3c {
compatible = "ovti,ov5640";
reg = <0x3c>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_csi1 &pinctrl_camera_clock>;
clocks = <&clks IMX6UL_CLK_CSI>;
clock-names = "csi_mclk";
pwn-gpios = <&gpio_spi 6 1>;
rst-gpios = <&gpio_spi 5 0>;
csi_id = <0>;
mclk = <24000000>;
mclk_source = <0>;
status = "disabled";
port {
ov5640_ep: endpoint {
remote-endpoint = <&csi1_ep>;
};
};

&iomuxc {
pinctrl-names = "default";

pinctrl_camera_clock: cameraclockgrp {
fsl,pins = <
MX6UL_PAD_CSI_MCLK__CSI_MCLK 0x1b088
>;
};

0 Kudos
Reply

266 Views
ET_Dev
Contributor III

Joanxie,

I had tried this earlier, but on your recommendation I will try this again. 

After making a few changes I got to a point where I am seeing this at the terminal

root@imx6ul7d:~# dmesg | grep -i "ov5640"
[    2.226553] ov5640 1-003c: supply DOVDD not found, using dummy regulator
[    2.234002] ov5640 1-003c: supply AVDD not found, using dummy regulator
[    2.240942] ov5640 1-003c: supply DVDD not found, using dummy regulator
[    2.285179] CSI: Registered sensor subdevice: ov5640 1-003c
[    2.291800] Error: Driver 'ov5640' is already registered, aborting...

 

My assumption is my menuconfig is wrong? Can you help me resolve this?

 

0 Kudos
Reply

236 Views
joanxie
NXP TechSupport
NXP TechSupport

firstly you need fix mclk issue, if ov5640 couldn't get mclk, for menuconfig, you can use "bitbake -c menuconfig linux-imx" to check if you choose the ov5640 correct or not, for more detailed information, pls refer to the linux referece manual

0 Kudos
Reply

222 Views
ET_Dev
Contributor III

We ended up giving a external 20Mhz clock as we had a external 20 Mhz clock. Now we are able to see that the I2C communication is happening fine, but still we are seeing as below. Any pointers on how we can go about fixing this? 

 

root@imx6ul7d:~# v4l2-ctl --device=/dev/video0 --list-formats
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

root@imx6ul7d:~# v4l2-ctl -V --device=/dev/video0
Format Video Capture:
        Width/Height      : 0/0
        Pixel Format      : ''
        Field             : Any
        Bytes per Line    : 0
        Size Image        : 0
        Colorspace        : Default
        Transfer Function : Default (maps to Rec. 709)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Full Range)
        Flags             :

Tags (3)
0 Kudos
Reply

3 Views
joanxie
NXP TechSupport
NXP TechSupport

pls attach the logfile 

0 Kudos
Reply

194 Views
joanxie
NXP TechSupport
NXP TechSupport

Pls check the ov5640 data sheet if the 20Mhz is acceptable mclk for ov5640, normally we use 24M as Mclk, if still failed, pls share the logfile with me

0 Kudos
Reply