Help with Debugging Camera Driver and Argus API

I am developing on a Jetson Orin NX (L4T 36.4.3) and writing a camera driver for InnoMaker OV7251 Mipi camera, which is a one-lane, black&white, bayer sensor without on-board ISP unit.

So far, I’ve got it working with v4l2-ctl (see my previous post here). I can grab the raw frames (RG10) and use software to debayer the image. However, I am not able to use the camera with argus (which is, nvarguscamerasrc). Here is the full trace report from nvargus-daemon and a short snippet on the major errors:

nvargus_full_report.log (27.5 KB)

SCF: Error InvalidState: Timeout!! Skipping requests on sensor GUID 1, capture sequence ID = 281470681743360 draining session frameStart events 281470681743363
(in src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameStart(), line 529)

SCF: Error InvalidState: Sensor GUID 1 is in error state. Skipping requests, capture sequence ID = 281470681743361 continue draining session frameStart events 281470681743362 (in src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameStart(), line 543)

SCF: Error InvalidState: Sensor GUID 1 is in error state. Skipping requests, capture sequence ID = 281470681743362 continue draining session frameStart events 281470681743361 (in src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameStart(), line 543)

SCF: Error InvalidState: Sensor 1 already in same state (in src/services/capture/CaptureServiceDeviceSensor.cpp, function setErrorState(), line 100)

FiberScheduler: cc 101, session 1, fiber 0xffff70000b70 aborted in async operation

I don’t really have a clue about how to debug this error. Appreciate any help here in advance. Below is the device tree overlay I am currently using.

ov7251_dts.txt (5.3 KB)

Hello,

Thanks for visiting the NVIDIA Developer Forums.
To ensure better visibility and support, I’ve moved your post to the Jetson category where it’s more appropriate

Cheers,
Tom

Thanks Tom, for relocating the post.

I just found that the link to the full trace report is a 404, thus am re-uploading it here.

nvargus.log (27.5 KB)

Also, below is the argus test command I am using, which gives me the errors.

gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! “video/x-raw(memory:NVMM),width=640,height=480,framerate=158/1” ! nvvidconv ! fakesink

The following commands utilizing v4l2 api work just fine.

gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 cap-buffers=2 ! “video/x-raw(memory:NVMM), width=(int)640, height=(int)480, framerate=(fraction)158/1” ! nvvidconv ! “video/x-raw(memory:NVMM),format=NV12” ! nveglglessink sync=false

v4l2-ctl --device=/dev/video0 --set-fmt-video=width=640,height=480,pixelformat=RG10 --stream-mmap --stream-to=- | ffplay -f rawvideo -pixel_format bayer_rggb16le -video_size 640x480 -framerate 158 -vf “format=gray,lut=y=‘val*30’” -

hello nenosun2017,

let me double check the sensor pixel formats you’ve used in the device tree.
you may see-also developer guide, Property-Value Pairs for the mode_type, csi_pixel_bit_depth and pixel_phase.
besides.. you should dig into sensor mode settings, especially Sensor Pixel Clock, which must be set correctly to avoid potential issues.

Hi Jerry, many thanks! I will check more on the sensor mode settings.

According to the camera’s documentation, the output signal is Bayer RAW10 black and white signal. In the device tree, I set set the mode_type to bayer. The pixel_phase is set to rggb since there is no b&w or gray option. And he csi_pixel_bit_depth is set to 10.

Note that the sensor by default outputs RAW8 B&W signal, but in the driver (see the .c code below), I set it to output RAW10, because Jetson ISP seems to not support RAW8.

ov7251_c.txt (21.8 KB)

As for the sensor pixel clock, I am actually quite confused. Now the pixel clock I set is 69770272, which is calculated by hts (772) * vts (572) * fps (158). But when looking at the official driver code for Raspberry Pi, I the pixel clock is calculated as hts (772) * vts (572) * fps (120) = 52990080. However, I tried both settings, none worked.

Oh, by the way, some properties in the device tree are actually not used, for example mclk, reset-gpios, avdd-reg, etc.. The reset, clock and regulators are already handled by the camera board. As per the camera’s CSI connection schematic, only SCL/SDA, VDD, GND, CSI1_CLK_N/P, and CSI1_N/P lanes are used.

hello nenosun2017,

please based-on reference driver for development, some of properties were mandatory for libargus.
$public_sources/kernel_src/hardware/nvidia/t23x/nv-public/overlay/tegra234-camera-rbpcv2-imx219.dtsi

Yes. I confirm that I have those properties, apart from “embedded_metadata_*“ and “mclk_multiplier“.

hello nenosun2017,

this is also needed, please configure to embedded_metadata_height = "0"; if your sensor did not output embedded metadata lines.

Thanks for the advice. I added the field and tried with different values (0, 1, and 2). Neither worked.

Nevertheless, I figured out the pixel_clk by reading the following registers on the camera chip.

[ 9.506660] my_cam_driver 9-0060: ov7251_board_setup: PLL1_PRE_DIV_REG=3
[ 9.506851] my_cam_driver 9-0060: ov7251_board_setup: PLL1_MULT_REG=100
[ 9.507036] my_cam_driver 9-0060: ov7251_board_setup: PLL1_DIVIDER_REG=1
[ 9.507220] my_cam_driver 9-0060: ov7251_board_setup: PLL1_PIX_DIV_REG=10

And this gives a pixel_clk of 80MHz (24MHz / 3 * 100 / 1 / 10).

Also, I corrected the fields of active_w, active_h, and line_length according to the sensor documentation (instead of camera’s documentation).

However, despite the above efforts, I am still hitting the same errors.

Here is the revised dts file:

ov7251_dts_revised.txt (5.9 KB)

Problem fixed.

The core issue was the discontinuous_clk field. It should be set to no.