MIPI CSI Signal Question

I’m still investigating the adv7280-m chip over MIPI CSI to the Apalis T30. A /dev/video0 device is now available for this encoder having tweaked the driver from the TK1 source. Unfortunately this comes with its own problems in the form of a major system crash when trying to access the video stream but that is for another thread.

When inspecting the CSI clock and data signals, it appears that the clock pair are sat at zero volts with the data pair sat around 1.2V. Having followed the guidelines for routing the signals with correct impedance, I’m doubting that it is due to incorrect termination.

I’m also under the impression that the pinmuxing is correct for these signals by default.

Could you please offer any suggestions as to what this could indicate? The clock and data pair are connected straight from the Apalis into the adv7280.

Kind regards,
Kevin

Is it possible that the MIPI CSI clock is not being initialized in the platform configuration? Looking at the platform file for the Apalis T30 here, the “vi” clock is set to disabled with a 0 for freq - I don’t know if this is at all related to anything but the ov5460 driver has a vi_freq value in its platform data struct - should this also be present for the adv7280?

Good question. The only thing I know for sure is that the OV5640 camera sensor works just fine out-of-the-box both on Apalis T30 as well as Apalis TK1.

I also know that our camera partner Antmicro does have some experience with the ADV7280M. I therefore suggest for you to contact them for help.

Hi @marcel.tx, thanks for your response. I’m looking at the platform_data for the ov5640 and comparing it to the merged adv7240_platform_data and trying to work out what needs to be added - things like the “vi_freq” for example.

I’ve already contacted Antmicro several times before Christmas but I’m still awaiting their response.

@marcel.tx When you have had the OV5640 working, which CSI port was this on? I’m looking at both the NVIDIA Tegra3 manual and the Apalis T30 datasheet and I can’t find any reference to the CSI_CLKAP/AN and CSI_D1AP/AN signals.

Can you please confirm which port you have has this working on? We have mapped our single lane CSI camera to the CSI_A port.

We have it working on both but by default out-of-the-box with any of our later BSPs it is CSI_A and streaming as follows:

modprobe videobuf2-memops
modprobe videobuf2-dma-nvmap
modprobe ov5640
modprobe tegra_v4l2_camera
root@apalis-t30:~# gst-launch -e v4l2src device="/dev/video0" ! 'video/x-raw-yuv, width=(int)640, height=(int)480, format=(fourcc)YUY2' ! nvvidconv ! 'video/x-nvrm-yuv, format=(fourcc)I420' ! nvxvimagesink

Thanks Marcel. After some expert external help (mainly to do with the driver), I now have a working video feed from the adv7280-m over CSI.

One further question I have is that the gstreamer preview seems to be a little bit odd as per this picture:

alt text

The gstreamer preview window shows the live video (or a test pattern, if enabled) in the top portion of the preview, with the rest of the window as a green rectangle. I’ve checked the width/height of the /dev/video0 device and it reports back 640x576 however this preview doesn’t reflect that.

Have you experienced anything like this and can you offer any suggestions as to what I could try or where I should be looking? Could this be an adv7280 driver issue? An issue with gstreamer or maybe video4linux?

Thanks

That’s called just-in-time as we also just got our own ADV7280-M (basically a modified ACA) hardware working today but so far only on Apalis TK1 but there on all 3 CSI-2 interfaces using a prototype Apalis TK1 Mezzanine fitting the Apalis Evaluation board as well as the CSI-2 interface on the new Ixora V1.1A.

Could you share the driver and platform data changes you did on Apalis T30 so I may try the same on our side now as well?

What exact gstreamer pipeline did you actually use?

One thing that comes to mind seeing only your half screen showing is software de-interlacing as required for our former ADV7180 resp. MAX9526 based ACM hardware which part of it I believe is even implemented in the generic T30 camera driver. If that driver for some reason got configured that way this may explain it.

Hi @marcel.tx

I’ve attached the adv7280.c driver as it stands so far.

adv7280.c

I used the same gstreamer pipeline you gave in a previous comment, swapping the width/height for 640/576 as the pipeline wouldn’t initialize with other values.

I believe the adv7280-m has a hardware deinterlacer, in which case, would I need to turn the software deinterlacer off?

This has now been solved. The issue was related to the hardware deinterlacer and the fact that it was not enabled by the driver in my branch of the linux-toradex source.

The camera now works perfectly.

That actually even fails building for me as follows:

linux-toradex/drivers/media/video/adv7280.c: In function 'adv7280_s_power':
linux-toradex/drivers/media/video/adv7280.c:355:40: error: implicit declaration of function 'soc_camera_i2c_to_desc' [-Werror=implicit-function-declaration]
  struct soc_camera_subdev_desc *scsd = soc_camera_i2c_to_desc(client);
                                        ^~~~~~~~~~~~~~~~~~~~~~
