Brightness issue with image capture in the CSI pipeline

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

Brightness issue with image capture in the CSI pipeline

1,328 Views
blessyAbraham
Contributor I

I am using an imx8mn board in which i have the attached CSI pipeline configured.


graph_single.png

I have enabled pattern in ar0144 image sensor and configured the deserializer and serializer appropriately.

I configure the route and formats with the below commands.

media-ctl -d /dev/media0 --link '"ds90ub960 2-003d":4 -> "csis-32e30000.mipi-csi":0 [1]' && media-ctl -V '"csis-32e30000.mipi-csi":0 [SBGGR12_1X12/1280x800 field:none]' && media-ctl -V '"csis-32e30000.mipi-csi":1 [SBGGR12_1X12/1280x800 field:none]' && media-ctl -V '"crossbar":2 [SBGGR12_1X12/1280x800 field:none]' && media-ctl -V '"crossbar":0 [SBGGR12_1X12/1280x800 field:none]' && media-ctl -V '"mxc_isi.0":1 [SBGGR12_1X12/1280x800 field:none]' && media-ctl -V '"ds90ub953 2-000c":1 [SBGGR12_1X12/1280x800 field:none]' && media-ctl -V '"ds90ub960 2-003d":0 [SBGGR12_1X12/1280x800 field:none]' && media-ctl -V '"ds90ub960 2-003d":4 [SBGGR12_1X12/1280x800 field:none]' && media-ctl -V '"AR0144 4-0010":0 [SBGGR12_1X12/1280x800 field:none]'

v4l2-ctl --device /dev/video0 --set-fmt-video=width=1280,height=800,pixelformat=BG12

And I could capture an image with the command below,
v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=demo.raw --stream-count=1

But the image that was captured has a very low brightness.

1. The sensor output has been validated, and I am generating a valid test pattern directly from the sensor.
2. I have tried to disable the test pattern and tried to capture a live image. That too has the same brightness issue.
3. The image captured has a size of 2048000. However, upon analyzing the raw data, the maximum pixel value observed is 255. Does this indicate that the data is truncated to 8 bit somewhere in the pipeline?

Attaching the captured image for reference.

capture.png

0 Kudos
Reply
5 Replies

1,223 Views
blessyAbraham
Contributor I

Hi, 

Making the below change fixed the issue. 

}, {
.mbus_code = MEDIA_BUS_FMT_SBGGR12_1X12,
.fourcc = V4L2_PIX_FMT_SBGGR12,
.type = MXC_ISI_VIDEO_CAP,
.isi_out_format = CHNL_IMG_CTRL_FORMAT_RAW12,
.mem_planes = 1,
.color_planes = 1,
.depth = { 16 },
.encoding = MXC_ISI_ENC_RAW,
}, {

In the 5.4 kernel version, I see that the value was RAW12. With 6.9 kernel version, this change was intriduced, along with the below comment.
/*
* RAW formats
*
* The ISI shifts the 10-bit and 12-bit formats left by 6 and 4 bits
* when using CHNL_IMG_CTRL_FORMAT_RAW10 or MXC_ISI_OUT_FMT_RAW12
* respectively, to align the bits to the left and pad with zeros in
* the LSBs. The corresponding V4L2 formats are however right-aligned,
* we have to use CHNL_IMG_CTRL_FORMAT_RAW16 to avoid the left shift.
*/

Any reason why this change was made? 

Changing the format to raw12 shift the data by 4 bits and adds waste bit LSBs as per datasheet.
RAW12 - 12-bit RAW data packed into 16-bit DWORD with 4 LSBs waste bits
0 Kudos
Reply

1,242 Views
akshay_kurli
NXP Employee
NXP Employee

Hi, 

Could you please share the register dump for isi register, on both kernel versions you are referring.

 

Regards,

Akshay 

0 Kudos
Reply

1,274 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

for imx8mp, ar0144 is used as monochrome sensor, and uses 8mplus isp directly and bypasses the oncamera isp, 

Bio_TICFSL_0-1736366143097.jpeg

 

 

Bio_TICFSL_1-1736366143073.jpeg

 

 

 

and on 8mplus it does support yuy2 format, 

Regards

0 Kudos
Reply

1,253 Views
blessyAbraham
Contributor I

I am trying to port the kernel version from 5.4 to 6.9, with which I noticed there are changes in the NXP drivers. 

I set the format as SBGGR12_1X12.

With the 5.4 kernel version, I capture image from the image sensor and I see proper image captured. 
capture_5.4.png

On examining the raw image captured from 5.4 kernel version, I see the below value.
*
01f35f0 0000 0000 0000 0000 f700 f700 f700 f700
01f3600 f700 f700 f700 f700 f700 f700 f700 f700
*
01f3730 f700 f700 f700 f700 0000 f700 0000 f700
01f3740 0000 f700 0000 f700 0000 f700 0000 f700
*
01f3870 0000 f700 0000 f700 f700 f700 f700 f700
01f3880 f700 f700 f700 f700 f700 f700 f700 f700
*

But With 6.9 kernel version, the image looks very dark. 
capture.png

I see the hexdump of captured image (6.9 version) as below,
*
01f3730 0f70 0f70 0f70 0f70 0000 0f70 0000 0f70
01f3740 0000 0f70 0000 0f70 0000 0f70 0000 0f70
*
01f3870 0000 0f70 0000 0f70 0f70 0f70 0f70 0f70
01f3880 0f70 0f70 0f70 0f70 0f70 0f70 0f70 0f70
*
01f39b0 0f70 0f70 0f70 0f70 0000 0f70 0000 0f70
01f39c0 0000 0f70 0000 0f70 0000 0f70 0000 0f70
*
01f3af0 0000 0f70 0000 0f70 0f70 0000 0f70 0000
01f3b00 0f70 0000 0f70 0000 0f70 0000 0f70 0000
*

Is the pixel value not getting shifted by 4 bits in case of RAW12 format in 6.9 kernel version imx drivers?

I also saw the below comment in file /drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c 

/*
* RAW formats
*
* The ISI shifts the 10-bit and 12-bit formats left by 6 and 4 bits
* when using CHNL_IMG_CTRL_FORMAT_RAW10 or MXC_ISI_OUT_FMT_RAW12
* respectively, to align the bits to the left and pad with zeros in
* the LSBs. The corresponding V4L2 formats are however right-aligned,
* we have to use CHNL_IMG_CTRL_FORMAT_RAW16 to avoid the left shift.
*/

Is there something missing?
0 Kudos
Reply

1,240 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Could you please share the register dump for isi register, on both kernel versions you are referring.

 

Regards

0 Kudos
Reply