RZ/V2H and RZ/V2N CRU
- 1 EVK Supported Cameras
- 2 Video4Linux
- 2.1 Verify Camera Detection
- 2.2 Get Camera Topology/Pipeline
- 2.3 Get Supported Formats and Resolutions
- 2.4 Get Camera and RZ CRU Parameters
- 2.5 MIPI-CSI Camera Pipline Configuration (media-ctl)
- 2.5.1 RZV Command Break Down
- 2.5.1.1.1 RZV2H and RZV2N MIPI Camera
- 2.5.1.2 Command 1: Reset the Media Pipeline
- 2.5.1.3 Command 2: Link CSI-2 Output to CRU Input
- 2.5.1.4 Command 3: Set Format on CSI-2 Output Pad
- 2.5.1.5 Command 4: Set Format on IMX462 Sensor Output
- 2.5.1.6 Key Points:
- 2.5.2 Setting the CRU Output
- 2.5.1 RZV Command Break Down
- 3 Terminology
EVK Supported Cameras
Renesas RZV EVK support MIPI Camera Module
Video4Linux
Video4Linux (V4L2) is the primary framework in Linux for handling video capture devices, including MIPI and USB camera modules (e.g., CSI-2 connected cameras). Here’s how V4L2 is used to configure and interact with such cameras:
In the examples below a MIPI Camera and USB Camera attached to the EVK
Verify Camera Detection
# List video devices
ls /dev/video*
# Query cameras
v4l2-ctl --list-devices
v4l2-ctl --device=/dev/video0 --all
# Query Supported Camera Formats ( For USB )
v4l2-ctl -d /dev/video0 --list-formats-extExample Output ... ( both MIPI and USB Camera Attached)
root@rzv2n-evk:~# ls /dev/video*
/dev/video0 /dev/video1 /dev/video2 /dev/video3 /dev/video4
root@rzv2n-evk:~# v4l2-ctl --list-devices
RZG2L_CRU (platform:16000000.cru0):
/dev/video0
/dev/media0
renesas,cru-r9a09g056 (platform:16010000.cru1):
/dev/media1
Logitech BRIO (usb-15850000.usb-1):
/dev/video1
/dev/video2
/dev/video3
/dev/video4
/dev/media2Get Camera Topology/Pipeline
For MIPI-CSI Cameras it is necessary to examine the topology/pipeline ( Camera Module → MIPI-CSI → CRU → CRU Output ). This information is related to the Device Tree ( ports and endpoints).
media-ctl -d /dev/media0 -p
Media controller[ 356.274668] imx462 0-001f: imx462_get_fmt code=0x2006, w/h=(1920,1080), colorspace=7, field=1
API version 5.10.145
Media device information
------------------------
driver rzg2l_cru
model renesas,cru-r9a09g057
serial
bus info platform:16000000.cru0
hw revision 0x0
driver version 5.10.145
Device topology
- entity 1: rzg2l_csi2 16000400.csi20 (5 pads, 5 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/1920x1080 field:none colorspace:srgb]
<- "imx462 0-001f":0 [ENABLED,IMMUTABLE]
pad1: Source
[fmt:UYVY8_2X8/1920x1080 field:none colorspace:srgb]
-> "CRU output":0 [ENABLED]
pad2: Source
[fmt:UYVY8_2X8/1920x1080 field:none colorspace:srgb]
-> "CRU output":0 []
pad3: Source
[fmt:UYVY8_2X8/1920x1080 field:none colorspace:srgb]
-> "CRU output":0 []
pad4: Source
[fmt:UYVY8_2X8/1920x1080 field:none colorspace:srgb]
-> "CRU output":0 []
- entity 7: imx462 0-001f (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev1
pad0: Source
[fmt:UYVY8_2X8/1920x1080 field:none colorspace:jpeg]
-> "rzg2l_csi2 16000400.csi20":0 [ENABLED,IMMUTABLE]
- entity 15: CRU output (1 pad, 4 links)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "rzg2l_csi2 16000400.csi20":1 [ENABLED]
<- "rzg2l_csi2 16000400.csi20":2 []
<- "rzg2l_csi2 16000400.csi20":3 []
<- "rzg2l_csi2 16000400.csi20":4 []Get Supported Formats and Resolutions
Below is how to get the supported Formats of Camera and CRU.
USB Camera Supported: Formats, Resolutions, and fps
v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'YUYV' (YUYV 4:2:2)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.042s (24.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
.....
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.042s (24.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
[1]: 'MJPG' (Motion-JPEG, compressed)
Size: Discrete 640x480
Interval: Discrete 0.008s (120.000 fps)
Interval: Discrete 0.011s (90.000 fps)
Interval: Discrete 0.017s (60.000 fps)
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.042s (24.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
.....
Size: Discrete 4096x2160
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.042s (24.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
[2]: 'NV12' (Y/UV 4:2:0)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.042s (24.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)
.....
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.042s (24.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.133s (7.500 fps)
Interval: Discrete 0.200s (5.000 fps)MIPI-CSI CRU Supported: Formats
root@rzv2n-evk:~# v4l2-ctl --device=/dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'NV16' (Y/CbCr 4:2:2)
[1]: 'GREY' (8-bit Greyscale)
[2]: 'YUYV' (YUYV 4:2:2)
[3]: 'UYVY' (UYVY 4:2:2)
[4]: 'BGR3' (24-bit BGR 8-8-8)
[5]: 'XR24' (32-bit BGRX 8-8-8-8)
[6]: 'AR24' (32-bit BGRA 8-8-8-8)
[7]: 'BA24' (32-bit ARGB 8-8-8-8)
[8]: 'RGGB' (8-bit Bayer RGRG/GBGB)
[9]: 'BA81' (8-bit Bayer BGBG/GRGR)
[10]: 'GRBG' (8-bit Bayer GRGR/BGBG)
[11]: 'GBRG' (8-bit Bayer GBGB/RGRG)
[12]: 'RG10' (10-bit Bayer RGRG/GBGB)
[13]: 'BG10' (10-bit Bayer BGBG/GRGR)
[14]: 'BA10' (10-bit Bayer GRGR/BGBG)
[15]: 'GB10' (10-bit Bayer GBGB/RGRG)
[16]: 'RG12' (12-bit Bayer RGRG/GBGB)
[17]: 'BG12' (12-bit Bayer BGBG/GRGR)
[18]: 'BA12' (12-bit Bayer GRGR/BGBG)
[19]: 'GB12' (12-bit Bayer GBGB/RGRG)
[20]: 'pREE' (14-bit Bayer RGRG/GBGB Packed)
[21]: 'pBEE' (14-bit Bayer BGBG/GRGR Packed)
[22]: 'pgEE' (14-bit Bayer GRGR/BGBG Packed)
[23]: 'pGEE' (14-bit Bayer GBGB/RGRG Packed)
[24]: 'RG16' (16-bit Bayer RGRG/GBGB)
[25]: 'BYR2' (16-bit Bayer BGBG/GRGR)
[26]: 'GR16' (16-bit Bayer GRGR/BGBG)
[27]: 'GB16' (16-bit Bayer GBGB/RGRG)NOTE: See Change CRU Output
MIPI-CSI Camera Module : Formats and Resolutions
# List Supported Formats
root@rzv2h-evk-ver1:~# v4l2-ctl -d /dev/v4l-subdev1 --list-subdev-mbus-codes pad=0
ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0)
0x2006: MEDIA_BUS_FMT_UYVY8_2X8
# List Supported Resolutions for given format (0x2006)
root@rzv2h-evk-ver1:~# v4l2-ctl -d /dev/v4l-subdev1 --list-subdev-framesizes pad=0,code=0x2006
ioctl: VIDIOC_SUBDEV_ENUM_FRAME_SIZE (pad=0)
Size Range: 640x480 - 640x480
Size Range: 1280x720 - 1280x720
Size Range: 1920x1080 - 1920x1080
Get Camera and RZ CRU Parameters
Check the MIPI Camera module supported formats.
# Set resolution and pixel format (e.g., YUYV/MJPG)
v4l2-ctl --device=/dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=YUYV
# Adjust exposure, gain, etc. (if supported)
v4l2-ctl --device=/dev/video0 --set-ctrl=exposure_auto=1
v4l2-ctl --device=/dev/video0 --set-ctrl=exposure_absolute=100MIPI-CSI Camera Pipline Configuration (media-ctl)
The media-ctl command is not part of the Video4Linux (V4L2) framework itself, but it is closely related and often used alongside V4L2 for managing media device pipelines in Linux.
Key Points:
media-ctlis part of thev4l-utilspackage, which provides tools for working with V4L2 devices.It interacts with the Linux Media Controller API (MC API), a subsystem that handles complex media device topologies (e.g., cameras, sensors, encoders, and their interconnections).
V4L2 focuses on video capture and output, while Media Controller manages the entire pipeline (sensors, ISP, DMA engines, etc.).
Use Case:
media-ctlconfigures routes, formats, and links between components (e.g., connecting a camera sensor to an ISP in the pipeline) before V4L2 applications (likev4l2-ctlor GStreamer) use the device.
RZV Command Break Down
RZV2H and RZV2N MIPI Camera
media-ctl -d /dev/media0 -r
media-ctl -d /dev/media0 -l "'rzg2l_csi2 16000400.csi20':1 -> 'CRU output':0 [1]"
media-ctl -d /dev/media0 -V "'rzg2l_csi2 16000400.csi20':1 [fmt:UYVY8_2X8/1920x1080 field:none]"
media-ctl -d /dev/media0 -V "'imx462 0-001f':0 [fmt:UYVY8_2X8/1920x1080 field:none]"These commands configure a media pipeline on a Linux system (likely an embedded platform like Renesas RZ/G2L) using the media-ctl tool. They set up links and formats between a CSI-2 receiver (rzg2l_csi2), a camera sensor (ov5645), and a CRU (Capture Resolution Unit). Here's a breakdown:
Command 1: Reset the Media Pipeline
media-ctl -d /dev/media0 -r
-d /dev/media0: Specifies the media device to configure (here,/dev/media0).-r: Resets all links in the pipeline (disconnects existing routes).
(Useful to start from a clean state before reconfiguring.)
Command 2: Link CSI-2 Output to CRU Input
media-ctl -d /dev/media0 -l "'rzg2l_csi2 16000400.csi20':1 -> 'CRU output':0 [1]"
Breakdown:
-d /dev/media0: Specifies the media device (here,/dev/media0).-l: Creates a link between two pads in the pipeline.'rzg2l_csi2 16000400.csi20':1:rzg2l_csi2 16000400.csi20: The CSI-2 receiver entity (RZ/G2L-specific).:1: Refers to output pad 1 of the CSI-2 receiver.
-> 'CRU output':0:CRU output: The Capture Resolution Unit (CRU) entity.:0: Refers to input pad 0 of the CRU.
[1]: Enables the link ([0]would disable it).
Purpose:
This command routes video data from the CSI-2 receiver's output to the CRU's input for further processing (e.g., scaling, cropping).
Command 3: Set Format on CSI-2 Output Pad
media-ctl -d /dev/media0 -V "'rzg2l_csi2 16000400.csi20':1 [fmt:UYVY8_2X8/1920x1080 field:none]"
Breakdown:
-V: Sets a format (fmt) on a pad.'rzg2l_csi2 16000400.csi20':1: Targets output pad 1 of the CSI-2 receiver.[fmt:UYVY8_2X8/1920x1080 field:none]:UYVY8_2X8: Pixel format (YUV 4:2:2, packed asUYVY).1920x1080: Camera Module resolution.field:none: Progressive video (non-interlaced).
Purpose:
Configures the CSI-2 receiver to output video in YUV422 (UYVY) format at the resolution defined by 1920x1080.
Command 4: Set Format on IMX462 Sensor Output
media-ctl -d /dev/media0 -V "'imx462 0-001f':0 [fmt:UYVY8_2X8/1920x1080 field:none]"
Breakdown:
'imx462 0-001f':0: Targets output pad 0 of the IMX462 camera sensor.[fmt:UYVY8_2X8/1920x1080 field:none]:Same format/resolution as above to ensure compatibility.
Purpose:
Configures the IMX462 sensor to output video in YUV422 (UYVY) at the same resolution as the CSI-2 receiver.
Key Points:
Pipeline Flow:
IMX462 Sensor → CSI-2 Receiver → CRU
The sensor (
imx462) sends data to the CSI-2 receiver (rzg2l_csi2).The CSI-2 receiver forwards it to the CRU (
CRU output).
Format Matching:
Both the sensor and CSI-2 output are set to
UYVY8_2X8with the same resolution.Mismatches will cause pipeline errors (e.g., "EPIPE" in GStreamer).
Resolution (
1920x1080):Defines the camera resolution.
Why
field:none?Indicates progressive video (no interlacing).
rzg2l_csi2 16000400.csi2016000400this is the base register address for the RZV CRURZV2N CRU0 :
16000400CRU1:16010400RZV2H CRU0 :
16000400CRU1:16010400,CRU2:16020400, CRU2:16030400,
Setting the CRU Output
This section explains how to use the CRU Image Processing Block ( Blue ) in the RZV.
A list of the supported CRU formats ( BGR3 ) can be found here.
# Convert media pipe format to RGB24
v4l2-ctl -d /dev/video0 --set-fmt-video=width=1280,height=720,pixelformat=BGR3Terminology
Device Node Differences
/dev/videoX- Video Device NodePurpose: Main interface for video data streaming and user-facing controls
Represents: Either a capture device (camera) or output device (display)
Used for:
Configuring stream formats (pixel format, resolution)
Allocating and managing video buffers
Starting/stopping video streaming
Basic controls (brightness, contrast, etc.)
Users: Applications that actually process video data (e.g.,
ffmpeg,gstreamer, custom apps)
/dev/v4l-subdevX- Sub-device NodePurpose: Interface for hardware component configuration
Represents: Individual hardware blocks in the pipeline (sensors, CSI-2 receivers, scalers, etc.)
Used for:
Configuring subdevice-specific parameters
Setting formats on individual pads
Low-level hardware control
Users: Mainly system integrator, not end-user applications
/dev/mediaX- Media Controller Device NodePurpose: Pipeline topology management
Represents: The entire media device and its internal graph
Used for:
Discovering the hardware pipeline
Creating/enabling/disabling links between components
Querying the connection graph
Users: Pipeline configuration tools and framework initialization
Virtual Channels
Virtual Channel (VC):
Used to multiplex multiple logical data streams over a single physical MIPI CSI-2 lane.
Each data stream (e.g., from different sensors) can be assigned a unique VC identifier (0–3 in standard CSI-2, but extensions allow more).
Helps in distinguishing different data sources when multiple sensors share the same MIPI interface.
Stream Virtual Channel (SVC):
An extension introduced in MIPI CSI-2 v2.0+ to support multiple independent data streams (e.g., from a single sensor that outputs multiple types of data, like RGB + depth).
Allows a single physical sensor to transmit multiple logical streams (e.g., video + metadata) over the same VC by further subdividing it.
Uses Data Type (DT) and Virtual Channel ID (VC-ID) to differentiate streams.