Multi Virtual Channel Implementation in a CSI port using Xavier NX

Hi JerryChang,
Thanks for your support. Finally we able to receive 2 channel parallely using imx390 sensor. The issue in resolution and default image height macro. Thank you so much Jerry.
After receiving 4 channel packet I will update you.

Thanks for your time.

Hi JerryChang,
I have enabled 4 virtual channels and driver also successfully loaded. but sub dev and /dev/video2 and /dev/video3 is not registered. I have attached my dmesg log.

[ 0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
[ 0.429603] DTS File Name: …/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t19x/jakku/kernel-dts/tegra194-p3668-all-p3509-0000.dts
[ 0.700706] DTS File Name: …/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t19x/jakku/kernel-dts/tegra194-p3668-all-p3509-0000.dts
[ 0.719456] iommu: Adding device 3180000.i2c to group 12
[ 0.788194] vdd-sdmmc1-sw: 3300 mV
[ 1.457135] t194-nvcsi 15a00000.nvcsi: initialized
[ 2.118946] tegra194_cpufreq_probe: platform driver Initialization: pass
[ 2.146144] misc nvmap: cvsram :dma coherent mem declare 0x0000000050000000,4194304
[ 2.993281] tegra194-isp5 14800000.isp: initialized
[ 2.999694] tegra194-vi5 15c10000.vi: using default number of vi channels, 36
[ 3.006886] tegra194-vi5 15c10000.vi: initialized
[ 3.010860] tegra194-vi5 15c10000.vi: subdev 15a00000.nvcsi–2 bound
[ 3.010929] tegra194-vi5 15c10000.vi: subdev 15a00000.nvcsi–1 bound
[ 5.429971] tegra194-vi5 15c10000.vi: subdev imx390 30-001b bound
[ 5.431616] tegra194-vi5 15c10000.vi: subdev imx390 30-001c bound
[ 0.573907] CPU4: Booted secondary processor [4e0f0040]
[ 5.429320] imx390 30-001b: probing v4l2 sensor.
[ 5.429919] imx390 30-001b: tegracam sensor driver:imx390_v2.0.6
[ 5.429971] tegra194-vi5 15c10000.vi: subdev imx390 30-001b bound
[ 5.431118] imx390 30-001b: Detected IMX390 sensor
[ 5.431185] imx390 30-001c: probing v4l2 sensor.
[ 5.431366] imx390 30-001c: couldn’t create debugfs
[ 5.431579] imx390 30-001c: tegracam sensor driver:imx390_v2.0.6
[ 5.431616] tegra194-vi5 15c10000.vi: subdev imx390 30-001c bound
[ 5.432205] imx390 30-001c: Detected IMX390 sensor
[ 5.432288] imx390 30-001d: probing v4l2 sensor.
[ 5.432466] imx390 30-001d: couldn’t create debugfs
[ 5.432664] imx390 30-001d: tegracam sensor driver:imx390_v2.0.6
[ 5.432700] imx390 30-001d: Detected IMX390 sensor
[ 5.432812] imx390 30-001e: probing v4l2 sensor.
[ 5.432950] imx390 30-001e: couldn’t create debugfs
[ 5.433124] imx390 30-001e: tegracam sensor driver:imx390_v2.0.6
[ 5.433154] imx390 30-001e: Detected IMX390 sensor

Could you please suggest any idea to debug it.

Thanks for your time

Hello JerryChang,
Thanks for your time and support. Finally we able to read 4 VC packet the issue in channel_numbers in dtsi file. Now am reading my frame using v4l2 API in C that I can read data using memmap but when am using userprt concept it’s generating following. could you please suggest some document for this and any idea to debug it.

VIDIC_QBUF error 22, Invalid argument.
Here I have attached my c file.
Thanks for your timev4l2.c (19.0 KB)

Hi JerryChang,
We solved the issue. Thanks for your support.

hello PaulEnoch,

glad to know your use-case works,
to summarize, could you please share some information about your solutions. is it sensor driver issues?
thanks

Hello JerryChang,
Issue in memory copy. This Link helped me [closed]Slow copy: memcpy 26Mb = 190ms with MMAP. IO_METHOD_USERPTR now works. . Thanks for your time and support.

Hi JerryChang,
My driver is working properly in above 850Mbps. But its not working for below 850Mbps data rate. I have changed settle time, then also no improvement, Is there any limitation in Xavier NX datarate/pixel_clock. Could you please suggest some Idea to debug it.
Then one doubt JerryChang, How to read the status of register in csi5_fops.c and vi5_fops.c file for debugging. And also, Is any possibility there to check what is the error like LP error or SOT error or Start frame error or clock error.

Here I have attached dmesg

Thanks for your time

hello PaulEnoch,

that sensor data rate setting in device tree should be identical of your sensor outputs.
may I know what’s the scenario for setting data rate below 850-Mbps?
thanks

Hi JerryChang,
Thanks for your reply. My custom sensor can send data from 200 Mbps to 1.3Gbps by configuring. So that we tested different data rate by configuring sensor and dtsi (pixel clock and settle time) file in imx390. In that it’s working in 1.3Gbps and 900Mbps But When my sensor configured for 650, 450, 220 and 350 Mbps its not working. Could you please suggest any idea.

Thanks for your time.

hello PaulEnoch,

Xavier’s VI engine is timing sensitive, it should be timing issue for different sensor data rate settings.
please have a try to add set_mode_delay_ms property for increasing timeout values for 1st frame.
for example,

set_mode_delay_ms | Maximum wait time for the first frame after capture starts, in milliseconds.

Hi JerryChang,
Thanks for your reply, I have attached My dtsi file updated section for clarification. Could please check am added correctly.

Thanks for your time

hello PaulEnoch,

just for confirmation,
did you also modify the serdes_pix_clk_hz property for your lower sensor data rate configuration.

BTW,
may I know which JetPack release you’re working with.
you may check release tag for details, i.e. $ cat /etc/nv_tegra_release
thanks

Hello JerryChang,
Thanks for your reply. yes I modified serdes_pix_clk_hz as same as pixel_clk because I didn’t found method to calculate it.
I have tested upto CAPTURE_TIMEOUT_MS =25000ms but there is no change in error.
Here I have atttached the output of $ cat /etc/nv_tegra_release in below.
# R32 (release), REVISION: 4.4, GCID: 23942405, BOARD: t186ref, EABI: aarch64, DATE: Fri Oct 16 19:37:08 UTC 2020

    Could you please suggest any solution to debug it.

Thanks for your time

hello PaulEnoch,

could you please have a try by update the scf binary with the attachment, Topic160038_Dec01.zip (2.7 MB)
you may using scp to copy that binary to your target and overwrite the libnvscf.so binary.
thereafter, please perform a warm-reboot to have verification.
for example,

$ sudo cp /tmp/Topic160038_Dec01_libnvscf.so  /usr/lib/aarch64-linux-gnu/tegra/libnvscf.so
$ sudo reboot 

Hello JerryChang,
Thanks for your support. I updated my libnvscf.so as you mentioned above, still having same problem that can’t read data in below 850 Mbps data rate. I am not getting any idea because I can’t see the status of register and if I gave any settle time data reading above 900Mbps data rate. Sorry is any other solution to debug it.

         Is there anyway to read and check register(NVCSI & VI5) status.

Thanks for your time.

hello PaulEnoch,

please access Xavier Series SoC Technical Reference Manual via download center.
please refer to Chapter-7.2.1 for the CSI chapter, and please refer to [7.2.1.4 NVCSI Registers] for register offsets.
you may use 3rdparty tools, such as devmem2 to access the registers for checking its values.
please note that, you should enable the camera stream to dump register values.
thanks

Hello JerryChang,
Thanks for your support. I will check my registers.If you have any suggestion about this error means please share it.

Thanks for your time

Hello JerryChang,
I have try to read NVCSI_PHY_0_NVCSI_CIL_A_CONTROL_0 register, it’s showing following error. I enable camera streaming using V4l2-ctl command.
sudo devmem2 0x00441c
/dev/mem opened.
Memory mapped at address 0x7fb30f4000.
Bus error

Thanks for your time.

hello PaulEnoch,

you should also note that each of the stream-id having different register offsets.
please confirm you’re checking correct registers.

Hello JerryChang,
Thanks for your support. I want to check whether settle time is changing, so that I have checked all the register related to settle time which is provided in document. Am getting bus error or segmentation fault. Is in kernel source any header file hold these register offset details, Because when am looking Csi5_fops.c file am not getting details about register offset.
Is any way to read the register by calling some function in csi5_fops.c file.

Thanks for your time