MIPI CSI interface support for interfacing Image Sensor


#41

Hi Todor,

       One quick question about RAW image sensor,take RAW10,640*480 for example,the frame size should be 640*480*2 or 640*480*10/8? I thought driver would put 6 0s for high 6bits,using two bytes to present a pixel.

Regards,
Xiang


#42

Hi Xiang,

RAW10 as per MIPI CSI2 specification is 4 pixels in 5 bytes. The driver does not do any conversion, just outputs to memory.


#43

Thanks,i guess i need to some software conversion to recover each pixel in two bytes,in which case raw image would make sense.


#44

Hi Todor,

we want to test the dragonboard 410c for the purpose of capturing still images and
do image processing on them.

Do you have any suggestions which sensor to use for first experiments in this and where to get
this hardware?

What tools should we use? - We have not used v4l2 and csi interfaces in our older systems yet.

Regards,
Michael


#45

Hi Todor,

       We looked at the Nvidia Tegra chip and TI's DM38x series CSI2 receiver,basically they both support formatted data(called pixel transform,attached an image for that) .When storing data to memory,either the formatted data or the original data may be stored to memory. My question is does APQ8016 support this kind of pixel transform? 

Regards
Xiang


#46

Dear Sirs.

We have been trying to connect IMX219 RaspberryPi camera to DragonBoard 410c by referring the articles here and have succeeded in capturing the RAW10 data. We referred the articles in following web community to connect several Sony image sensors and got the register setting information to modify the camera driver in the kernel.

The major modification is as follows.
#1 is the most critical.

  1. To change pixel format (UYVY -> RAW10)

imx219.c:

