Orin NX 8GB dual camera imx477 - only one works

Hi,
Only one camera is working - the same setup with Orin NX 16GB works fine

Setup:
OrinNX 8GB JP5.1.1 R35.3.1
Two Ardocam imx477 CSI cameras
Seeed J401 carrier

jetson-io confined for Camera IMX477 Dual

sudo dmesg | grep imx
[   12.289974] imx477 9-001a: tegracam sensor driver:imx477_v2.0.6
[   12.592247] tegra-camrtc-capture-vi tegra-capture-vi: subdev imx477 9-001a bound
[   12.594469] imx477 10-001a: tegracam sensor driver:imx477_v2.0.6
[   12.896056] tegra-camrtc-capture-vi tegra-capture-vi: subdev imx477 10-001a bound

sensor-id=1 always working

gst-launch-1.0 nvarguscamerasrc sensor-id=1 ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)60/1' ! queue ! nvvidconv ! nvegltransform ! nveglglessink
Setting pipeline to PAUSED ...

Using winsys: x11
Pipeline is live and does not need PREROLL ...
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3840 x 2160 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 1
   Camera mode  = 1
   Output Stream W = 1920 H = 1080
   seconds to Run    = 0
   Frame Rate = 59.999999
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:08.207550427
Setting pipeline to NULL ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Freeing pipeline ...

sensor-id=0 not working - even when switching csi ports always id=0 not working

gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)60/1' ! queue ! nvvidconv ! nvegltransform ! nveglglessink
Setting pipeline to PAUSED ...

Using winsys: x11
Pipeline is live and does not need PREROLL ...
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3840 x 2160 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0
   Camera mode  = 1
   Output Stream W = 1920 H = 1080
   seconds to Run    = 0
   Frame Rate = 59.999999
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
nvbuf_utils: dmabuf_fd -1 mapped entry NOT found
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadExecute:694 NvBufSurfaceFromFd Failed.
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadFunction:247 (propagating)
Got EOS from element "pipeline0".
Execution ended after 0:00:04.058294804
Setting pipeline to NULL ...
GST_ARGUS: Cleaning up

Any idea why?
Thanks

hello yaniv.nahum,

had you update the device tree?
for Orin NX, it’s CSI0 D1 and CSI1 D0 P/N will always been swizzled for P/N.

I just flashed with the sdkmanager and configured the jetson-io for Camera IMX477 Dual

Please explain the:

CSI0 D1 and CSI1 D0 P/N will always been swizzled for P/N

and how do I do that?
Thanks,
Yaniv

hello yaniv.nahum,

it’s default support with Rbpcv3-imx477, by using Jetson-IO it choose the imx477*.dtbo to update device tree properties.

hence,
please examine device tree settings since it looks you’re using customize board instead of developer kits.
there’s also device tree property, lane_polarity to configure a polarity swap,
you may see-also below for descriptions.

                                * lane_polarity
                                * Based on the camera connector pin.
                                * CSIx_D0 | CSIx_D1 | CSI(X+1)_D0 | CSI(X+1)CSIx_D1
                                *    LSB  |   BIT1  |     BIT2    |      MSB
                                * if there is a polarity swap on any lane, the bit corrsponding
                                * to the lane should be set
                                * e.g. polarity swap on CSIx_D0 only -> lane_polarity = "1"; 0001
                                * e.g. polarity swap on CSIx_D1 and CSI(X+1)_D0 -> lane_polarity = "6"; 0110

Hi @JerryChang ,
The lane_polarity of the CSI that work is 0.
For the other CSI port, I tried 0,1,6 and still same results.
Are there any other settings in the device tree I should look into?
Thanks

you should check whether there’s polarity swap, for Orin NX, it’s CSI0 D1 and CSI1 D0 P/N will always been swizzled for P/N.

I think I tried all options for lane_polarity with no success.

Here is the dump file of the device tree for the OrinNX16GB which both cameras work fine.
kernel_tegra234-p3767-0000-p3509-a02-user-custom.dtb.NX16GB.txt (639.0 KB)

And this is the device tree of the OrinNX8GB same carrier board and same cameras (just switching SSD and Jetson SOM). only the camera connected to CSI “video1” is working.
kernel_tegra234-p3767-0001-p3768-0000-a0-user-custom.dtb.NX8GB.txt (645.2 KB)

also the carrier CSI ports:


(CSI J12 is the one not working:

Maybe you can find the issue here. I have no clue.
Thanks!

hello yaniv.nahum,

may I know how you enable dual IMX477, are you running Jetson-IO to apply device tree overlays?
BTW,
were those imx477 working on 2-lane, or 4-lane configurations?
you may also refer to tegra234-p3768-0000-a0.dtsi, 1st camera sensor now streams on CSI-B instead of CSI-A.

Hi @JerryChang ,
I used the Jetson-IO to enable dual IMX477 (2-lane - so as the cameras).
Then I changed it with different lane_polarity by decompiling
sudo dtc -I dtb -O dts -o output.dts ...
editing then compiling again:
sudo dtc -I dts -O dtb -o ...
and replacing the …user-custom.dtb
Is this the way to do it?

you may also refer to tegra234-p3768-0000-a0.dtsi , 1st camera sensor now streams on CSI-B instead of CSI-A."

Looking at the device tree of the 8GB it looks correctly configured to CSI-B:
kernel_tegra234-p3767-0001-p3768-0000-a0-user-custom.dtb.NX8GB.txt (645.2 KB)

what else can I check?
Thanks

you may refer to Applications Using V4L2 IOCTL Directly,
please have a try by using V4L2 IOCTL to verify basic camera functionality.

Solved!
It was indeed the tegra_sinterface = "serial_b"; instead of serial_a
and I had to change the corresponding port-index from 1 to 0.
Thanks @JerryChang