CSI Camera Interface with imx6d and adv7282m problem

Hi Toradex Community,
I need help communicating these two boards, imx6d + adv7282m.
The linux image used in my case is from this link “linux image” - Apalis iMX6 (2.7 | 2018-01-04).

Hardware Info :

  • adv7282m I2C pins connected to ixora X28 pins 13,14
  • adv7282m D0P,D0N,CLKN,CLKP pins connected to ixora x28 2,3,8,9 respectively

Kernel Info :

root@apalis-imx6:~# uname -a
Linux apalis-imx6 4.1.44-2.7.4+gb1555bf #1 SMP Thu Oct 5 04:33:07 UTC 2017 armv7l GNU/Linux

I am trying to get analog video signal with this combination, but till now there is no luck.

What I have done so far :

  • Pure linux image provided by toradex website ( hoping that setup will work out of the box )

  • Edited some lines from arch/arm/boot/dts/imx6qdl-apalis-eval.dtsi

    &mipi_csi {

    ipu_id = &lt0&gt ;

    csi_id = &lt1&gt ;

    v_channel = &lt1&gt ;

    lanes = &lt1&gt ;

    status = “okay”;

    };

    // added to &i2c3 element

    adv7282m: adv7282m@21{

    compatible = “adv7282”;

    pinctrl-names = “default”;

    reg = &lt0x21&gt ;

    csi_id = &lt1&gt ;

    cvbs = &lt1&gt ; /* ANALOGIC channel INPUT#1 /

    DOVDD-supply = &ltreg_3p3v&gt ; // 3.3v

    AVDD-supply = &ltreg_3p3v&gt ; // 1.8v

    DVDD-supply = &ltreg_3p3v&gt ; // 1.8v

    PVDD-supply = &ltreg_3p3v&gt ; // 1.8v

    clocks = &lt&clks 200&gt ;

    clock-names = “csi_mclk”;

    mipi_camera = &lt1&gt ; /
    Needed for v4l2 configuration /

    ipu_id = &lt0&gt ; /
    IPU1 selected */

    status = “okay”;

    };

this is just an example of a modification, tried so many combinations on the tree. For all my modifications,
I got worse results than the original kernel file resulting “v4l2-ctl --all” to not detect any capture device, non-existence of /dev/video0 node.

  • Tried Analog Devices Crust Scripts to get Analog Devices board to run in Free Run mode, but I cant see any change in D0P,D0N,CLKP,CLKN lines looking at the oscilloscope
  • Most of the time I did not use modprobe for any drivers, in some trials modprobed adv7280_tvin, adv7280_tvin but no luck. I don’t know which drivers to probe for this spesific case.

I am an Electronics engineer, using linux for general cases such as daily usage, python, embedded development and so on. This will be my first experience with the linux kernel. Please help me to successfully achieve this task, Thans for your support…

All of my log files :

(device tree not modified)non-modified-kernel-logs.zip

The setup I have is shown in pictures :

[upload|PyCn4QZnjnoNpxD2V+ffeN6gl5M=]

[upload|WQL4zFQRZ6W94trUYvPPc/NlDLU=]

[upload|Zwo++xkPwkU6JKfR+8qZ+96tOV4=]

hi @selcuksarii

Welcome to the Toradex Community!!!

Most of the time I did not use modprobe for any drivers, in some trials modprobed adv7280_tvin, adv7280_tvin but no luck. I don’t know which drivers to probe for this spesific case.

For your special case, you will need special driver and you cannot use the standard driver. Which driver to use will depend on your pinout and the configuration of the 7280 Board.

Which Input Device are you using on the 7280 Board?

this is just an example of a modification, tried so many combinations on the tree. For all my modifications, I got worse results than the original kernel file resulting “v4l2-ctl --all” to not detect any capture device, non-existence of /dev/video0 node.

Are you sure that the 7280 device refers to /dev/video0? You should try other devices video devices to be sure that you are using the correct device.

For the device tree, you should use the standard Ixora device tree and do adaptation to the dtb according to your pinout.

Could you provide the schematic of the connection between Ixora and the custom board and adv7280? What changes have you done to the device tree and kernel ( git diff)?

Best regards, Jaski

hi Jaski,

Thanks for your reply, just to be sure that we are on the same route, the board I am using is “ADV7282M” not “7280 board”. ADV7280 is using parallel video interface, while 7282M is using 1-lane CSI. I want to emphasize this point because, when I made my connections I have a feeling that ixora board is thinking that there is a “ADV7280” is attached to it. This is because Both “ADV7280” and “ADV7282M” is using same i2c port, same i2c address.

