Testing IMX204 camera with Jetson Xavier

Hi,

I am testing IMX204 with Jetson Xavier through SLVS-EC bus, however I am not sure that whether Imx204 is properly loaded or not. I have done the following steps:

  1. Hardware setup check: I have review several times: SPI pins, SLVS-EC connections…

  2. Check camera driver is loaded or not:

lsmod

, but there was no imx204 driver listed.

  1. Run command:
media-ctl -d /dev/media0 -p

, but nothing bind in the device tree.

Anyone experience with this, please share your steps.

Many thanks!

Here is the result after running media-ctl command:

Media controller API version 0.1.0

Media device information
------------------------
driver          tegra194-vi5
model           NVIDIA Tegra Video Input Device
serial          
bus info        
hw revision     0x3
driver version  0.0.0

Device topology

And /dev/video0 missing as well

hello Hung-Lam,

may I have your confirmation,
were you tried to develop loadable imx204 kernel driver?
please refer to Topic 1027573, and this may not support in the short-term.
thanks

Hi JerryChang,

No, I wasn’t. I have one Imx204 camera, which connected with Xavier board via SPI and SLVS-EC. I tried to re-use imx204 driver which is available in R32.1, then use gstreamer/libargus to capture video or image.

However, after connecting the sensor to Xavier, there was nothing happened. Not able to detect the sensor via media controller or v4l2 sub-device.

I used an external power supply for the sensor, not from Xavier carrier board. I am not so clear about the root cause yet.

I checked kernel message but no log from imx204 driver.

hello Hung-Lam,

please check public release kernel sources, there’s IMX204 dts which support IMX204 SLVS-EC camera board.
since you’re using external power supply, you should also check you’re given that at the booting stage.
or you’ll see the detection failure from bootloader.
please refer to Using Plugin Manager session for more details.
thanks

$TOP/kernel_src/hardware/nvidia/platform/t19x/common/kernel-dts/t19x-common-modules/tegra194-camera-e3377-a00.dtsi
$TOP/kernel_src/hardware/nvidia/platform/t19x/common/kernel-dts/t19x-common-modules/tegra194-camera-plugin-manager.dtsi

Hi JerryChang,

Thanks a lot for your answer. That is also my intention to add external power supply to enable them during the booting stage.

Here are my update: <sources/hardware/nvidia/platform/t19x/galen/kernel-dts/common/tegra194-fixed-regulator-p2822-1000.dtsi>

slvsec_dvdd_1v2_cam: regulator@115 {
			compatible = "regulator-fixed";
			reg = <115>;
			regulator-name = "slvsec-dvdd-1v2-cam";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(H, 0) 0>;
			enable-active-high;
			vin-supply = <&battery_reg>;
			startup-delay-us = <100000>;
		};

		slvsec_ovdd_1v8_cam: regulator@116 {
			compatible = "regulator-fixed";
			reg = <116>;
			regulator-name = "slvsec-ovdd-1v8-cam";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Z, 7) 0>;
			enable-active-high;
			vin-supply = <&battery_reg>;
			startup-delay-us = <200000>;			
		};

		slvsec_avdd_3v3_cam: regulator@117 {
			compatible = "regulator-fixed";
			reg = <117>;
			regulator-name = "slvsec-avdd-3v3-cam";
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
			gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(N, 1) 0>;
			enable-active-high;
			vin-supply = <&battery_reg>;
			startup-delay-us = <300000>;
		};

Then, update them into tegra194-camera-e3377-a00.dtsi for imx204 sensor

vdig-supply = <&slvsec_dvdd_1v2_cam>;
			vif-supply = <&slvsec_ovdd_1v8_cam>;
			vana-supply = <&slvsec_avdd_3v3_cam>;

However, during the booting those regulator was disabling, do you know how to enable them.

