IMX477 camera driver

I followed the instructions from ridgerun for building and installing the imx477 camera driver and modified my device tree. I am able to get it to work when I load the driver as a module using insmod after booting (not compiled into the kernel). But when I compile the module into the kernel it doesn’t work. It recognizes the camera and loads the driver, but I get a “no cameras found” error when running nvgstcapture.

Any ideas on how to troubleshoot this?

Collect the log from below instructions.

sudo su
kill the process of nvargus-daemon
export enableCamPclLogs=5
export enableCamScfLogs=5

/usr/sbin/nvargus-daemon
lanuch camera APP from another console

All of the following is when I am using a kernel image with the driver compiled in.

monomer@auvidea:~$ dmesg | grep imx
[    2.172114] imx477 0-001a: tegracam sensor driver:imx477_v2.0.6
[    2.195480] imx477 0-001a: imx477_board_setup: error during i2c read probe (-121)
[    2.203122] imx477 0-001a: board setup failed
[    2.207581] imx477: probe of 0-001a failed with error -121
[    2.207963] imx477 6-001a: tegracam sensor driver:imx477_v2.0.6
[    2.461115] vi 54080000.vi: subdev imx477 6-001a bound
root@auvidea:~$ /usr/sbin/nvargus-daemon
=== NVIDIA Libargus Camera Service (0.97.3)=== Listening for connections...=== nvgstcapture[16283]: Connection established (7F8BBB01D0)Thread 1 getting next capture
Thread 1 is waiting
Thread 2 getting next capture
Thread 2 is waiting
Thread 3 getting next capture
Thread 3 is waiting
Thread 4 getting next capture
Thread 4 is waiting
Thread 5 getting next capture
Thread 5 is waiting
Thread 6 getting next capture
Thread 6 is waiting
Thread 7 getting next capture
Thread 7 is waiting
Thread 8 getting next capture
Thread 8 is waiting
Thread 9 getting next capture
Thread 9 is waiting
Thread 10 getting next capture
Thread 10 is waiting
Thread 11 getting next capture
Thread 11 is waiting
Thread 12 getting next capture
Thread 12 is waiting
Starting services...
Worker thread IspHw statsComplete start
Worker thread IspHw frameComplete start
Worker thread IspHw statsComplete start
Worker thread IspHw frameComplete start
Worker thread CaptureScheduler checkFramePending start
Worker thread CaptureScheduler frameStart start
Worker thread V4L2CaptureScheduler checkCaptureComplete start
Worker thread V4L2CaptureScheduler issueCaptures start
SCF: Error NotSupported: EGL_EXT_client_extensions not supported (in src/services/gl/GLService.cpp, function initialize(), line 110)
SCF: Error NotSupported:  (propagating from src/services/gl/GLService.cpp, function startService(), line 46)
SCF: Error NotSupported:  (propagating from src/components/ServiceHost.cpp, function startServices(), line 138)
Stopping services...
Worker thread CaptureScheduler frameStart stop
Worker thread CaptureScheduler checkFramePending stop
Worker thread IspHw statsComplete stop
Worker thread IspHw frameComplete stop
Worker thread IspHw statsComplete stop
Worker thread IspHw frameComplete stop
Worker thread V4L2CaptureScheduler issueCaptures stop
Worker thread V4L2CaptureScheduler checkCaptureComplete stop
NvPclShutdown: ++++++++++++++++++++++
NvPclShutdown: ----------------------
SCF: Error InvalidState: Service not running (in src/services/gl/GLService.cpp, function stopService(), line 55)
SCF: Error InvalidState:  (propagating from src/components/ServiceHost.cpp, function stopServicesInternal(), line 203)
Services are stopped
SCF: Error NotSupported:  (propagating from src/api/CameraDriver.cpp, function initialize(), line 168)
SCF: Error InvalidState: Services are already stopped (in src/components/ServiceHost.cpp, function stopServicesInternal(), line 188)
FiberScheduler: shutting down; 0 fibers still in map

FiberScheduler: thread 2 exiting
FiberScheduler: thread 5 exiting
FiberScheduler: thread 4 exiting
FiberScheduler: thread 6 exiting
FiberScheduler: thread 9 exiting
FiberScheduler: thread 10 exiting
FiberScheduler: thread 3 exiting
FiberScheduler: thread 7 exiting
FiberScheduler: thread 11 exiting
FiberScheduler: thread 8 exiting
FiberScheduler: thread 12 exiting
FiberScheduler: thread 12 has been joined
FiberScheduler: thread 11 has been joined
FiberScheduler: thread 10 has been joined
FiberScheduler: thread 8 has been joined
FiberScheduler: thread 7 has been joined
FiberScheduler: thread 6 has been joined
FiberScheduler: thread 9 has been joined
FiberScheduler: thread 4 has been joined
FiberScheduler: thread 5 has been joined
FiberScheduler: thread 3 has been joined
FiberScheduler: thread 2 has been joined
FiberScheduler: thread 1 exiting
FiberScheduler: thread 1 has been joined
monomer@auvidea:~$ nvgstcapture
...
** Message: 07:34:50.680: <main:4670> iterating capture loop ....
(Argus) Error FileOperationFailed: Connecting to nvargus-daemon failed: Connection refused (in src/rpc/socket/client/SocketClientDispatch.cpp, function openSocketConnection(), line 201)
(Argus) Error FileOperationFailed: Cannot create camera provider (in src/rpc/socket/client/SocketClientDispatch.cpp, function createCameraProvider(), line 102)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:551 Failed to create CameraProvider
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
...

Again, everything works fine when I use a kernel without the driver compiled in, but rather load it as a LKM with sudo insmod /lib/modules/4.9.140-tegra/kernel/drivers/media/i2c/imx477.ko (I compiled that separately and put it in that folder).

I was able to fix the issue with ln -s /lib/modules/4.9.140-tegra /lib/modules/4.9.140. I was originally using the kernel image binary supplied by Auvidea for their carrier board, something must be mixed up witht eh kernel versions.