For your special case, you will need
special driver and you cannot use the
standard driver. Which driver to use
will depend on your pinout and the
configuration of the 7280 Board.

Which Input Device are you using on
the 7280 Board?

Actually in the beginning I want to be sure that ixora board can communicate via MIPI-CSI interface so I am trying to run “ADV7280m” in free run mode.

Are you sure that the 7280 device
refers to /dev/video0? You should try
other devices video devices to be sure
that you are using the correct device.

This part is important I believe. Two steps applied and results are below:


Step 1 - detach ADV7280m

root@apalis-imx6:~# v4l2-ctl --list-devices
[   53.283539] ERROR: v4l2 capture: slave not found! V4L2_CID_HUE
[   53.289409] ERROR: v4l2 capture: slave not found! V4L2_CID_HUE
DISP3 BG ():[   53.296712] ERROR: v4l2 capture: slave not found! V4L2_CID_HUE

        /dev/video16
        /dev/video17

Failed to open /dev/video0: Resource temporarily unavailable


root@apalis-imx6:~# v4l2-ctl --all
[  132.314326] ERROR: v4l2 capture: slave not found! V4L2_CID_HUE
Failed to open /dev/video0: Resource temporarily unavailable

**Step 2 attach ADV7280m**
root@apalis-imx6:~# v4l2-ctl --list-devices
[   95.013113] ERROR: v4l2 capture: slave not found! V4L2_CID_HUE
 ():
        /dev/video0
        /dev/video16
        /dev/video17

root@apalis-imx6:~# v4l2-ctl --all
Driver Info (not using libv4l2):
	Driver name   : mxc_v4l2
	Card type     : 
	Bus info      : 
	Driver version: 0.1.11
	Capabilities  : 0x05000005
		Video Capture
		Video Overlay
		Read/Write
		Streaming
Video input : 1 (CSI MEM: no power)
Video output: 0 (DISP3 BG)
Video Standard = 0x00ffffff
	PAL-B/B1/G/H/I/D/D1/K/M/N/Nc/60
	NTSC-M/M-JP/443/M-KR
	SECAM-B/D/G/H/K/K1/L/Lc
Format Video Capture:
	Width/Height      : 720/576
	Pixel Format      : 'YU12'
	Field             : Any
	Bytes per Line    : 720
	Size Image        : 622080
	Colorspace        : Default
	Transfer Function : Default
	YCbCr Encoding    : Default
	Quantization      : Default
Format Video Overlay:
	Left/Top    : 0/0
	Width/Height: 160/160
	Field       : Any
	Chroma Key  : 0x00000000
	Global Alpha: 0x00
	Clip Count  : 0
	Clip Bitmap : No
Framebuffer Format:
	Capability    : Extern Overlay
	Flags         : Overlay Matches Capture/Output Size
	Width         : 0
	Height        : 0
	Pixel Format  : ''
Crop Capability Video Capture:
	Bounds      : Left 0, Top 0, Width 720, Height 625
	Default     : Left 0, Top 0, Width 720, Height 625
	Pixel Aspect: 0/0
Crop: Left 0, Top 0, Width 720, Height 625
Streaming Parameters Video Capture:
	Frames per second: 30.000 (30/1)
	Read buffers     : 0
Streaming Parameters Video Output:
	Frames per second: invalid (0/0)
	Write buffers    : 0

For the device tree, you should use
the standard Ixora device tree and do
adaptation to the dtb according to
your pinout.


Should I change the file "arch/arm/boot/dts/imx6qdl-apalis-ixora-v1.1.dtsi", what should be changed, I am only changing &mipi_csi lane=<2>; -> lane=<1>;. but no effect.

Could you provide the schematic of the
connection between Ixora and the
custom board and adv7280? What changes
have you done to the device tree and
kernel ( git diff)?


Actually I don’t know where to change, so let’s assume kernel is not modified.


Here is my connection diagram :

Hi
Thanks for the Information.

Thanks for your reply, just to be sure that we are on the same route, the board I am using is “ADV7282M” not “7280 board”.

Sorry for that. I saw in the dmesg log 7280 instead of 7282 that’s why I wrote this. Nevertheless you will need to modify the kernel and devicetree to enable 7282 and disable the 7280 since they have the same id.

May I know what is your application?

Best regards, Jaski

