About settings to operate ov5640camera on i.MX93EVK

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

About settings to operate ov5640camera on i.MX93EVK

Jump to solution
2,535 Views
Ryo_Aoki
Contributor III

I would like to connect and operate an ov5640 camera to the i.MX93EVK. but it's not working.
I share the development equipment, what we fixed, and the log of what happened.
I would like some advice on how to make it work.


*development equipment
  --i.MX93 EVK
  --Yocto Linux 6.1.22_2.0.0​ DISTRO=fsl-imx-xwayland MACHINE=imx93evk bitbake imx-image-full
  --PCAM 5C ov5640 camera module
     https://digilent.com/reference/_media/reference/add-ons/pcam-5c/pcam_5c_sch.pdf

*fix point

**device driver
 base file linux-imx/drivers/media/platform/mxc/capture/ov5640_mipi_v2.c
   I have attached the edited version.
   ov5640_mipi_v2_fix.c
   I refer to the contents of the community below and the ap1302 camera driver that imx93EVK supports as standard.
   -- https://community.nxp.com/t5/i-MX-Processors/Integrate-ADV7280-M-with-IMX8X/m-p/1661895#M206946
   -- linux-imx/drivers/media/i2c/ap1302.c

   Added link_setup function to handle errors ""mxc-mipi-csi2.0: is_entity_link_setup, No remote pad found!""
   When using the provided ov5640_mipi_v2.c without modifying the device driver
     -- /dev/video0 exists.
     -- $ v4l2-ctl --list-devices command works fine.
     -- $ v4l2-ctl -d0 --list-formats command also works fine.
     -- When I run $ v4l2-ctl -d0 --list-framesizes command, the following error occurs.
    mxc-mipi-csi2.0: dwc_mipi_csi2_enum_framesizes, No remote pad found!


**device tree
 base file linux-imx/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts
 base file linux-imx/arch/arm64/boot/dts/freescale/imx93.dtsi
    I have attached the edited version. imx93-11x11-evk_fix.dts imx93_fix.dtsi
    I have set various parameters to support ov5640, but i think that further modifications are necessary.

 

**error contents
  Attached is the dmesg log. dmesg_logs.txt
  It appears that the camera is initialized normally using i2c. /dev/video0 exists.
  Running the $ media-ctl -p command will output the attached error log. media-ctl_errlogs.txt
  When i run the $ v4l2-ctl command, the system immediately freezes and no logs are output.


*additional information

**About the device driver used
  There are multiple device drivers for ov5640 and I don't know which one is appropriate to use.
example)
  1.linux-imx/drivers/media/platform/mxc/capture/ov5640_mipi_v2.c
  2.linux-imx/drivers/media/platform/mxc/capture/ov5640_v2.c
  3.linux-imx/drivers/media/i2c/ov5640.c
  I am currently using file 1 after modifying it, but the problem mentioned above is occurring.
  File 3 has a link_setup function that fixes No remote pad found!.
  Therefore, it would be nice if I could use this, but I don't know the dts file settings for using with i.MX93EVK.
  (Configuring MIPI-CSI, configuring ResetGPIO via IO expander, configuring clock, etc.)

  The important thing is that the camera works.
  It doesn't matter what device driver or dts file you use.
  I would like some advice on choosing a device driver and setting up a dts file.

Tags (2)
0 Kudos
1 Solution
2,429 Views
joanxie
NXP TechSupport
NXP TechSupport

why do you remove the data lane and clock? refer to the 93 dts file, you need add these parameters to the dts file like this

data-lanes = <2>;
cfg-clk-range = <28>;
hs-clk-range = <0x16>;

in additional, check and set the registers according to the table as below

joanxie_0-1693896469478.png

 

View solution in original post

0 Kudos
12 Replies
936 Views
wooosaiiii
Contributor III

Hi joanxie,

Can you share internal document with the table from the Solution post?

We have issues with i.MX93 and camera that outputs RAW Bayer format.

Thanks

 

0 Kudos
2,219 Views
gongyaxuan
Contributor I

After I added the relevant configuration in the device tree according to the above reply, after many tests, I have a high probability of getting stuck in the following print position, and only a very small probability of the program being able to go back and have the preview screen displayed. Why is that?

 

Here is the print log and the device tree configuration

gongyaxuan_0-1694591627564.png