...
[    1.066776] slvsec-dvdd-1v2-cam: 1200 mV 
[    1.067619] slvsec-ovdd-1v8-cam: 1800 mV 
[    1.068460] slvsec-avdd-3v3-cam: 3300 mV 
...
[    1.069730] slvsec-dvdd-1v2-cam: supplied by vdd-ac-bat
[    1.069883] slvsec-ovdd-1v8-cam: supplied by vdd-ac-bat
[    1.070099] slvsec-avdd-3v3-cam: supplied by vdd-ac-bat
...
[   12.014396] slvsec-dvdd-1v2-cam: disabling
[   12.015653] slvsec-ovdd-1v8-cam: disabling
[   12.016889] slvsec-avdd-3v3-cam: disabling

Please help me clarify when probe functions imx204-spi driver or i2c driver of any camera driver is called. I have power provided to imx204 sensor, however I could not find any trace of imx204-spi driver in kernel log after Xavier booting.

Any hint please.

I figured out the error of slvs-ec driver while it is probing, but not so clear why, since i have not make any modification from R32.1 release for SLVSEC yet.

[    1.737683] tegra-slvs-ec 15ac0000.slvs-ec: initialized
[    1.737992] tegra-slvs-ec 15ac0000.slvs-ec: no streams defined
[    1.738035] tegra-slvs-ec 15ac0000.slvs-ec: failed to init SLVS media controller (-19)
[    1.738088] tegra-slvs-ec 15ac0000.slvs-ec: probed

hello Hung-Lam,

could you please disassembler your customize dtb file into txt file for checking,
for example,

$ dtc -I dtb -O dts -o results.txt tegra.dtb

Hi JerryChang,

Thanks for your hint!

I have tried, even with the fresh download source from R32.1, applying source_synch.sh, then compile the kernel. These errors already existed.

That means .dtsi file for Imx204 could not link with tegra-slvs-ec driver properly somehow.

Can you please help to check? I am disassembling the dtb files for checking. I will get you updated.

Hi JerryChang,

Here is disassembler file of my updated dtb.

dtc -I dtb -O dts -o temp.txt ./dtb/tegra194-p2888-0001-p2822-0000.dtb

https://www.dropbox.com/s/maeaysm0jg43sbx/temp.txt?dl=0
I could not find something strange, as slvsec streams/stream seen in temp.txt

hello Hung-Lam,

it seems you don’t have available streams for slvs even though your sensor DT configuration looks correct.
please dig into below kernel sources and check why you cannot parse slvs-ec configuration.
thanks

<i>$TOP/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/slvs/slvs.c</i>

static int tegra_slvs_parse_dt(struct tegra_mc_slvs *slvs)
{...}

Hi JerryChang,

It was quite interesting. I was able to fix the problem of slvs stream, camera sensor was loaded.

However, I could not find the camera devnode defined in DT, eg devnode = video0

Therefore, no v4l video device created in /dev folder, you please share me how to verify slvs camera as Nvidia has validated.

Thanks alot!

Hi JerryChang,
I am able to handle camera devnode.
Verify camera driver and device tree:

media-ctl -d /dev/media0 -p

Media controller API version 0.1.0

Media device information
------------------------
driver          tegra194-vi5
model           NVIDIA Tegra Video Input Device
serial          
bus info        
hw revision     0x3
driver version  0.0.0

