Nvargus_daemon with IMX219 camera

Hi,
I have been struggling a while to make a Raspberry Pi Camera Module V2 IMX219 working with a Jetson NX on a Quark carrier board. The camera is working, but it depends on the behavior of nvargus_daemon. I have put a terminal log to show the weird behavior :
arducam_nvargus.txt (15.1 KB)
Here is all the commands used that sums up this log :

sudo modprobe uvcvideo nodrop=1 timeout=5000
sudo service nvargus-daemon restart
sudo ./main_prog --> doesn't work // launch a gstreamer pipeline to read frames and send them with another pipeline (udpsink)
sudo service nvargus-daemon restart
sudo service nvargus-daemon restart
sudo service nvargus-daemon restart
sudo ./main_prog --> doesn't work
sudo service nvargus-daemon restart
sudo service nvargus-daemon restart
sudo service nvargus-daemon restart
sudo service nvargus-daemon restart
sudo ./main_prog --> doesn't work
sudo service nvargus-daemon restart
sudo ./main_prog  --> doesn't work
sudo service nvargus-daemon restart
sudo ./main_prog  --> work !

It looks dumb but that’s the only way I found to put the camera to work.
When it doesn’t work, I get this error :

tegra194-vi5 15c10000.vi: no reply from camera processor
tegra194-vi5 15c10000.vi: vi capture get status failed

I have Jetpack 4.6 , R32.6.1 .

Here is my Arducam topic that contains way more information about what I have tried.

I saw that

nvargus-daemon is to get hardware DMA buffers from ISP engine and pass the buffers to upper application

Can you provide me a way/advice or guide on how to prevent this ?
Thank you !

Check by v4l2-ctl to confirm the sensor driver.

v4l2-ctl --set-fmt-video=width=1280,height=720 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=500 -d /dev/video0 

Here is some more information :
/var/log/syslog :
syslog (7.2 MB)

Check by v4l2-ctl to confirm the sensor driver.

I was currently doing this command : v4l2-ctl_verbose.txt (7.0 KB)

Looks like the can’t capture any frame from sensor and cause the kernel crash.
Apply below patch to fix the kernel crash. Any if can check with any others imx219 camera module would be good to clarify the cable or HW cause the failure.

Hi ShaneCCC,
Running the command give :

$diff -u a/drivers/media/platform/tegra/camera/vi/capture.c b/drivers/media/platform/tegra/camera/vi/capture.c
diff: a/drivers/media/platform/tegra/camera/vi/capture.c: No such file or directory
diff: b/drivers/media/platform/tegra/camera/vi/capture.c: No such file or directory

I can’t file where these files are.

Should be in …/kernel/nvidia/drivers/media/platform/

Still can’t find it, please see this set of commands when I try to look for it but didn’t succeed. Looking for this file on the development kit give the same result.

loui@localhost:/$ sudo find . -name capture.h

./usr/src/linux-headers-4.9.253-tegra-linux_x86_64/nvidia/include/media/capture.h
./usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/nvidia/include/media/capture.h
./usr/include/dc1394/linux/capture.h
./usr/include/dc1394/capture.h
find: ‘./run/user/120/gvfs’: Permission denied
loui@localhost:/$
loui@localhost:/$ sudo find . -name capture.c
find: ‘./run/user/120/gvfs’: Permission denied
loui@localhost:/$ cd usr/src/
cudnn_samples_v8/ linux-headers-4.9.253-tegra-linux_x86_64/ nvidia/
jetson_multimedia_api/ linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/ tensorrt/
loui@localhost:/$ cd usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/
kernel-4.9/ nvgpu/ nvidia/
loui@localhost:/$ cd usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/kernel-4.9/
arch/ certs/ drivers/ fs/ init/ kernel/ mm/ samples/ security/ tools/ virt/
block/ crypto/ firmware/ include/ ipc/ lib/ net/ scripts/ sound/ usr/
loui@localhost:/$ cd usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/kernel-4.9/kernel/
bpf/ configs/ debug/ events/ gcov/ irq/ livepatch/ locking/ power/ printk/ rcu/ sched/ time/ trace/
loui@localhost:/$ cd usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/kernel-4.9/
arch/ certs/ drivers/ fs/ init/ kernel/ mm/ samples/ security/ tools/ virt/
block/ crypto/ firmware/ include/ ipc/ lib/ net/ scripts/ sound/ usr/
loui@localhost:/$ cd usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/kernel-4.9/drivers/
Display all 129 possibilities? (y or n)
accessibility/ bluetooth/ dax/ firmware/ hwtracing/ isdn/ memstick/ nvdimm/ phy/ rapidio/ sfi/ tc/ video/
acpi/ bus/ dca/ fmc/ i2c/ leds/ message/ nvme/ pinctrl/ ras/ sh/ tee/ virt/
amba/ cdrom/ devfreq/ fpga/ ide/ lguest/ mfd/ nvmem/ platform/ regulator/ sn/ thermal/ virtio/
android/ char/ dio/ gpio/ idle/ lightnvm/ misc/ of/ pnp/ remoteproc/ soc/ thunderbolt/ vlynq/
ata/ clk/ dma/ gpu/ iio/ macintosh/ mmc/ padctrl/ power/ reset/ spi/ tty/ vme/
atm/ clocksource/ dma-buf/ hid/ infiniband/ mailbox/ mtd/ parisc/ powercap/ rpmsg/ spmi/ uio/ w1/
auxdisplay/ connector/ edac/ hsi/ input/ mcb/ net/ parport/ pps/ rtc/ ssb/ usb/ watchdog/
base/ cpufreq/ eisa/ hv/ iommu/ md/ nfc/ pci/ ps3/ s390/ staging/ uwb/ xen/
bcma/ cpuidle/ extcon/ hwmon/ ipack/ media/ ntb/ pcmcia/ ptp/ sbus/ switch/ vfio/ zorro/
block/ crypto/ firewire/ hwspinlock/ irqchip/ memory/ nubus/ perf/ pwm/ scsi/ target/ vhost/
loui@localhost:/$ cd usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/kernel-4.9/drivers/media/
common/ dvb-frontends/ i2c/ pci/ radio/ spi/ usb/
dvb-core/ firewire/ mmc/ platform/ rc/ tuners/ v4l2-core/
loui@localhost:/$ cd usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/kernel-4.9/drivers/media/platform/
am437x/ blackfin/ davinci/ exynos-gsc/ mtk-vcodec/ omap/ rcar-vin/ s5p-g2d/ s5p-mfc/ sti/ vivid/ xilinx/
atmel/ coda/ exynos4-is/ marvell-ccic/ mtk-vpu/ omap3isp/ s3c-camif/ s5p-jpeg/ soc_camera/ ti-vpe/ vsp1/
loui@localhost:/$ cd usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/kernel-4.9/drivers/media/platform/

