ADV7280M Special Effect

Dear All,

I’m integrating the ADV7280M driver from the very-long and well-known thread into Jetson Xavier NX. I could visualize image on stream but there’s certain effect as below in both PAL and NTSC modes :

Notes :

  • Smaller display is direct output of analog camera,
  • Bigger display is output of ADV7280-M with gst-launch-1.0 v4l2src device=/dev/video1 ! xvimagesink command

It also happen if I maually set the ADV7280M’s registers with following modes :
##CVBS AUTODETECT##

:AUTODETECT CVBS Single Ended In Ain 1, MIPI Out:
delay 10 ; 
42 0F 00 ; Exit Power Down Mode
42 00 00 ; INSEL = CVBS in on Ain 1
42 0E 80 ; ADI Required Write 
42 9C 00 ; ADI Required Write 
42 9C FF ; ADI Required Write 
42 0E 00 ; Enter User Sub Map	 
42 03 4E ; ADI Required Write 
42 04 57 ; Power-up INTRQ pin
42 13 00 ; Enable INTRQ output driver
42 17 41 ; select SH1
42 1D C0 ; Tri-State LLC output driver
42 52 CD ; ADI Required Write
42 80 51 ; ADI Required Write
42 81 51 ; ADI Required Write
42 82 68 ; ADI Required Write
42 FE 88 ; Set CSI Map Address
88 DE 02 ; Power up MIPI D-PHY
88 D2 F7 ; ADI Required Write
88 D8 65 ; ADI Required Write
88 E0 09 ; ADI Required Write 
88 2C 00 ; ADI Required Write
88 00 00 ; Power up MIPI CSI-2 Tx
End

##CVBS Autodetect, Progressive Out##

:I2P AUTODETECT CVBS Single Ended In Ain 1, 480p/576p MIPI Out:
delay 10 ; 
42 0F 00 ; Exit power down mode
42 00 00 ; INSEL = CVBS in on Ain 1
42 0E 80 ; ADI Required Write 
42 9C 00 ; ADI Required Write 
42 9C FF ; ADI Required Write 
42 0E 00 ; Enter User Sub Map
42 03 4E ; ADI Required Write
42 04 57 ; Enable Intrq pin
42 13 00 ; Enable INTRQ output driver
42 17 41 ; select SH1
42 1D C0 ; Tri-State LLC output driver
42 52 CD ; ADI Required Write
42 80 51 ; ADI Required Write
42 81 51 ; ADI Required Write
42 82 68 ; ADI Required Write
42 FD 84 ; Set VPP Map Address
84 A3 00 ; ADI Required Write
84 5B 00 ; Advanced Timing Enabled
84 55 80 ; Enable I2P
42 FE 88 ; Set CSI Map Address
88 01 20 ; ADI Required Write
88 02 28 ; ADI Required Write
88 03 38 ; ADI Required Write
88 04 30 ; ADI Required Write
88 05 30 ; ADI Required Write
88 06 80 ; ADI Required Write
88 07 70 ; ADI Required Write
88 08 50 ; ADI Required Write
88 DE 02 ; Power up D-PHY
88 D2 F7 ; ADI Required Write
88 D8 65 ; ADI Required Write
88 E0 09 ; ADI Required Write
88 2C 00 ; ADI Required Write
88 1D 80 ; ADI Required Write 
88 00 00 ; Power up CSI Block 
End

##CVBS FAST Switch##

:Fast Switch CVBS Single Ended In Ain 1, MIPI Out:
delay 10 ;
42 0F 00 ; Exit Power Down Mode
42 00 00 ; INSEL = CVBS in on Ain 1
42 0E 80 ; ADI Required Write
42 9C 00 ; ADI Required Write
42 9C FF ; ADI Required Write
42 0E 00 ; Enter User Sub Map
42 03 4E ; ADI Required Write
42 04 57 ; Power-up INTRQ pin
42 13 00 ; Enable INTRQ output driver
42 17 41 ; select SH1
42 1D C0 ; Tri-S LLC output driver
42 52 CD ; ADI Required Writes
42 80 51 ; ADI Required Writes 
42 81 51 ; ADI Required Writes 
42 82 68 ; ADI Required Writes 
42 0E 80 ; ADI Required Writes
42 D9 44 ; ADI Required Writes
42 0E 00 ; ADI Required Writes
42 0E 40 ; Select User Sub Map 2
42 E0 01 ; Select fast Switching Mode
42 0E 00 ; Select User Map
42 FE 88 ; Set CSI Map Address
88 DE 02 ; Power up D-Phy
88 D2 F7 ; ADI Required Writes
88 D8 65 ; ADI Required Writes
88 E0 09 ; ADI Required Writes
88 2C 00 ; ADI Required Writes
88 00 00 ; Power up CSI Tx
End