static int imx219_set_format(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *format) {
struct imx219 *imx219 = to_imx219(sd);
struct v4l2_mbus_framefmt *__format;

__format->code = MEDIA_BUS_FMT_SBGGR10_1X10; // ERROR on GStreamer.

  1. To change default picture size:

imx219.c:

static int imx219_entity_init_cfg(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg) {
struct v4l2_subdev_format fmt = { 0 };
struct imx219 *imx219 = to_imx219(subdev); …
fmt.format.width = 640;
fmt.format.height = 480;

  1. I2C address change disabled:

imx219.c:

static int imx219_s_power(struct v4l2_subdev *sd, int on) {
struct imx219 imx219 = to_imx219(sd);
int ret = 0;

// Removed.
/

ret = ov5645_write_reg_to(ov5645, 0x3100,
ov5645->i2c_client->addr, 0x78);
if (ret < 0) {
dev_err(ov5645->dev,
“could not change i2c address\n”);
ov5645_set_power_off(ov5645);
mutex_unlock(&ov5645_lock);
goto exit;
}
*/

  1. i2c address of IMX219 is set to 0x20 in DeviceTree.

apq8016-sbc.dtsi:

&blsp_i2c6 {
status = “ok”;

camera_rear@20 {
	compatible = "sony,imx219";
	reg = <0x20>;

Now we can see the RAW image with converting 5byte into 4pixel data.
However, we still have the problem to see the image/video with gstreamer.
Nothing can be seen even the video stream is coming from the module camera.
It would be nice to us if some one share the information to see the RAW data with developing the image by gstreamer viewer.
We are expecting that HW ISP will execute the image development by proper configuration.

Best Regards,

NOMURA


#47

Hi Xiang,

The hardware technically can do this conversion (for 10 and 12 bit pixel size) but we do not have support for this in the driver.


#48

Hi Nomura,

Thank you for your report on your success with the IMX219 and DB410c. Unfortunately we do not have support in our Linux driver for Bayer RAW image processing by the ISP.


#49

Dear Mr. todortomov.

Thank you very much for your quick reply.
But I’m very disappointed to hear that HW ISP is not supported.

It is also helpful if gstreamer can develop the image by SW proccessing and show the image. Do you have any experience for this?
It would be great if you could show the reference script or command option for it.

Best Regards,

NOMURA


#50

We changed IMX219 configuration to output RAW8. Finally we can see the image with gstreamer developed by SW processing.


#51

Using the AiStarVision MIPI Adaptor V2.0, what would be a good test pipeline to use to see if my camera is setup properly for video capture from the camera? Is your test application publically available for someone like me to test my camera?

I’ve tried the following to get raw video into a file using gstreamer-1.0:
linaro@linaro-developer:~$ gst-launch-1.0 v4l2src ! video/x-raw,width=1920,height=1080,framerate=30/1 ! filesink location=test.raw
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
libv4l2: error turning on stream: Link has been severed
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not read from resource.
Additional debug info:
gstv4l2bufferpool.c(995): gst_v4l2_buffer_pool_poll (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
poll error 1: Link has been severed (67)
Execution ended after 0:00:00.024279009
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …

I see the vfe subsystem attempting to start up from my dmesg logs, I just can’t seem to get video working:
[ 7614.419256] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 1
[ 7614.419346] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 1
[ 7614.424811] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 1
[ 7614.432048] qcom-camss 1b0ac00.camss: VFE HW Version = 0x10030000
[ 7614.438000] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 1
[ 7614.444570] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 0
[ 7614.451231] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 0
[ 7614.457526] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 0
[ 7614.464580] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 0
[ 7615.579355] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 1
[ 7615.579443] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 1
[ 7615.585042] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 1
[ 7615.592142] qcom-camss 1b0ac00.camss: VFE HW Version = 0x10030000
[ 7615.598104] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 1
[ 7615.604657] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 0
[ 7615.611321] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 0
[ 7615.617690] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 0
[ 7615.624557] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 0
[ 7655.990163] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 1
[ 7655.990309] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 1
[ 7655.995831] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 1
[ 7656.003868] qcom-camss 1b0ac00.camss: VFE HW Version = 0x10030000
[ 7656.009152] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 1
[ 7656.016618] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 0
[ 7656.022290] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 0
[ 7656.028541] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 0
[ 7656.036265] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 0
[ 7656.060926] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 1
[ 7656.061158] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 1
[ 7656.066851] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 1
[ 7656.073824] qcom-camss 1b0ac00.camss: VFE HW Version = 0x10030000
[ 7656.079668] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 1
[ 7656.104206] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_stream: Enter, enable = 1
[ 7656.104295] qcom-camss 1b0ac00.camss: init_addrs: wm[0], ping = 0x40000000, pong = 0x40400000
[ 7656.110739] qcom-camss 1b0ac00.camss: ispif_set_stream: Enter, enable = 1
[ 7656.125648] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 0
[ 7656.126057] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 0
[ 7656.132523] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 0
[ 7656.139529] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 0
[ 7667.121581] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 1
[ 7667.121676] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 1
[ 7667.127134] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 1
[ 7667.134493] qcom-camss 1b0ac00.camss: VFE HW Version = 0x10030000
[ 7667.140338] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 1
[ 7667.147020] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 0
[ 7667.153558] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 0
[ 7667.159860] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 0
[ 7667.167059] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 0
[ 7667.187959] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 1
[ 7667.188057] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 1
[ 7667.193851] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 1
[ 7667.200935] qcom-camss 1b0ac00.camss: VFE HW Version = 0x10030000
[ 7667.206767] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 1
[ 7667.226909] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_stream: Enter, enable = 1
[ 7667.227000] qcom-camss 1b0ac00.camss: init_addrs: wm[0], ping = 0x40000000, pong = 0x40400000
[ 7667.233536] qcom-camss 1b0ac00.camss: ispif_set_stream: Enter, enable = 1
[ 7667.249604] qcom-camss 1b0ac00.camss: ispif_set_power: Enter, on = 0
[ 7667.249664] qcom-camss 1b0ac00.camss: ispif_set_power: Exit, on = 0
[ 7667.255241] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Enter, on = 0
[ 7667.262392] qcom-camss 1b0ac00.camss: msm_vfe_subdev_set_power: Exit, on = 0


#52

I want to connect two omnivision image sensors OV9281 directly with the 410c board through 2 MIPI CSI2 interface.
Do you have a imager drive source code download, so that we can modify that for our imagers?
Thanks

Wen


#53

Thanks Todor,great to know.

Regards,
Xiang


#54

Hi Todor,

So just want to let you know that we have made OV7251 work with dragonboard410c,this global shutter sensor can run up to 100fps,thanks for your support of this.As you know, we still need some software convert the MIPI raw image.(5bytes to 4 pixel conversion).Please let us know if this part of driver is ready from hardware side.I don’t know when it could be ready,but i think there is a lot of people waiting for that.

Regards,
Xiang


#55

Hi ,

Can anyone please share the details to interface ov13850 rear camera into my dragon board 410c, I’m new to dragon board can anyone please share how and where the kernel files are affected for camera.
I applied patch which is related to ov13853 which i got in codeaurora.

thanks in advance


#56

Hi Nomura,
Can you post the imx219.c driver code? I cannot find it anywhere.
Thanks,
kim


#57

I’m sorry I didn’t post the driver code, just wrote all what we modified in the post above.
We expected that I can touch HW ISP but couldn’t, then stopped investigation on Dragonboard.
We are working on Tinker Board instead.


#58

Hi Nomura,
Can you tell me which repository you got the imx219.c driver code from?
Thanks,
Kim


#59

Hi Todortomov,
I am trying to set the qcom, settle-cnt for some mipi data coming into a Snapdragon 820. Is the csiphy0_timer_clk still 200MHz for the Snapdragon 820? Is this the receiver clock? Or transmitter clock?

The mipi data coming into the Snapdragon 820 is coming from a custom board. We took an oscilloscope screen shot (attached) of the mipi data at the beginning and labeled what we think is the Ths-Settle value, but we don’t know for sure. Can you help? We are having issues capturing and it seems that qcom,settle-cnt is an important piece but I’m not sure how to set it.

Thanks,
kimbo


#60

Hi kimbo,

csiphy0_timer_clk is clock of the csi receiver core (for DB820c it can be 100MHz, 200MHz or 266MHz), this is not the CSI2 link clock that you will see if you connect the oscilloscope to the CSI2 clock lane. In the camss driver currently the CSI2 link clock is calculated from the sensor pixel clock (which is received from the sensor driver by getting a user control). The settle count value is calculated too. If you experience any problems, you can check that CSI2 link clock that you see with the oscilloscope is the same as the calculated, also you can measure the settle time - your diagram looks good. Or sometimes it could be helpful to just play a little with the settle count parameter and see what works.