RZ-G/RZG2 camera

From eLinux.org
< RZ-G
Revision as of 09:48, 29 October 2020 by Cbrandt (talk | contribs) (added Displaying Camera Images using GStreamer)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Displaying Camera Images using GStreamer

These instructions are for using a OV5645 MIPI Camera and MIPI Adapter Mezzanine board.

Before GStreamer can be used, the VIN/CSI settings must best configured manually on the command line using the media-ctl utility.

In the BSP, this is done by running the script /home/root/vin-init.sh in the rootfs.

This file located in the BSP at rzg2_bsp_eva_v104/meta-rzg2/recipes-multimedia/vin-init/files/vin-init.sh

The BSP also installs the file systemd service file "vin.service" into /etc/systemd/system/multi-user.target.wants/vin.service so that the vin-init.sh script runs automatically on system boot.

For example, for RZ/G2E,the follow command will be executed:

media-ctl -d /dev/media0 -r  
media-ctl -d /dev/media0 -l "'rcar_csi2 feaa0000.csi2':1 -> 'VIN4 output':0 [1]"   
media-ctl -d /dev/media0 -V "'rcar_csi2 feaa0000.csi2':1 [fmt:UYVY8_2X8/1280x960 field:none]"   
media-ctl -d /dev/media0 -V "'ov5645 3-003c':0 [fmt:UYVY8_2X8/1280x960 field:none]"  

This connects VIN4 (/dev/video0) to OV5645.

The only thing you can change in G2E is 'VIN4 output' => 'VIN5 output' if you want to use /dev/video1

With the Gstreamer pipeline, you have to add vspmfilter or vspfilter to convert UYVY to BGRA. Example:

gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=dmabuf ! 'video/x-raw,format=UYVY,width=1280,height=960,framerate=30/1' ! vspfilter ! 'video/x-raw,format=BGRA' ! waylandsink 
gst-launch-1.0 -v v4l2src device=/dev/video0 ! 'video/x-raw,format=UYVY,width=1280,height=960,framerate=30/1' ! vspmfilter dmabuf-use=true ! 'video/x-raw,format=BGRA' ! waylandsink 

HACK FOR EARLY BOARDS: As for the intermittent 'device is busy' and similar errors - these seem to be caused by glitches in the electrical connections of the MIPI cameras. Just unplugging the camera and plugging it a couple of times fixed the issue it seems.