linux-toradex/drivers/media/video/adv7280.c:355:40: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
linux-toradex/drivers/media/video/adv7280.c:357:9: error: implicit declaration of function 'soc_camera_set_power' [-Werror=implicit-function-declaration]
  return soc_camera_set_power(&client->dev, scsd, on);
         ^~~~~~~~~~~~~~~~~~~~

So I guess you may have further source changes e.g. in the v4l2 stack plus I am missing the board platform data part which actually instantiates the adv7280 driver. Can you provide that as well?

If I comment the s_power stuff it compiles but fails to run on Apalis T30 as follows:

root@apalis-t30:~# modprobe videobuf2-memops
root@apalis-t30:~# modprobe videobuf2-dma-nvmap
root@apalis-t30:~# modprobe adv7280
root@apalis-t30:~# modprobe tegra_v4l2_camera
[   64.970844] vi vi: initialized
[   64.973945] soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
[   65.001092] soc-camera-pdrv soc-camera-pdrv.1: Probing soc-camera-pdrv.1
[   65.022793] probe, id=adv7280
[   65.025778] adv7280 2-0020: chip found @ 0x40 (Tegra I2C adapter)
[   65.038698] adv7280 2-0020: ident reg is 0x42
[   65.062020] vi vi: Providing format YUV422 (UYVY) packed using code 8198
[   65.068772] vi vi: Providing format YUV422 (VYUY) packed using code 8198
[   65.075477] vi vi: Providing format YUV422 (YUYV) packed using code 8198
[   65.082211] vi vi: Providing format YUV422 (YVYU) packed using code 8198
[   65.088937] vi vi: Providing format YUV420 (YU12) planar using code 8198
[   65.095640] vi vi: Providing format YVU420 (YV12) planar using code 8198
[   65.102366] vi vi: Providing format Bayer 8 BGBG.. GRGR.. using code 8198
[   65.109178] vi vi: Providing format Bayer 10 BGBG.. GRGR.. using code 8198
[   65.118458] soc-camera-pdrv soc-camera-pdrv.3: Probing soc-camera-pdrv.3
[   65.140085] soc-camera-pdrv soc-camera-pdrv.4: Probing soc-camera-pdrv.4
[   65.170737] i2c i2c-2: Failed to register i2c client max9526 at 0x20 (-16)
[   65.181261] soc-camera-pdrv soc-camera-pdrv.5: Probing soc-camera-pdrv.5
[   65.198132] soc-camera-pdrv soc-camera-pdrv.6: Probing soc-camera-pdrv.6
[   65.221699] soc-camera-pdrv soc-camera-pdrv.7: Probing soc-camera-pdrv.7
[   65.245920] soc-camera-pdrv soc-camera-pdrv.8: Probing soc-camera-pdrv.8
[   65.270149] vi vi: Tegra camera driver loaded.
root@apalis-t30:~# gst-launch -e v4l2src device="/dev/video0" ! 'video/x-raw-yuv, width=(int)640, height=(int)576, format=(fourcc)YUY2' ! nvvidconv ! 'video/x-nvrm-yuv, format=(fourcc)I420' ! nvxvimagesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
WARNING: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not get 
parameters on device '/dev/video0'
Additional debug info:
../../../gst-plugins-good-0.10.31/sys/v4l2/v4l2src_calls.c(235): gst_v4l2src_set
_capture (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
system error: Invalid argument
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[  102.407928] video4linux video0: Timeout on CSI syncpt
[  102.412994] video4linux video0: buffer_addr = 0x009c5000
[  102.418420] video4linux video0: PPSTATUS = 0x00000000, CILSTATUS = 0x00000000
, ROSTATUS = 0x00000000
[  104.418180] video4linux video0: Timeout on CSI syncpt
[  104.423333] video4linux video0: buffer_addr = 0x009c5000
[  104.428686] video4linux video0: PPSTATUS = 0x00000000, CILSTATUS = 0x00000000
, ROSTATUS = 0x00000000

Our hardware is validated on Apalis TK1 where this works just fine with the following gstreamer 1.0 pipeline:

root@apalis-tk1:~# modprobe videobuf2-dma-contig
root@apalis-tk1:~# modprobe adv7280
root@apalis-tk1:~# modprobe tegra_camera
[   22.795114] vi vi.0: initialized
[   22.806222] platform vi.1: Driver vi requests probe deferral
[   22.817857] soc-camera-pdrv soc-camera-pdrv.1: Probing soc-camera-pdrv.1
[   22.830641] soc-camera-pdrv soc-camera-pdrv.3: Probing soc-camera-pdrv.3
[   22.849529] soc-camera-pdrv soc-camera-pdrv.4: Probing soc-camera-pdrv.4
[   22.864415] soc-camera-pdrv soc-camera-pdrv.5: Probing soc-camera-pdrv.5
[   22.880960] soc-camera-pdrv soc-camera-pdrv.6: Probing soc-camera-pdrv.6
[   22.895030] soc-camera-pdrv soc-camera-pdrv.7: Probing soc-camera-pdrv.7
[   22.908067] soc-camera-pdrv soc-camera-pdrv.8: Probing soc-camera-pdrv.8
[   22.920615] probe, id=adv7280
[   22.924146] adv7280 2-0020: chip found @ 0x40 (Tegra I2C adapter)
[   22.932359] adv7280 2-0020: ident reg is 0x42
[   22.953154] vi vi.1: initialized
[   22.957186] vi vi.0: Supporting mbus format code 0x2006 using YUV422 (UYVY) p
acked
[   22.970278] vi vi.0: Supporting mbus format code 0x2006 using YUV422 (VYUY) p
acked
[   22.978474] vi vi.0: Supporting mbus format code 0x2006 using YUV422 (YUYV) p
acked
[   22.986764] vi vi.0: Supporting mbus format code 0x2006 using YUV422 (YVYU) p
acked
[   22.994861] vi vi.0: Supporting mbus format code 0x2006 using YUV420 (YU12) p
lanar
[   23.003297] vi vi.0: Supporting mbus format code 0x2006 using YVU420 (YV12) p
lanar
[   23.012144] soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
[   23.019416] vi vi.0: Tegra camera driver loaded.
[   23.033782] vi vi.1: Supporting mbus format code 0x100e using RGBA 8-8-8-8
[   23.042405] soc-camera-pdrv soc-camera-pdrv.2: Probing soc-camera-pdrv.2
[   23.052643] vi vi.1: Tegra camera driver loaded.
[   23.058181] ------------[ cut here ]------------
[   23.062846] WARNING: at /run/media/zim/BuildData/Sources/linux-toradex-tegra.
git/arch/arm/mach-tegra/clock.c:303 clk_disable+0x40/0x88()
root@apalis-tk1:~# [   23.075629] Attempting to disable clock vib.vi.c4bus with refcnt 0
[   23.083020] Modules linked in: soc_camera_platform tegra_camera adv7280 videobuf2_dma_contig joydev apalis_tk1_k20_adc gpio_apalis_tk1_k20 apalis_tk1_k20_ts apalis_tk1_k20
[   23.098684] CPU: 1 PID: 787 Comm: v4l_id Not tainted 3.10.40-ga4e9e73-dirty #39
[   23.106012] [<c00151ac>] (unwind_backtrace+0x0/0x120) from [<c0011e38>] (show_stack+0x18/0x1c)
[   23.114627] [<c0011e38>] (show_stack+0x18/0x1c) from [<c0057c18>] (warn_slowpath_common+0x54/0x74)
[   23.123628] [<c0057c18>] (warn_slowpath_common+0x54/0x74) from [<c0057c6c>] (warn_slowpath_fmt+0x34/0x44)
[   23.133203] [<c0057c6c>] (warn_slowpath_fmt+0x34/0x44) from [<c0023178>] (clk_disable+0x40/0x88)
[   23.141990] [<c0023178>] (clk_disable+0x40/0x88) from [<bf021784>] (vi2_clks_disable+0x94/0x9c [tegra_camera])
[   23.152034] [<bf021784>] (vi2_clks_disable+0x94/0x9c [tegra_camera]) from [<bf01f30c>] (tegra_camera_remove_device+0x44/0xb0 [tegra_camera])
[   23.164635] [<bf01f30c>] (tegra_camera_remove_device+0x44/0xb0 [tegra_camera]) from [<c050efdc>] (soc_camera_close+0x8c/0xe0)
[   23.175942] [<c050efdc>] (soc_camera_close+0x8c/0xe0) from [<c04fb204>] (v4l2_release+0x38/0x70)
[   23.184722] [<c04fb204>] (v4l2_release+0x38/0x70) from [<c012a770>] (__fput+0xf0/0x1f4)
[   23.192764] [<c012a770>] (__fput+0xf0/0x1f4) from [<c00781cc>] (task_work_run+0xbc/0xd8)
[   23.200861] [<c00781cc>] (task_work_run+0xbc/0xd8) from [<c00118d0>] (do_work_pending+0x3bc/0x3f0)
[   23.209828] [<c00118d0>] (do_work_pending+0x3bc/0x3f0) from [<c000e420>] (work_pending+0xc/0x20)
[   23.218704] ---[ end trace cb37b1ce71b48e7c ]---
root@apalis-tk1:~# gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,format={UYVY}' ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock