DART-SD410 Debian Camera 5.7.0

From Variscite Wiki
Revision as of 14:51, 29 November 2020 by Leonid (talk | contribs) (Created page with "{{PageHeader|DART-SD410 - Camera}} {{DocImage|category1=DART-SD410|category2=Debian}} __toc__ This is the updated release of CSI based camera support. OV5645 is supported on b...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
DART-SD410 - Camera

This is the updated release of CSI based camera support. OV5645 is supported on both CSI channels with a maximum of 1080p resolutions.


NOTE:
It is suggested to use a virtual terminal and Linaro account for testing.

Make sure that you have the following package installed:

$ sudo apt-get update
$ sudo apt-get install v4l-utils

To ensure that your sensor is properly connected, you can inspect the output of the following command:

$ sudo media-ctl -d /dev/media0 -p

If everything is ok, you should see something that ends with:

- entity 87: ov5645 4-003b (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev10
        pad0: Source
                [fmt:UYVY8_2X8/1920x1080 field:none colorspace:srgb
                 crop:(0,0)/1920x1080]
                -> "msm_csiphy1":0 [ENABLED,IMMUTABLE]

At this point you need to configure the pipeline: link CSIPHY to CSID and CSID to ISPIF, and configure formats on OV5645, CSIPHY and CSID:

$ sudo media-ctl -d /dev/media0 -l '"msm_csiphy1":1->"msm_csid1":0[1],"msm_csid1":1->"msm_ispif1":0[1],"msm_ispif1":1->"msm_vfe0_pix":0[1]'
$ sudo media-ctl -d /dev/media0 -V '"ov5645 4-003b":0[fmt:UYVY8_2X8/1920x1080 field:none]'
$ sudo media-ctl -d /dev/media0 -V '"ov5645 4-003b":0[fmt:UYVY8_2X8/1920x1080 field:none]'
$ sudo media-ctl -d /dev/media0 -V '"msm_csiphy1":0[fmt:UYVY8_2X8/1920x1080 field:none]'
$ sudo media-ctl -d /dev/media0 -V '"msm_csid1":0[fmt:UYVY8_2X8/1920x1080 field:none]'
$ sudo media-ctl -d /dev/media0 -V '"msm_ispif1":0[fmt:UYVY8_2X8/1920x1080 field:none]'
$ sudo media-ctl -d /dev/media0 -V '"msm_vfe0_pix":0[fmt:UYVY8_2X8/1920x1080 field:none]'
$ sudo media-ctl -d /dev/media0 -V '"msm_vfe0_pix":1[fmt:UYVY8_1_5X8/1920x1080 field:none]'

At this point, the pipeline should be configured and ready to be used by any application that can use v4l2. For example, you can use Gstreamer to take a JPEG picture. The driver shuts down the camera when it is not used, so the camera exposure is not saved between snapshots. In order to get the snapshot with correct exposure, the first 5-6 images should be skipped. To skip the first 6 images use multifilesink with static filename.

$ gst-launch-1.0 v4l2src device=/dev/v4l/by-path/platform-1b0ac00.camss-video-index3 num-buffers=6 ! video/x-raw,format=NV12,width=1920,height=1080 ! jpegenc ! multifilesink post-messages=true location="snapshot.jpg"

Or you can use Gstreamer to record a video:

$ gst-launch-1.0 -e v4l2src device=/dev/v4l/by-path/platform-1b0ac00.camss-video-index3 ! video/x-raw,format=NV12,width=1920,height=1080 ! videoconvert n-threads=4 ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=10,video_bitrate=25000000" ! h264parse ! mp4mux ! filesink location=video.mp4