imx8mp EVK board - V4L OV5640 - no subdev ?

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

imx8mp EVK board - V4L OV5640 - no subdev ?

2,409 Views
arno_0
Contributor III

Bootet the latest Release 2.2.0 (all default, no changes).

It recognises sensor, so dtb seems to be fine.

dmesg | grep ov5
[ 2.250350] ov5640 1-003c: supply DOVDD not found, using dummy regulator
[ 2.257154] ov5640 1-003c: supply AVDD not found, using dummy regulator
[ 2.263831] ov5640 1-003c: supply DVDD not found, using dummy regulator
[ 6.958158] mx8-img-md: Registered sensor subdevice: ov5640 1-003c (1)
[ 6.987999] mx8-img-md: created link [ov5640 1-003c] => [mxc-mipi-csi2.0]

What I am wondering, there is just one v4l-subdev0, and this is not the sensor.

Testing it returns:

v4l2-ctl -d /dev/v4l-subdev0 -L
[ 1587.673285] mxc-mipi-csi2.0: unsupported csi-sam command -1070836166.

What is wrong?

Thanks, arno

 

The mediapipe looks like that below:

media-ctl -p
Media controller API version 5.15.71

Media device information
------------------------
driver mxc-md
model FSL Capture Media Device
serial
bus info
hw revision 0x0
driver version 5.15.71

