Suddenly can't open IMX519

My goal is to use IMX519 for Computer Vision. However, suddenly the camera can’t be opened. Only a reboot fix the problem. However, I want to fix this issue without rebooting.

UPDATE: The problem is that when there is a crash, camera.close() is not invoked. Is there a way to fix this?

The code: GitHub - ArduCAM/Jetson_IMX519_Focus_Example


[email protected]:~/Jetson_IMX519_Focus_Example$ python3 -i 8
nvbuf_utils: Could not get EGL display connection
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:751 Failed to create CaptureSession
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
Error: Write failed
Error: Write failed
Error: Write failed
Traceback (most recent call last):
  File "", line 44, in <module>
    cv2.imshow("Test", frame)
cv2.error: OpenCV(4.1.1) /home/nvidia/host/build_opencv/nv_opencv/modules/highgui/src/window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'

terminate called without an active exception
Aborted (core dumped)

dmesg | grep -E “imx519”

    0.212512] DTS File Name: /var/jenkins_home/workspace/rnel_l4t-32.7.1-imx519-low-speed/kernel/kernel-4.9/arch/arm64/boot/dts/../../../../../../hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts
[    0.420753] DTS File Name: /var/jenkins_home/workspace/rnel_l4t-32.7.1-imx519-low-speed/kernel/kernel-4.9/arch/arm64/boot/dts/../../../../../../hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts
[    1.337198] imx519 7-001a: tegracam sensor driver:imx519_v2.0.6
[    1.637565] imx519 7-001a: imx519_board_setup: error during i2c read probe (-121)
[    1.645160] imx519 7-001a: board setup failed
[    1.649823] imx519: probe of 7-001a failed with error -121
[    1.650218] imx519 8-001a: tegracam sensor driver:imx519_v2.0.6
[    2.097804] vi subdev imx519 8-001a bound