It’s in the kernel source isn’t in the NX device.
Have follow below document to download the source code that must have it.

https://docs.nvidia.com/jetson/l4t/Tegra%20Linux%20Driver%20Package%20Development%20Guide/kernel_custom.html#

Hi ShaneCCC,
Thank you for your reply,
So i need to download the kernel source on my host PC under the Linux_for_Tegra folder ?
My ~/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_XAVIER_NX_TARGETS/ folder is empty since I deleted all of it’s content because SDKmanager always add issue installing Jetpack SDK components on target device.

If it is on the target device : installing kernel and external kernel sources won’t damage my NX because it has a specific BSP ?

For the kernel source code building you can put it any where.

Sorry but I don’t understand, let me try to clarify this :
I need to download kernel source ( and external kernel module ? ) on my host PC → What will this improve on the target device ?
Re reading this topic, he didn’t say that he downloaded the kernel sources and I have the same error message as him.
If kernel sources is needed, why isn’t it natively included ?

You need apply the patch and build the Image to replace the file at /boot/Image(NX)

I have never modified the kernel so I’m lost here.
Here are the steps that I need to do (correct me if i’m wrong) :

  • On the NX, download kernel sources while following this section : Obtaining the Kernel Sources with Git (can’t find the file ./source_sync.sh) or Manually Downloading and Expanding Kernel Sources
  • Follow this section Building the NVIDIA Kernel while skipping step 2.
  1. Will that erase the actual image on the NX ?
  2. Will it work even if it’s a specific BSP : kernel_tegra194-xavier-nx-cti-NGX004-RPI-IMX219-2CAM.dtb ?

If you download correct kernel version the replace the /boot/Image only change the kernel.

I followed the guide that you provided me and build the Linux Kernel on the NX (Which I think it has to be on the host PC), the last step I did was :

$ cd <kernel_source>
$ mkdir -p $TEGRA_KERNEL_OUT
$ make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig
$ make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j

But now I have to do :

  1. Replace <release_packagep>/Linux_for_Tegra/kernel/Image with a copy of:
    $TEGRA_KERNEL_OUT/arch/arm64/boot/Image

And I as mentioned previously, I have deleted my Linux_for_tegra folder on my host PC.
So I can’t continue following this guide.

But,

If you download correct kernel version the replace the /boot/Image only change the kernel.

Will this work if :
(On the NX) I just put the content of $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/ in /boot/ and then replace the image in /boot/Image with $TEGRA_KERNEL_OUT/arch/arm64/boot/Image.

You can apply the kernel by copy the Image to Xavier NX at /boot/

sudo mv Linux_for_Tegra/Tegra_kernel_out_folder/arch/arm64/boot/Image /boot/Image

Should do the job ? Just want to be sure that I don’t destroy my Quark + NX setup

You need below environment value before build the kernel Image.
And copy the Image by scp or any other way and replace the /boot/Image with that.

export LOCALVERSION=-tegra

I’m building everything from my Quark + NX, can you confirm that the commands are :

$ export LOCALVERSION=-tegra
$ make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig
$ make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j4
$ sudo mv Linux_for_Tegra/Tegra_kernel_out_folder/arch/arm64/boot/Image /boot/Image

I don’t know what’s Quark. But if the file Linux_for_Tegra/Tegra_kernel_out_folder/arch/arm64/boot/Image is in NX file system then Yes