Device topology
- entity 1: mxc_isi.0 (16 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0
pad0: Sink
<- "mxc-mipi-csi2.0":4 [ENABLED]
pad1: Sink
pad2: Sink
pad3: Sink
pad4: Sink
pad5: Sink
pad6: Sink
pad7: Sink
pad8: Sink
pad9: Sink
pad10: Sink
pad11: Sink
pad12: Source
-> "mxc_isi.0.capture":0 [ENABLED]
pad13: Source
pad14: Source
pad15: Sink

- entity 18: mxc_isi.0.capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video3
pad0: Sink
<- "mxc_isi.0":12 [ENABLED]

- entity 22: mxc-mipi-csi2.0 (8 pads, 2 links)
type Node subtype V4L flags 0
device node name /dev/v4l-subdev0
pad0: Sink
<- "ov5640 1-003c":0 [ENABLED,IMMUTABLE]
pad1: Sink
pad2: Sink
pad3: Sink
pad4: Source
-> "mxc_isi.0":0 [ENABLED]
pad5: Source
pad6: Source
pad7: Source

- entity 31: ov5640 1-003c (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
pad0: Source
-> "mxc-mipi-csi2.0":0 [ENABLED,IMMUTABLE]

 

0 Kudos
Reply
8 Replies

2,370 Views
arno_0
Contributor III

Thanks for this hints. Think we mix up some things here. You are talking about support of ISP driver.That increases the complexity a lot and is probably a different topic. Also it is disabled by default in EVK devicetree.

Do I understood you right, there are in principle two ways to capture:

* via ISP (which only supports few sensors (ar1335, os08a20, oc2775).

* via CSI and ISI (see attached picture - there is a blue connection bypassing the ISP, easily to be overseen).


>> You can access OV5640 camera by /dev/videoX

Can you tell me how that works?

Using the EVK+Sensorboard on a 2.2.0 BSP out of the box, there is a videox. According to mediactl /dev/video3 is the capture device (see my first post). I don't have right now a running board in front of me (let me check that next week), but I am pretty sure I saw neither controls for exposure nor gain (just as an example) and haven't been able to capture an image.

In a standard V4L2 implementation sensor would be registered as an own subdev. I don't understand how it works here?

How would you capture an image, change exposure?

I am surprised that the CAMERA guide doesn't even mentioned that easier way of bypassing the ISP.

0 Kudos
Reply

2,341 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

1. Do I understood you right, there are in principle two ways to capture:

* via ISP (which only supports few sensors (ar1335, os08a20, oc2775).

* via CSI and ISI (see attached picture - there is a blue connection bypassing the ISP, easily to be overseen)

--->Correct

2. Can you tell me how that works?

-->You can refer this test code :https://source.codeaurora.org/external/imx/imx-test/tree/test/mxc_v4l2_test/mx8_v4l2_cap_drm.c?h=lf-...

Qmiller_1-1672022385949.png

 

The exposure or gain can be controlled by VIDIOC_S_PARM,these parms will be set in 

ov5640_s_parm->ov5640_init_mode[drivers/media/platform/mxc/capture/ov5640_mipi_v2.c]
 

 

2,322 Views
arno_0
Contributor III
Thanks for sharing this. Please give me some times to test that. So that means, it can't be controlled as a standard V4L device than? Usually you can use the v4l or gstreamer commands to build a pipe and control the params, right?

That's all very confusing and hard to overview without a guide/howto. I would expect the location of sensor driver here: drivers/media/i2c/ov5640.c

Now I see that there are platform drivers too. What exactly does it mean, what is the idea behind that? And we do have: imx8/mxc/nxp ... who should find the right one? Do you have a rule for where to look at? And for the ov5640 there are not less than 4 different files beside that one in media/i2c.

Finally I want to implement my own sensor driver (of a so far not supported chip). What would you prefer? The "isp" way promises more features but seems to be more complex. Is there a special reason why the OV as one of your standard sensors isn't supported by the ISP?
0 Kudos
Reply

2,393 Views
arno_0
Contributor III

Good points: Using latest BSP Linux 5.15.71_2.2.0. on a EVK board.

There seems to be no dedicated dtb for ov5640. There is only one with Basler in its name  (imx8mp-evk-basler-ov5640.dtb).

As camera sensor is found and bind (see log in my initial post) with default dtb I thought it should be the right one. I also bought that sensor board from NXP, with no Basler logo on it. Also tested booting that basler.dtb which fails:

[ 2.357282] ov5640 2-003c: ov5640_read_reg: error: reg=300a
[ 2.362871] ov5640 2-003c: ov5640_check_chip_id: failed to read chip identifier

mediapipe is setup to use isp and vvcam with basler.dtb, not mipi-csi and isi as expected.

So how can I start operating with that NXP sensor-board ov5640?

0 Kudos
Reply

2,383 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Testing it returns:

v4l2-ctl -d /dev/v4l-subdev0 -L
[ 1587.673285] mxc-mipi-csi2.0: unsupported csi-sam command -1070836166.

What is wrong?

---->The driver has been probed correctly, NXP csi driver doesn't support the commnand you use.

 

static long csis_priv_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg_user)
{
	int ret = 1;
	struct csi_state *state = container_of(sd, struct csi_state, sd);
	void *arg = arg_user;

	pm_runtime_get_sync(state->dev);

	switch (cmd) {
	case VVCSIOC_RESET:
		mipi_csis_sw_reset(state);
		ret = 0;
		break;
	case VVCSIOC_POWERON:
		ret = mipi_csis_s_power(sd, 1);
		break;
	case VVCSIOC_POWEROFF:
		ret = mipi_csis_s_power(sd, 0);
		break;
	case VVCSIOC_STREAMON:
		ret = mipi_csis_s_stream(sd, 1);
		break;
	case VVCSIOC_STREAMOFF:
		ret = mipi_csis_s_stream(sd, 0);
		break;
	case VVCSIOC_S_FMT: {
		USER_TO_KERNEL(struct csi_sam_format);
		ret = csis_s_fmt(sd, (struct csi_sam_format *)arg);
		break;
	}
	case VVCSIOC_S_HDR: {
		USER_TO_KERNEL(bool);
		ret = csis_s_hdr(sd, *(bool *) arg);
		break;
	}
	case VIDIOC_QUERYCAP:
		ret = csis_ioc_qcap(sd, arg);
		break;
	default:
		v4l2_err(&state->sd, "unsupported csi-sam command %d.", cmd);
		ret = -EINVAL;
		break;
	}
	pm_runtime_put(state->dev);

	return ret;
}
0 Kudos
Reply

2,379 Views
arno_0
Contributor III
Ok, but shouldn't -L list all commands it has? Even if it has no command it shoudn't return with an error, right?

But the more important question. How to get images from that sensor? NXP sells both EVK and OV6540 boards and it should be possible to get an image from there, right? But how? For me it looks that standard V4L is broken here.
* why there is no subdev for the sensor?
* how to get an image via sensor->mipi->csi->(isi?)-> memory?
0 Kudos
Reply

2,373 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

You can't access OV5640 via vl42-subdev, the vl42-subdev is created by isp driver which doesn't support OV5640 sensor, the supported device is listed here: https://source.codeaurora.org/external/imx/isp-vvcam/tree/vvcam/v4l2/sensor?h=lf-5.15.y_2.0.0

You can access OV5640 camera by /dev/videoX

Qmiller_0-1671771157171.png

The camera document:

https://www.nxp.com/docs/en/user-guide/iMX8MP_CAMERA_DISPLAY_GUIDE.pdf

2,395 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Can you share the specific BSP version?

Have you set the ov5640 dtb in uboot?

0 Kudos
Reply