##CVBS Fast Switch I2P##

:I2P FAST SWITCH Single Ended In Ain1, MIPI 480p/576p Out:
delay 10 ; 
42 0F 00 ; Exit Power Down Mode
42 00 00 ; INSEL = CVBS in on Ain 1
42 0E 80 ; ADI Required Write
42 9C 00 ; ADI Required Write
42 9C FF ; ADI Required Write
42 0E 00 ; Enter User Sub Map
42 03 4E ; ADI Required Write
42 04 57 ; Power-up INTRQ pad 
42 13 00 ; Enable INTRQ output driver
42 17 41 ; select SH1
42 1D C0 ; Tri-S LLC output driver
42 52 CD ; ADI Required Writes
42 80 51 ; ADI Required Writes
42 81 51 ; ADI Required Writes
42 82 68 ; ADI Required Writes
42 0E 80 ; ADI Required Writes
42 D9 44 ; ADI Required Writes
42 0E 00 ; ADI Required Writes
42 0E 40 ; Select User Sub Map 2
42 E0 01 ; Select fast Switching Mode
42 0E 00 ; Select User Map
42 FD 84 ; Set VPP Map
84 A3 00 ; ADI Required Writes
84 5B 00 ; Enable advanced timing
84 55 80 ; Enable the Deinterlacer for I2P
42 FE 88 ; Set CSI Map Address
88 01 20 ; ADI Required Writes
88 02 28 ; ADI Required Writes
88 03 38 ; ADI Required Writes
88 04 30 ; ADI Required Writes
88 05 30 ; ADI Required Writes
88 06 80 ; ADI Required Writes
88 07 70 ; ADI Required Writes
88 08 50 ; ADI Required Writes
88 DE 02 ; Power up D-Phy
88 D2 F7 ; ADI Required Writes
88 D8 65 ; ADI Required Writes
88 E0 09 ; ADI Required Writes
88 2C 00 ; ADI Required Writes
88 1D 80 ; ADI Required Writes
88 00 00 ; Power up CSI Tx

End

Thanks and best regards,
K.

hello khang.l4es,

it looks like alignment issue, could you please follow VI’s 64 byte aligned to set the correct stride,
you may use v4l2-ctl command to adjust the stride by --preferred_stride=<>.
thanks

Hi @JerryChang,

Thanks for your quick reply. I would like to know if there’s similar option in GStreamer command, please ?

Best Regards,
K.

this only available for v4l2-ctl.

may I know what’s your image resolution, how about cropping the image for verification.

Hi @JerryChang,

The output of the in-testing analog camera is NTSC (720480)/PAL (720576) Switchable.

Best Regards,
K.

Dear @JerryChang,

It looks like my issue is similar to this : Adv7282am dubole image

You also advised a patch to add interlace support for VI4 of TX2 : Adv7282am dubole image - #12 by JerryChang

I would like to know if there’s similar patch for other platform such as the Xavier NX, please ?

I also attach the trace during streaming.
trace_while_streaming.log (1.8 MB)

Thanks and Best Regards,
K.

hello khang.l4es,

could you please confirm this video content is interlaced.
currently, de-Interlacer is not supported on Xavier/r32.6.1 release.

Hi @JerryChang,

I confirm that the video content is in progressive mode with the built-in de-interlacer (Interlace to Progressive - I2P) of ADV7280-M enabled. Also, I’m using r32.5.1 release.

Regarding back to the attached images in initial post, it looks like image data is shifted vertically.

Best Regards,
K.

Hi,
Please execute v4l2-ctl command to capture a frame and check if it is good or not. The reference command is
Is there a way to capture with v4l2-ctl using tx2's onboard camera, ov5693? It's in BG10 format, but how do I check if the raw image comes out? - #3 by ShaneCCC

If you can capture good frames in v4l2-ctl, it should work well in gstreamer or other high level applications.

Dear @DaneLLL ,

What should I use for the pixelformat of v4l2-ctl command seeing that the format of the device is as below :

