Camera Status
Camera Status
MIPI CSI camera sensor functionality is essential on Jetson platforms, as many applications, such as media servers, depend on it. Here, a GStreamer pipeline is used to capture a 2592x1944@30fps video stream from the OV5693 MIPI CSI camera, which is the camera sensor driver supported out of the box by JetPack 5 and 2592x1944@30fps is the highest resolution the driver provides.
OV5693 Integration
1. Enable the driver using the jetson-io tools. First, check the available headers, as shown below:
sudo /opt/nvidia/jetson-io/config-by-hardware.py -l Header 1 [default]: Jetson 40pin Header Available hardware modules: 1. Adafruit SPH0645LM4H 2. Adafruit UDA1334A 3. FE-PI Audio V1 and Z V2 4. ReSpeaker 4 Mic Array 5. ReSpeaker 4 Mic Linear Array Header 2: Jetson AGX CSI Connector Available hardware modules: 1. Camera Dual IMX274 2. Camera IMX274 3. Jetson Camera Dual-IMX274 4. Jetson Camera E3326 module 5. Jetson Camera E3331 module 6. Jetson Camera E3333 module 7. Jetson Camera HDMI CSI Bridge 8. Jetson Camera IMX185 9. Jetson Camera IMX390 10. Jetson ECON YUV Camera module Header 3: Jetson M.2 Key E Slot No hardware configurations found!
2. Select the Header 2: Jetson AGX CSI Connector 4. Jetson Camera E3326 module:
sudo /opt/nvidia/jetson-io/config-by-hardware.py -n 2="Jetson Camera E3326 module" Configuration saved to /boot/kernel_tegra194-p2888-0001-p2822-0000-user-custom.dtb. Reboot system to reconfigure.
3. Restore the /boot/extlinux/extlinux.conf to avoid confusion:
cd /boot/extlinux/ sudo mv extlinux.conf.jetson-io-backup extlinux.conf
4. Change the FDT path in the cip label to:
FDT /boot/kernel_tegra194-p2888-0001-p2822-0000-user-custom.dtb
and reboot.
Test capture
1. Install the v4l-utils dependency:
sudo apt install v4l-utils
2. Check the formats available:
v4l2-ctl -d /dev/video0 --list-formats-ext ioctl: VIDIOC_ENUM_FMT Type: Video Capture [0]: 'BG10' (10-bit Bayer BGBG/GRGR) Size: Discrete 2592x1944 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 2592x1458 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 1280x720 Interval: Discrete 0.008s (120.000 fps)
3. Test capture with v4l2-ctl:
v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=BG10 --set-ctrl bypass_mode=0 --stream-mmap <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.00 fps
4. Install perf plugin to check the GStreamer pipeline FPS. Follow gst-perf README.md instructions.
5. Test capture with GStreamer:
gst-launch-1.0 nvarguscamerasrc sensor-mode=0 ! 'video/x-raw(memory:NVMM),width=2592,height=1944,format=NV12,framerate=30/1' ! nvvidconv ! perf ! queue! xvimagesink
expected output:
Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock GST_ARGUS: Creating output stream CONSUMER: Waiting until producer is connected... GST_ARGUS: Available Sensor modes : GST_ARGUS: 2592 x 1944 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 1,000000, max 16,000000; Exposure Range min 34000, max 550385000; GST_ARGUS: 2592 x 1458 FR = 29,999999 fps Duration = 33333334 ; Analog Gain range min 1,000000, max 16,000000; Exposure Range min 34000, max 550385000; GST_ARGUS: 1280 x 720 FR = 120,000005 fps Duration = 8333333 ; Analog Gain range min 1,000000, max 16,000000; Exposure Range min 22000, max 358733000; GST_ARGUS: Running with following settings: Camera index = 0 Camera mode = 0 Output Stream W = 2592 H = 1944 seconds to Run = 0 Frame Rate = 29,999999 GST_ARGUS: Setup Complete, Starting captures for 0 seconds GST_ARGUS: Starting repeat capture requests. CONSUMER: Producer has connected; continuing. INFO: perf: perf0; timestamp: 1:31:57.177228974; bps: 0,000; mean_bps: 0,000; fps: 0,000; mean_fps: 0,000 INFO: perf: perf0; timestamp: 1:31:58.201679361; bps: 1128701952,000; mean_bps: 0,000; fps: 28,308; mean_fps: 28,308 INFO: perf: perf0; timestamp: 1:31:59.203569847; bps: 2418647040,000; mean_bps: 2418647040,000; fps: 29,943; mean_fps: 29,126 INFO: perf: perf0; timestamp: 1:32:00.235727532; bps: 2418647040,000; mean_bps: 2418647040,000; fps: 30,034; mean_fps: 29,428 INFO:
Troubleshooting
If the OV5693 driver fails probing with the following error messages:
[ 12.987508] ov5693 2-0036: probing v4l2 sensor. [ 12.988609] ov5693 2-0036: tegracam sensor driver:ov5693_v2.0.6 [ 13.020896] ov5693 2-0036: Error -121 reading eeprom [ 13.023451] ov5693 2-0036: board setup failed [ 13.024098] ov5693: probe of 2-0036 failed with error -121
Apply the following patch to the kernel/nvidia/drivers/media/i2c/nv_ov5693.c file to bypass the EEPROM:
diff --git a/kernel/nvidia/drivers/media/i2c/nv_ov5693.c b/kernel/nvidia/drivers/media/i2c/nv_ov5693.c
index 3b6797a..8b9e976 100644
--- a/kernel/nvidia/drivers/media/i2c/nv_ov5693.c
+++ b/kernel/nvidia/drivers/media/i2c/nv_ov5693.c
@@ -690,21 +690,6 @@ static int ov5693_eeprom_device_init(struct ov5693 *priv)
return 0;
}
-static int ov5693_read_eeprom(struct ov5693 *priv)
-{
- int err, i;
-
- for (i = 0; i < OV5693_EEPROM_NUM_BLOCKS; i++) {
- err = regmap_bulk_read(priv->eeprom[i].regmap, 0,
- &priv->eeprom_buf[i * OV5693_EEPROM_BLOCK_SIZE],
- OV5693_EEPROM_BLOCK_SIZE);
- if (err)
- return err;
- }
-
- return 0;
-}
-
static int ov5693_read_otp_bank(struct ov5693 *priv,
u8 *buf, int bank, u16 addr, int size)
{
@@ -1114,15 +1099,6 @@ static int ov5693_board_setup(struct ov5693 *priv)
return err;
}
- if (eeprom_ctrl) {
- err = ov5693_read_eeprom(priv);
- if (err) {
- dev_err(dev,
- "Error %d reading eeprom\n", err);
- goto error;
- }
- }
-
err = ov5693_otp_setup(priv);
if (err) {
dev_err(dev,
Then, build the modules. Check the Build the code instructions.