Debugging issues related to the device tree and driver for the IMX219 camera

Hello, I am currently learning how to write camera drivers and device tree files. I am trying to use the Orin NX to support two IMX219 cameras. To do this, I created a custom device tree file named imx219-2.dts, modeled after the IMX219 device tree provided for the Orin NX, and loaded it into the main device tree via jetson-io.

For the driver file, I used nv_imx219.c from the Driver Package (BSP) Sources, and I compiled it into a .ko file through a Makefile and loaded it into the kernel. I have attached the files I used in the appendix.
imx219-2(driver file).txt (19.3 KB)
imx219-2(dts).txt (22.1 KB)
Makefile.txt (237 Bytes)

I am currently facing an issue where the v4l2-ctl command shows that the camera can be recognized, but I cannot open the camera with any command. (By the way, our team previously used video-viewer to access camera images). I have used the dmesg command but am unsure where the problem lies. If it is a device tree issue, how should I go about troubleshooting it?

How do you build the nv_imx219.ko? Did you check the original nv_imx219.ko in system. (/lib/modules/5.10.192-tegra/kernel/drivers/media/i2c/nv_imx219.ko)

I am using a method left by a senior team member. In the directory /home/nx8/ImxBSP/Linux_for_Tegra/source/public/kernel/nvidia/drivers/media/i2c/, I created a folder and placed the imx219-2.c, imx219_mode_tbls.h, and Makefile files within it. By executing the make command, I was able to obtain the imx219-2.ko file. I then copied imx219-2.ko to the /lib/modules/5.10.192-tegra/kernel/drivers/media/i2c/ directory, executed the sudo depmod command, and restarted the system to load the driver onto the Orin NX. (Of course, to prevent driver conflicts, I temporarily moved the original nv_imx219.ko file to another folder as a backup.)


As for the original nv_imx219.ko you mentioned, I have used it before, but the same issue occurs: v4l2-ctl can detect the device, but the camera image cannot be retrieved. I also didn’t see any obvious information in dmesg.

nx8@nx8:~$ video-viewer csi://0
[gstreamer] initialized gstreamer, version 1.16.3.0
[gstreamer] gstCamera -- attempting to create device csi://0
[gstreamer] gstCamera pipeline string:
[gstreamer] nvarguscamerasrc sensor-id=0 ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, framerate=30/1, format=(string)NV12 ! nvvidconv flip-method=2 ! video/x-raw ! appsink name=mysink
[gstreamer] gstCamera successfully created device csi://0
[video]  created gstCamera from csi://0
------------------------------------------------
gstCamera video options:
------------------------------------------------
  -- URI: csi://0
     - protocol:  csi
     - location:  0
  -- deviceType: csi
  -- ioType:     input
  -- width:      1280
  -- height:     720
  -- frameRate:  30
  -- numBuffers: 4
  -- zeroCopy:   true
  -- flipMethod: rotate-180
------------------------------------------------
[OpenGL] glDisplay -- X screen 0 resolution:  1920x1080
[OpenGL] glDisplay -- X window resolution:    1920x1080
[OpenGL] glDisplay -- display device initialized (1920x1080)
[video]  created glDisplay from display://0
------------------------------------------------
glDisplay video options:
------------------------------------------------
  -- URI: display://0
     - protocol:  display
     - location:  0
  -- deviceType: display
  -- ioType:     output
  -- width:      1920
  -- height:     1080
  -- frameRate:  0
  -- numBuffers: 4
  -- zeroCopy:   true
------------------------------------------------
[gstreamer] opening gstCamera for streaming, transitioning pipeline to GST_STATE_PLAYING
[gstreamer] gstreamer changed state from NULL to READY ==> mysink
[gstreamer] gstreamer changed state from NULL to READY ==> capsfilter1
[gstreamer] gstreamer changed state from NULL to READY ==> nvvconv0
[gstreamer] gstreamer changed state from NULL to READY ==> capsfilter0
[gstreamer] gstreamer changed state from NULL to READY ==> nvarguscamerasrc0
[gstreamer] gstreamer changed state from NULL to READY ==> pipeline0
[gstreamer] gstreamer changed state from READY to PAUSED ==> capsfilter1
[gstreamer] gstreamer changed state from READY to PAUSED ==> nvvconv0
[gstreamer] gstreamer changed state from READY to PAUSED ==> capsfilter0
[gstreamer] gstreamer stream status CREATE ==> src
[gstreamer] gstreamer changed state from READY to PAUSED ==> nvarguscamerasrc0
[gstreamer] gstreamer changed state from READY to PAUSED ==> pipeline0
[gstreamer] gstreamer stream status ENTER ==> src
[gstreamer] gstreamer message new-clock ==> pipeline0
[gstreamer] gstreamer changed state from PAUSED to PLAYING ==> capsfilter1
[gstreamer] gstreamer changed state from PAUSED to PLAYING ==> nvvconv0
[gstreamer] gstreamer changed state from PAUSED to PLAYING ==> capsfilter0
[gstreamer] gstreamer changed state from PAUSED to PLAYING ==> nvarguscamerasrc0
[gstreamer] gstreamer message stream-start ==> pipeline0
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:751 No cameras available
[gstreamer] gstCamera -- end of stream (EOS)
[gstreamer] gstreamer changed state from READY to PAUSED ==> mysink
[gstreamer] gstreamer message async-done ==> pipeline0
[gstreamer] gstreamer message warning ==> mysink
[gstreamer] gstreamer changed state from PAUSED to PLAYING ==> mysink
[gstreamer] gstreamer changed state from PAUSED to PLAYING ==> pipeline0
[gstreamer] gstreamer pipeline0 recieved EOS signal...
[gstreamer] gstCamera::Capture() -- a timeout occurred waiting for the next image buffer
^Creceived SIGINT
[gstreamer] gstCamera::Capture() -- a timeout occurred waiting for the next image buffer
video-viewer:  shutting down...
[gstreamer] gstCamera -- stopping pipeline, transitioning to GST_STATE_NULL
[gstreamer] gstCamera -- pipeline stopped
video-viewer:  shutdown complete

It’s customized camera board? At least the original nv_imx219 don’t show the verification failed.

Please verify the sensor HW/driver by v4l2-ctl and get the trace log if failed.

Our Orin NX carrier board is modified based on NVIDIA’s reference board, but the IMX219 camera board should be universal and is the model that is typically used with the Nano. So, how should I use v4l2-ctl to verify the sensor hardware/driver? I lack knowledge in this area and am unsure how to troubleshoot and identify the issue. When tracking logs, does this refer to information in kern.log?

Have reference to below link for debug.

https://elinux.org/Jetson/l4t/Camera_BringUp

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.