nvidia~$ v4l2-ctl --device /dev/video1 --all
Driver Info (not using libv4l2):
	Driver name   : tegra-video
	Card type     : vi-output, adv7280 8-0020
	Bus info      : platform:15c10000.vi:4
	Driver version: 4.9.201
	Capabilities  : 0x84200001
		Video Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (Camera 4: ok)
DV timings:
	Active width: 0
	Active height: 0
	Total width: 0
	Total height: 0
	Frame format: progressive
	Polarities: -vsync -hsync
	Pixelclock: 0 Hz
	Horizontal frontporch: 0
	Horizontal sync: 0
	Horizontal backporch: 0
	Vertical frontporch: 0
	Vertical sync: 0
	Vertical backporch: 0
	Standards: 
	Flags: 
Format Video Capture:
	Width/Height      : 720/576
	Pixel Format      : 'UYVY'
	Field             : Alternating
	Bytes per Line    : 1440
	Size Image        : 829440
	Colorspace        : SMPTE 170M
	Transfer Function : Default (maps to Rec. 709)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Limited Range)
	Flags             : 

User Controls

                     brightness 0x00980900 (int)    : min=-128 max=127 step=1 default=0 value=0 flags=slider
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=128 value=128 flags=slider
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=128 value=128 flags=slider
                            hue 0x00980903 (int)    : min=-127 max=128 step=1 default=0 value=0 flags=slider
                 fast_switching 0x00981970 (bool)   : default=0 value=0

Camera Controls

           sensor_configuration 0x009a2032 (u32)    : min=0 max=0 step=0 default=0 flags=read-only, volatile, has-payload
         sensor_mode_i2c_packet 0x009a2033 (u32)    : min=0 max=0 step=0 default=0 flags=read-only, volatile, has-payload
      sensor_control_i2c_packet 0x009a2034 (u32)    : min=0 max=0 step=0 default=0 flags=read-only, volatile, has-payload
                    bypass_mode 0x009a2064 (intmenu): min=0 max=1 default=0 value=0
                override_enable 0x009a2065 (intmenu): min=0 max=1 default=0 value=0
                   height_align 0x009a2066 (int)    : min=1 max=16 step=1 default=1 value=1
                     size_align 0x009a2067 (intmenu): min=0 max=2 default=0 value=0
               write_isp_format 0x009a2068 (int)    : min=1 max=1 step=1 default=1 value=1
       sensor_signal_properties 0x009a2069 (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
        sensor_image_properties 0x009a206a (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
      sensor_control_properties 0x009a206b (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
              sensor_dv_timings 0x009a206c (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
               low_latency_mode 0x009a206d (bool)   : default=0 value=0
               preferred_stride 0x009a206e (int)    : min=0 max=65535 step=1 default=0 value=0
                   sensor_modes 0x009a2082 (int)    : min=0 max=30 step=1 default=30 value=30 flags=read-only

Best Regards,
Khang.

Hi,
Please try

--set-fmt-video=width=720,height=576,pixelformat=uyvy

Hi @DaneLLL ,

Thanks for the instruction, here is the command I used :

$ v4l2-ctl --set-fmt-video=width=720,height=576,pixelformat=uyvy --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=runcam_split4_720x576.yuv -d /dev/video1

But I still have the same effect as gstreamer :

I believe that the issue does not relate to the Analog Frontend of the ADV7280-M since I excludes the input camera by capturing the Test Pattern and same symptom also occurs :

Best Regards,
K.

Hi,
It should be an issue in sensor driver or device tree. Certain parameters for timing would need to fine tuned, to capture good frames through v4l2-ctl

Hi @DaneLLL ,
I will investigate more the driver.

Thanks and Best Regards,
K.

Hi @DaneLLL , @JerryChang , CC @ShaneCCC ,

While I haven’t found any problem in the driver (compare to the reference scripts from Analog Device for predefined modes), I found similar issue on TX2 in ADV7280-M capture problem which was resolved by the following patch : Video For Linux (V4L) issue for onboard OV5693

The mentioned patch seems to be applied in r32.5.1, I tried with –set-ctrl preferred_stride=256, 720 or 1440 but the output was the same.

@ShaneCCC also recommended to modify :#define RM_SURFACE_ALIGNMENT 256 in vi4_fops.c but it was for TX2. How could I proceed with Xavier NX, please ?

Best Regards,
K.

hello khang.l4es,

how about simply hacking the image resolution as 736x576. you may adjust active_w to have quick testing.

Hi @JerryChang ,

I solved the issue with a suitable preferred stride value :

Thanks for your support,
K.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.