May I know what is your application?

the main purpose is to stream cvbs video input via wired ethernet interface:

cvbs video source → adv7282M → csi2 interface → ixora board → udpsink from gstreamer → watch the video from another computer


Because this is my first experience with linux kernel, I need generic information such as -where to start?

-which files to observe?

-will any driver written for adv7282m work on the toradex board, if not why?

Is it because kernel driver differences?

Or different hardware structures?

Let’s say a driver is written spesifically for this ixora board but for an older kernel version, May it work ?


Also I started doing some dirty stuff, I want to learn that am i doing things right ?

(1) on my host machine, I installed tftp server, and using serial interface I am succesfully loading images to ixora board.

setenv fdt_file=imx6q-apalis-ixora-v1.1.dtb
setenv serverip=192.168.1.31
saveenv

Apalis iMX6 # run setethupdate
Using FEC device
TFTP from server 192.168.1.31; our IP address is 192.168.1.99
Filename 'flash_eth.img'.
Load address: 0x12000000
Loading: *<0x08>##################################################  444 Bytes
	 39.1 KiB/s
done
Bytes transferred = 444 (1bc hex)
## Executing script at 12000000
Using FEC device
TFTP from server 192.168.1.31; our IP address is 192.168.1.99
Filename 'apalis_imx6/flash_eth.img'.
Load address: 0x12000000
Loading: *<0x08>##################################################  3.9 KiB
	 392.6 KiB/s
done
Bytes transferred = 4021 (fb5 hex)
## Executing script at 12000000
enter "run update" to update the entire module
Apalis iMX6 # run update
switch to partitions #1, OK
mmc0(part 1) is current device

MMC read: dev # 0, block # 138, count 1 ... 1 blocks read: OK
Using FEC device
TFTP from server 192.168.1.31; our IP address is 192.168.1.99
Filename 'apalis_imx6/u-boot.imx-spl'.
Load address: 0x12000000
Loading: *<0x08>##################################################  362.6 KiB
	 5.6 MiB/s
done
Bytes transferred = 371336 (5aa88 hex)
switch to partitions #1, OK
.
.
.


this seems like everything is ok, is it ?


(2) is modifying device tree like below correct ?

I’m using files below to modify device tree, for now what is modified is not important

arch/arm/boot/dts/imx6qdl-apalis-ixora-v1.1.dtsi

arch/arm/boot/dts/imx6qdl-apalis-ixora-v1.1.dts

my script file to apply modifications contains :

#!/bin/sh
kernelfile="imx6q-apalis-ixora-v1.1.dtb"
export ARCH=arm
export PATH=/home/selcuk/gcc-linaro/bin/:$PATH
export CROSS_COMPILE=arm-linux-gnueabihf-
make apalis_imx6_defconfig
rm -rf arch/arm/boot/dts/*.dtb
rm -rf /srv/tftp/apalis_imx6/${kernelfile}
make ${kernelfile}
cp arch/arm/boot/dts/*.dtb /srv/tftp/apalis_imx6/


(3) Lastly for writing a driver for “adv7282m”

I started modifying /home/selcuk/linux-toradex/drivers/media/platform/mxc/capture/adv7280.c
then I am using “make” command and I think it compiles all modules, then I use “scp” command to send the “adv7280_tvin.ko” file to my ixora board, after all using “modprobe adv7280_tvin”.

Is this a correct approach for installing a module, or could I bake it in to dts file?


I know I am asking too many questions, but I need to be sure for the steps to go on further.


Best wishes.

Hi

Because this is my first experience with linux kernel, I need generic information such as

In General, you need to read the Page Build U-Boot and Linux Kernel from Source Code, which explains you everything about building an customized kernel with your driver included. The driver is written for a kernel and an interface. To make it work with Toradex board, you need to understand the driver and do the needed adaptations for the Toradex board in driver and/or Device tree. You can check the file drivers/media/i2c/adv7180.c for the driver for adv7282.

Also I started doing some dirty stuff, I want to learn that am I doing things right ?

This is correct however you can also use the Toradex Easy Installer to flash an Image and just change the part in the image you want.

(2) is modifying device tree like below correct ?

Yeah, but this needs installing the of the device tree files on the module using the legacy update scripts. It is easier to use the Uboot UMS feature. Note: you need to connect USB Cable to X8 micro USB connector of Ixora and your Host.

Lastly for writing a driver for “adv7282m”

You need to deploy the kernel module as written here.

Best regards, Jaski