gongyaxuan_1-1694591681583.png

gongyaxuan_2-1694591696608.png

 

 

0 Kudos
2,511 Views
joanxie
NXP TechSupport
NXP TechSupport

thanks for your sharing, so you can work on imx93 evk with the driver linux-imx/drivers/media/i2c/ov5640.c right? this driver is used on imx8mp evk with ISI

0 Kudos
2,487 Views
Ryo_Aoki
Contributor III

Hi joanxie.

Thank you your reply.
I will try editing dts to use linux-imx/drivers/media/i2c/ov5640.c.I would like to reflect the description of ov5640 in imx8mp-evk.dts to imx93-11x11-evk.dts.


https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/ov5640-support-on-imx8mp/ta-p/1305725
I would also like to check this community thread.

However, it seems difficult to correct hardware differences in dts files.
It would be helpful if the community could advise what to fix for imx93-11x11-evk.dts.

Best regards.

0 Kudos
2,458 Views
joanxie
NXP TechSupport
NXP TechSupport

I'm confused with your question, did you still struggle with HW design? imx93 has different mipi csi port from imx8mp, but we will release a convert board which can support imx93 mipi csi and imx8mp mipi csi, maybe you can wait for this, currently, only convert board for imx93

https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/rpi-cam-mipi:RP...

the new convert board is based on this

0 Kudos
2,448 Views
Ryo_Aoki
Contributor III

Hi joanxie.
I am using HBV-RPI-300FPC (22pin to 15pin FPC conversion cable) to connect it to PCAM 5C (OV5640).
I don't think there is any problem with HW.

Ryo_Aoki_0-1693817242335.png

Ryo_Aoki_1-1693817300092.png


I think it will work if I modify the dts file, but I haven't been able to fix it properly.
I refer to imx8mp-evk.dts.

Ryo_Aoki_2-1693817364163.png

 


First of all, xclk cannot be set, and the driver returns an ov5640 2-003c: failed to get xclk error.
I would appreciate it if you could give me some advice on setting imx93-11x11-evk.dts.

 

Best regards.

0 Kudos
2,434 Views
Ryo_Aoki
Contributor III

Hi community.

Thanks to the support I was able to see /dev/video0 by using the following device tree.

Ryo_Aoki_0-1693894585118.png

I don't know if this is good or not. Please point out if anything needs to be corrected.

 

The v4l2-ctl command also appears to be working fine.

Ryo_Aoki_1-1693894665103.png


It appears that I2C commands are being sent normally.

It would be a solution if the camera image could be displayed using the gst-launch-1.0 command, but that is not possible yet.

Ryo_Aoki_2-1693894690872.png

 

dmesg shows gasket not support format 16385 and no video appears on the display.

This error message is troubling because there are not many similar cases on the web.
I would appreciate any advice.

0 Kudos
2,430 Views
joanxie
NXP TechSupport
NXP TechSupport

why do you remove the data lane and clock? refer to the 93 dts file, you need add these parameters to the dts file like this

data-lanes = <2>;
cfg-clk-range = <28>;
hs-clk-range = <0x16>;

in additional, check and set the registers according to the table as below

joanxie_0-1693896469478.png

 

0 Kudos
2,386 Views
Ryo_Aoki
Contributor III

Hi joan xie.
After adding the following parameters to the dts file as advised, the camera worked.


data-lanes = <2>;
cfg-clk-range = <28>;
hs-clk-range = <0x16>;

The above parameters were not listed in the dts file that uses ap1302, so they remained as they were.

 

1000001060.jpg

However, the register table settings have not been added.
What document is this table in?

Best regards.

0 Kudos
2,373 Views
joanxie
NXP TechSupport
NXP TechSupport

good to hear that your camera works, this table is for new camera porting usage, this is from internal document, I couldn't share here, if you have any issue with porting new camera, you can check that, now you can ignore that since your ov5640 works

0 Kudos
2,333 Views
Ryo_Aoki
Contributor III

Hi joanxie.

Modifying dts files is difficult and I look forward to continued support from NXP.
I hope the published documentation will be better.
It was very helpful. thank you.

0 Kudos
2,329 Views
joanxie
NXP TechSupport
NXP TechSupport

the development team will release such document like imx8mp, because imx93 is still under preproudction, so the information is limited, any further help, pls contact us

0 Kudos