Device topology
- entity 1: imx204_spi (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev0
	pad0: Source
		[fmt:SRGGB10_1X10/3712x1548 field:none colorspace:srgb]
		-> "15ac0000.slvs-ec-stream-0":0 [ENABLED]

- entity 3: 15ac0000.slvs-ec-stream-0 (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
	pad0: Sink
		<- "imx204_spi":0 [ENABLED]
	pad1: Source
		-> "vi-output, imx204_spi":0 [ENABLED]

- entity 6: vi-output, imx204_spi (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
	pad0: Sink
		<- "15ac0000.slvs-ec-stream-0":1 [ENABLED]

However, I am not able to get the image capture yet. There are still some errors.
Sending command

v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --stream-mmap --stream-count=1 -d /dev/video0 --stream-to=imx204.raw

Result trace

[  628.778299] [IMX204]: power on
[  628.778371] tegra-slvs-ec 15ac0000.slvs-ec: tegra_slvs_s_power(enable)
[  628.781204] tegra194-vi5 15c10000.vi: =================  START STATUS  =================
[  628.781213] tegra194-vi5 15c10000.vi: ==================  END STATUS  ==================
[  628.783373] Unable to handle kernel NULL pointer dereference at virtual address 00000088
[  628.783580] Mem abort info:
[  628.783643]   ESR = 0x96000005
[  628.783707]   Exception class = DABT (current EL), IL = 32 bits
[  628.783816]   SET = 0, FnV = 0
[  628.783877]   EA = 0, S1PTW = 0
[  628.783940] Data abort info:
[  628.783997]   ISV = 0, ISS = 0x00000005
[  628.784076]   CM = 0, WnR = 0
[  628.784149] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc3780c3000
[  628.784294] [0000000000000088] *pgd=0000000000000000, *pud=0000000000000000
[  628.784622] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[  628.784736] Modules linked in: bnep fuse nvs_bmi160 nvs nvgpu bluedroid_pm ip_tables x_tables
[  628.785084] CPU: 0 PID: 9124 Comm: v4l2-compliance Not tainted 4.9.140+ #39
[  628.785202] Hardware name: jetson-xavier (DT)
[  628.785282] task: ffffffc36f06e200 task.stack: ffffffc3257e0000
[  628.785644] PC is at __memcpy+0x44/0x180
[  628.785942] LR is at tegra_vi5_g_volatile_ctrl+0x118/0x128
[  628.786358] pc : [<ffffff800844f184>] lr : [<ffffff8008b15f68>] pstate: 00400145
[  628.791000] sp : ffffffc3257e3ac0
[  628.794407] x29: ffffffc3257e3ac0 x28: 000000000f000000 
[  628.800124] x27: 0000000000000000 x26: ffffffc3257e3d10 
[  628.805721] x25: ffffff8009f5fcf0 x24: 0000000000000001 
[  628.811324] x23: 0000000000000018 x22: 0000000000000000 
[  628.816693] x21: ffffffc3257e3d10 x20: ffffffc3ead4c800 
[  628.821662] x19: ffffffc3d8f90000 x18: 0000000000000001 
[  628.827601] x17: 0000007f8ee3fb10 x16: ffffff800826cfa8 
[  628.833057] x15: ffffffffffffffff x14: ffffffc3257e3ac0 
[  628.838731] x13: ffffffc3257e39c5 x12: 0000000000000000 
[  628.844456] x11: 0000000000000000 x10: 0000000000000000 
[  628.850198] x9 : 0000000000000002 x8 : 0000000000000002 
[  628.856250] x7 : ffffff8008f86e48 x6 : ffffffc3d8f900d0 
[  628.861724] x5 : 000000000000008d x4 : 0000000000000008 
[  628.867060] x3 : 00000000009a2033 x2 : 0000000000001000 
[  628.872196] x1 : 0000000000000088 x0 : ffffffc3d8f900d0 

[  628.879161] Process v4l2-compliance (pid: 9124, stack limit = 0xffffffc3257e0000)
[  628.886139] Call trace:
[  628.888480] [<ffffff800844f184>] __memcpy+0x44/0x180
[  628.892977] [<ffffff8008aef048>] v4l2_g_ext_ctrls+0x220/0x300
[  628.898578] [<ffffff8008ae6760>] v4l_g_ext_ctrls+0x58/0xe0
[  628.903414] [<ffffff8008ae4c94>] __video_do_ioctl+0x1bc/0x288
[  628.909001] [<ffffff8008ae46ac>] video_usercopy+0x2cc/0x6a8
[  628.914343] [<ffffff8008ae4ac4>] video_ioctl2+0x3c/0x50
[  628.918875] [<ffffff8008ade958>] v4l2_ioctl+0xf8/0x128
[  628.923942] [<ffffff800826c760>] do_vfs_ioctl+0xb0/0x8f8
[  628.929018] [<ffffff800826d03c>] SyS_ioctl+0x94/0xa8
[  628.933834] [<ffffff80080838c0>] el0_svc_naked+0x34/0x38
[  628.938666] ---[ end trace fe5fdf74cfed9c34 ]---

Apart from these memory errors, SPI communication of IMX204 was not working yet, but it was working with spidev very well. Do you have any hint? Thanks in advance!

hello Hung-Lam,

please refer to below things for reference.
thanks

  1. SLVS-EC signals are only available through the PCIe connector. New SLVS-EC camera boards have to be designed for plug in to PCIe slot.
  2. SLVS-EC sensors require 72MHz input clock. Currently none of the camera clocks from tegra (extperiahX) can support more than 50MHz clock. Therefore, it is mandatory to use an external clock source (ex, crystals on the camera board).
  3. SLVS-EC interface needs two input clocks (XHS, XVS) to do synchronization. Make sure to program these two clock source correctly (In Device Tree, using VGP pins) . Otherwise, you will not get any output from sensor.
  4. since we had only been tested slvs-ec with IMX204. some settings might need to be adjusted if you’re choose different sensors.

Hi JerryChang,

  1. Yes, I am using PCIE connector on carrier board for SLVS-EC signal with an adapter board.

  2. I am using external clock 74.25Mhz providing to camera board, apart from that i am also using external power supplies. (3v3, 1v8, 1v2).

  3. Imx204 driver/device tree has defined XHS, XHS via VGP pins. I am following imx204 device tree for these VGP pins and found no concern there.

  4. As IMX204 has validated, you please hint me for the issue that Xavier yet to send out SPI command to sensor, but when I bind to spidev it was working fine.

Thanks!

Hi,

I found a pin name SLVS_XCE in Xavier carrier board schematic. This pin is connected to SPI3_MOSI. As per my understanding, XCE pin is to enable serial communication to camera sensor, however this pin is not connected to SPI2_CS.

Please share with me how Nvidia managed to enable SPI communication with IMX204.

Thanks!

Hi,

May I know the purpose of SLVS_XCE pin, since I am able to handling SPI imx204 communication, set camera sensor to working mode.

However, I am still facing problem with VI5. Please share with me if you have any hint.

[  503.424502] [RCE] Configuring VI GoS.
[  503.424522] [RCE] VM GOS[#0] addr=0xe4900000
[  503.424533] [RCE] VM GOS[#1] addr=0xe4901000
[  503.424543] [RCE] VM GOS[#2] addr=0xe4902000
[  503.424550] [RCE] VM GOS[#3] addr=0xe4903000
[  503.424557] [RCE] VM GOS[#4] addr=0xe4904000
[  503.424563] [RCE] VM GOS[#5] addr=0xe4905000
[  503.424575] [RCE] vi5_hwinit: firmware CL2018101701 protocol version 2.2
[b][  503.424583] [RCE] ERROR: t194/vi5.c:285 [vi5_update_streams] "VI not active"
[  503.424596] [RCE] VI GOS[#0] set to VM GOS[4] base 0xe4904000
[  506.012462] tegra194-vi5 15c10000.vi: no reply from camera processor
[  506.012669] tegra194-vi5 15c10000.vi: uncorr_err: request timed out after 2500 ms
[  506.012872] tegra194-vi5 15c10000.vi: err_rec: attempting to reset the capture channel
[  506.015588] tegra194-vi5 15c10000.vi: unable to find linked csi subdev
[  506.015746] tegra194-vi5 15c10000.vi: fatal: error recovery failed
[  899.945648] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[  899.945838] Mem abort info:
[  899.945894]   ESR = 0x96000005
[  899.945958]   Exception class = DABT (current EL), IL = 32 bits
[  899.946063]   SET = 0, FnV = 0
[  899.946124]   EA = 0, S1PTW = 0
[  899.946185] Data abort info:
[  899.946244]   ISV = 0, ISS = 0x00000005
[  899.946316]   CM = 0, WnR = 0
[  899.946385] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc3734af000
[  899.946525] [0000000000000000] *pgd=0000000000000000, *pud=0000000000000000
[  899.946687] Internal error: Oops: 96000005 [#1] PREEMPT SMP[/b]
[  899.946842] Modules linked in: bnep fuse nvs_bmi160 nvs nvgpu bluedroid_pm ip_tables x_tables
[  899.947095] CPU: 2 PID: 8786 Comm: v4l2-ctl Not tainted 4.9.140+ #85
[  899.947211] Hardware name: jetson-xavier (DT)
[  899.947455] task: ffffffc32405e200 task.stack: ffffffc3ec25c000
[  899.947932] PC is at exit_creds+0x2c/0x80
[  899.948220] LR is at __put_task_struct+0x4c/0x148
[  899.948590] pc : [<ffffff80080deba4>] lr : [<ffffff80080b069c>] pstate: 60400045
[  899.952464] sp : ffffffc3ec25fa10
[  899.955521] x29: ffffffc3ec25fa10 x28: ffffffc32405e200 
[  899.961365] x27: 0000000000000009 x26: ffffffc35ce1d940 
[  899.967143] x25: ffffffc324017b10 x24: 0000000000000001 
[  899.972349] x23: ffffffc3b966c048 x22: ffffffc3bab0cb58 
[  899.977951] x21: ffffffc3b92fe230 x20: 0000000000000000 
[  899.983323] x19: ffffffc3b92fe200 x18: 00000000001e3d8a 
[  899.988589] x17: 0000007fb3523f60 x16: ffffff800826fc80 
[  899.994442] x15: 00000000000003ea x14: 0000000000000004 
[  899.999955] x13: 0000000000000000 x12: 0000000000576f50 
[  900.005634] x11: 000000000000000d x10: 0000000000000a20 
[  900.011163] x9 : ffffffc3ec25f850 x8 : ffffffc32405ec80 
[  900.017207] x7 : ffffff8009df6b00 x6 : 00000006989fee02 
[  900.022450] x5 : 0000000000000400 x4 : 0000000000000000 
[  900.027787] x3 : 00000000000000d3 x2 : 0000000000000000 
[  900.033123] x1 : 0000000000000000 x0 : 00000000ffffffff 

[  900.040137] Process v4l2-ctl (pid: 8786, stack limit = 0xffffffc3ec25c000)
[  900.046763] Call trace:
[  900.049177] [<ffffff80080deba4>] exit_creds+0x2c/0x80
[  900.053691] [<ffffff80080b069c>] __put_task_struct+0x4c/0x148
[  900.059024] [<ffffff80080dc6b0>] kthread_stop+0x1e0/0x1e8
[  900.064386] [<ffffff8008b15508>] vi5_channel_stop_kthreads+0x40/0x58
[  900.070505] [<ffffff8008b155b0>] vi5_channel_stop_streaming+0x90/0xb0

hello Hung-Lam,

below failure from VI side shows incomplete signaling coming to VI engine.

[  503.424583] [RCE] ERROR: t194/vi5.c:285 [vi5_update_streams] "VI not active"
[  503.424596] [RCE] VI GOS[#0] set to VM GOS[4] base 0xe4904000
[  506.012462] tegra194-vi5 15c10000.vi: no reply from camera processor
[  506.012669] tegra194-vi5 15c10000.vi: uncorr_err: request timed out after 2500 ms
[  506.012872] tegra194-vi5 15c10000.vi: err_rec: attempting to reset the capture channel
[  506.015588] tegra194-vi5 15c10000.vi: unable to find linked csi subdev
[  506.015746] tegra194-vi5 15c10000.vi: fatal: error recovery failed
[  899.945648] Unable to handle kernel NULL pointer dereference at virtual address 00000000

could you please enable VI tracing logs to gather more details.
for example,

echo 1 > /sys/kernel/debug/tracing/tracing_on
echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
echo 2 > /sys/kernel/debug/camrtc/log-level
echo > /sys/kernel/debug/tracing/trace
cat /sys/kernel/debug/tracing/trace