Adv7282 PAL to MIPI CSI Linux Driver Development

cd $HOME/nvidia/sources/Linux_for_Tegra/source/public/kernel/kernel-4.9/ &&
TEGRA_KERNEL_OUT=$HOME/nvidia/final_out/ &&
LOCALVERSION=-tegra &&
mkdir -p $TEGRA_KERNEL_OUT &&
make O=$TEGRA_KERNEL_OUT tegra_defconfig &&
make O=$TEGRA_KERNEL_OUT -j6 &&
sudo cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image /boot/;
sudo cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra194-p3668-all-p3509-0000.dtb /boot/dtb/

Just building the Image and dtb through this process, shall update results tomorrow.

I asusmed menuconfig is doing the issue, i tried with out it but did not work
or anything else i am missing in specific ? what log would identify this issue ?

Should be the command “export LOCALVERSION=-tegra” for setting building configure.

export prefix worked.

i have a doubt here in the i2c0 of device tree what is the register address to be used ? the existing imx219 device tree uses 0x10 , in the code i have adopted its 0x21 , what is the correct i2c address of cam0 of xavier nx development board

You need consult with device vendor to know the slave address.

i think you have got me wrong, i am speaking about the i2c address which is present in device tree of file
tegra194-camera-rbpcv2-imx219.dtsi

like below, what is the i2c address mentioned below, isnt it the address of the i2c mux present on tegra ?

cam_i2cmux {
		i2c_0:i2c@0 {
			status = "okay";				
			imx219_cam0: rbpcv2_imx219_a@10 {
				compatible = "adi,adv7282-m";
				/* I2C device address */
				reg = <0x10>;

				/* V4L2 device node location */
				devnode = "video0";

				/* Physical dimensions of sensor */
                physical_w = "4.713";
                physical_h = "3.494";

				sensor_model = "adv7282-m";

				use_sensor_mode_id = "false";

to breif more below is my schematic of connector and 7282

The i2c address here is the slave address of ADV7282 doesn’t matter with the mux.

  1. i was able to see video node in my /dev/ but the main problem observed from dmesg logs is there is no ack from the address 0x21(the address is correct for the device)
  2. if you see my daughter board schematic i did not put any pullup on my board, i have seen 47k pulled up to 3.3v on both scl and sda lines of carrier board scheamtic, please confirm if i require pullups on my daughter board too ?

below is the snap of standard carrier board schematic

You can use an oscilloscope to observe the I2C waveform to confirm if it is correct. Basically no other pull-up is necessary.

1 Like

actual slave address as per datasheet is 0x43 but i get respose with address being 0x44 using below command
i2cget -y 2 0x44 0x11

is it like the i2c get includes r/w bit also in the address which is why read address is actually 0x44 ?

surprisingly the command i2cdetect over channel 2 doesnt detect chip what info the i2c detect will try to see ?

the device is responding to i2cget -y 2 0x21 , but not for i2c detect
i understood that the adv devices mostly wont respond to i2cdetect as they need write followed by read (assumption)
leaving i2cdetect issue aside

i went forward , i was able to see the appearance of video0 node in /dev
i went to see dmesg | grep 7282 the log is as follows

Line 594: [    2.158727] adv7282 9-0021: chip found @ 0x21 (i2c-2-mux (chan_id 0))
Line 607: [    2.176037] adv7282: probe of 9-0021 failed with error -121
Line 608: [    2.176116] adv7282 10-0021: chip found @ 0x21 (i2c-2-mux (chan_id 1))
Line 610: [    2.197643] adv7282 10-0021: adv7282-m probed!
Line 610: [    2.197643] adv7282 10-0021: adv7282-m probed!
Line 816: [    3.179292] tegra194-vi5 15c10000.vi: subdev adv7282 10-0021 bound

so i can clearly see the device is probed sucessfully and video node is created

i went forward to see whether i can open the cheese app,it crashed
the dmesg then read with latest error as below

Line 1057: [  126.993369] tegra194-vi5 15c10000.vi: corr_err: discarding frame 1, flags: 0, err_data 64

What could be the issues ?
I am attached the dmesg log also, kindly suggest where exactly i am doing wrong.
log.txt (69.7 KB)

Using v4l2-ctl and get the trace log to check.

https://elinux.org/Jetson/l4t/Camera_BringUp

[  126.982514] [RCE] vi5_hwinit: firmware CL2018101701 protocol version 2.2
[  126.993369] tegra194-vi5 15c10000.vi: corr_err: discarding frame 1, flags: 0, err_data 64
[  127.094630] [RCE] WARNING: t194/isp5.c:901 [config_channel] "All error notifications not enabled: correctable=0x00 uncorrectable=0x00"
[ 1010.279683] tegradc 15200000.nvdisplay: blank - powerdown
[ 1010.340088] extcon-disp-state external-connection:disp-state: cable 47 state 0
[ 1010.340093] Extcon AUX1(HDMI) disable
[ 1010.362677] tegra_nvdisp_handle_pd_disable: Powergated Head1 pd
[ 1010.363213] tegra_nvdisp_handle_pd_disable: Powergated Head0 pd
[ 1250.786347] tegradc 15200000.nvdisplay: unblank
[ 1250.789496] tegra_nvdisp_handle_pd_enable: Unpowergated Head0 pd
[ 1250.790038] tegra_nvdisp_handle_pd_enable: Unpowergated Head1 pd
[ 1250.799203] Parent Clock set for DC plld2
[ 1250.803686] tegradc 15200000.nvdisplay: hdmi: tmds rate:148500K prod-setting:prod_c_hdmi_111m_223m
[ 1250.805107] tegradc 15200000.nvdisplay: hdmi: get YCC quant from EDID.
[ 1250.841632] extcon-disp-state external-connection:disp-state: cable 47 state 1
[ 1250.841637] Extcon AUX1(HDMI) enable
[ 1250.860333] tegradc 15200000.nvdisplay: unblank
[ 1250.860349] tegradc 15210000.nvdisplay: blank - powerdown
[ 1637.863589] tegra194-vi5 15c10000.vi: =================  START STATUS  =================
[ 1637.863597] tegra194-vi5 15c10000.vi: ==================  END STATUS  ==================
[ 1637.867148] adv7282 10-0021: adv7180_g_dv_timings():
[ 1637.874207] Unable to handle kernel NULL pointer dereference at virtual address 000001e8
[ 1637.874379] Mem abort info:
[ 1637.874435]   ESR = 0x96000005
[ 1637.874491]   Exception class = DABT (current EL), IL = 32 bits
[ 1637.874590]   SET = 0, FnV = 0
[ 1637.874645]   EA = 0, S1PTW = 0
[ 1637.874702] Data abort info:
[ 1637.874753]   ISV = 0, ISS = 0x00000005
[ 1637.874819]   CM = 0, WnR = 0
[ 1637.874879] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc1330a6000
[ 1637.875089] [00000000000001e8] *pgd=0000000000000000, *pud=0000000000000000
[ 1637.875235] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[ 1637.875338] Modules linked in: fuse zram overlay bnep rtl8822ce rtk_btusb btusb btrtl btbcm btintel cfg80211 spidev userspace_alert nvgpu bluedroid_pm ip_tables x_tables
[ 1637.875756] CPU: 0 PID: 11880 Comm: v4l2-compliance Tainted: G        W       4.9.201-tegra #12
[ 1637.876404] Hardware name: NVIDIA Jetson Xavier NX Developer Kit (DT)
[ 1637.876897] task: ffffffc1908cc600 task.stack: ffffffc1516d8000
[ 1637.877364] PC is at tegra_vi5_g_volatile_ctrl+0x48/0x120
[ 1637.881784] LR is at tegra_vi5_g_volatile_ctrl+0x2c/0x120
[ 1637.887034] pc : [<ffffff8008b49268>] lr : [<ffffff8008b4924c>] pstate: 40400145
[ 1637.894644] sp : ffffffc1516dbac0
[ 1637.897623] x29: ffffffc1516dbac0 x28: ffffffc1e0fd2800 
[ 1637.903229] x27: 000000000f000000 x26: 0000000000000000 
[ 1637.908820] x25: ffffff800a01f750 x24: 0000000000000047 
[ 1637.914067] x23: 0000000000000001 x22: 0000000000000018 
[ 1637.919141] x21: ffffffc1516dbb60 x20: ffffffc1e2aaf820 
[ 1637.924827] x19: ffffffc1e0fd2800 x18: 0000000000000001 
[ 1637.930429] x17: 0000007f83021530 x16: ffffff8008272650 
[ 1637.935867] x15: ffffffffffffffff x14: ffffffc1516dbac0 
[ 1637.941555] x13: ffffffc1516db9c5 x12: 0000000000000000 
[ 1637.947491] x11: ffffffc1516db980 x10: ffffffc1516db980 
[ 1637.953181] x9 : 0000000000000002 x8 : 0000000000000002 
[ 1637.958954] x7 : ffffff8008fc7100 x6 : 0000000000000090 
[ 1637.964215] x5 : 000000000000008d x4 : 0000000000000001 
[ 1637.969804] x3 : 00000000009a2033 x2 : 0000000000000000 
[ 1637.975140] x1 : ffffffc1908cc600 x0 : 00000000009a2032

I assume the problem is at timings ?

It should be the driver cause the kernel crash. You may need to debug to fix it first.

i hardcoded the resolution in side the driver code which did not cause the previous error.
and ran below command

v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=frame.raw --stream-count=1

i was able to avoid crash , now i am seeing below error

tegra194-vi5 15c10000.vi: corr_err: discarding frame 2, flags: 0, err_data 64
tegra194-vi5 15c10000.vi: corr_err: discarding frame 1, flags: 0, err_data 131072

What’s the trace log shows.

i followed the guide you provided to drag trace log
i personally was not able to pin point the issue here
attached is the log.
trace_log.txt (619.4 KB)

Still see the short frame in the trace log. You may need to check more output size.

i assume you are asking to increase the stream count and trace log file buffer size
made count to 5

v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=frame.raw --stream-count=5

i was not able to see the process end at all, may be due to the errors caused, but i waited for atleast 2mins and then killed the v4l2 process(Ctrl+C)

attached are the log with increased buffer size, use gzip to extract.
trace_log3.txt.gz (600.0 KB)

I mean the sensor driver report correct resolution(output size) to fix the short frame issue.