Post Go back to editing

ADV7842 CVBS to RGB Out

I've been using the AVES scripts for the ADV7842/AD7511 eval board to successfully setup up my custom ADV7842 board to handle analog RGB inputs.  I've moved onto CVBS (NTSC) inputs and I'm not having the same success.  I started with the 1-1e script (NTSC to 480i HDMI) and I was able to get video out of my board but the colors where all messed up.  Specifically, black is coming out as purple and white is coming out as a lime color.  As I dug into it I saw the script sets up the ADV7511 to accept YCrCb so the ADV7842 must output YCrCb.  However, the DVI Transmitter on my board only accepts RGB so I need the ADV7842 to output RGB as it did with the analog RGB input scripts.  I thought that should be as simple as switching 0x40 (IO) 0x02[1] from '0' to '1' but that seemed to have no impact.  I realize the analog RGB inputs use CP and the CVBS inputs use SDP but other than the register I just mentioned I don't see anything related to SDP color output specifically.

I've been analyzing scripts all day and I can't seem to figure out why the analog RGB input scripts work but the CVBS input scripts don't.  Do you have any ideas or things for me to check that might help me diagnose because I'm pretty stumped?

By the way, I tried disabling the 3D comb filter to take the SDRAM on my board out of the equation and it didn't resolve my issue.

Thanks,

Nathan

Parents
  • FormerMember
    0 FormerMember
on Aug 5, 2011 7:49 PM

Kevin, that script worked for me.

FYI, I found an error in the math for the SDP CSC example in the Hardware Manual for the ADV7842.  Lead to some of my confusion.  Specifically on page 168, SDP_A3 uses wrong coeffiicent and SDP_C3 has bad math.  Both problems lead to bad hex values.

  • Hello,

    I'm trying to get a NTSC 60Hz interlaced signal on CVBS convert it to progressive and get it at 24 bit 4:4:4 RGB.

    I'm working with this script:

    sudo i2cset -y 8 0x20 0xff 0xff #full reset
    sudo i2cset -y 8 0x20 0xf1 0x90 #SDP map
    sudo i2cset -y 8 0x20 0xf2 0x94 #SDPIO map
    sudo i2cset -y 8 0x20 0xf3 0x84 #AVLINK
    sudo i2cset -y 8 0x20 0xf4 0x80 #CEC
    sudo i2cset -y 8 0x20 0xf5 0x7c #INFOFRAME
    sudo i2cset -y 8 0x20 0xf8 0x4c #AFE
    sudo i2cset -y 8 0x20 0xf9 0x64 #KSV
    sudo i2cset -y 8 0x20 0xfa 0x6c #EDID
    sudo i2cset -y 8 0x20 0xfb 0x68 #HDMI
    sudo i2cset -y 8 0x20 0xfd 0x44 #CP
    sudo i2cset -y 8 0x20 0xfe 0x48 #VDP
    sudo i2cset -y 8 0x20 0x00 0x01 #VID_STD = SD 4x1 720x480i/576i CVBS
    sudo i2cset -y 8 0x20 0x01 0x00 #V_FREQ = 60Hz, PRIM_MODE = SDP Mode
    #sudo i2cset -y 8 0x20 0x02 0xF2 #RGB color space output
    sudo i2cset -y 8 0x20 0x03 0x4c #24-bit SDR 4:4:4 mode 3 out
    sudo i2cset -y 8 0x20 0x04 0x62 #op_ch_sel = 3
    sudo i2cset -y 8 0x20 0x0c 0x40 #power up all blocks
    sudo i2cset -y 8 0x20 0x15 0x90 #power up pads, Audio out = tristate
    sudo i2cset -y 8 0x20 0x19 0xC3 #LLC_DLL_EN = 1 LLC_DLL_DOUBLE = 1 DLL_PHASE = 0x03
    sudo i2cset -y 8 0x20 0x33 0x40 #LLC_DLL_MUX = 1
    sudo i2cset -y 8 0x20 0xde 0x90 #Manual 27Mhz output clock (undocumented)
    sudo i2cset -y 8 0x26 0x0c 0x1f #ADI recommended write
    sudo i2cset -y 8 0x26 0x12 0x63 #ADI recommended write
    sudo i2cset -y 8 0x26 0x00 0x0e #ADC0 power Up
    sudo i2cset -y 8 0x26 0x02 0x80 #Manual Mux
    sudo i2cset -y 8 0x26 0x03 0xb0 #Ain11
    sudo i2cset -y 8 0x4a 0x7a 0xa5 #Timing Adjustment 
    sudo i2cset -y 8 0x4a 0x7b 0x8f #Timing Adjustment
    sudo i2cset -y 8 0x4a 0x60 0x01 #SDRAM reset
    sudo i2cset -y 8 0x4a 0x97 0x00 #Hsync width Adjustment Adjustment
    sudo i2cset -y 8 0x4a 0xb2 0x60 #Disable AV codes
    sudo i2cset -y 8 0x48 0x00 0x7f #Autodetect PAL NTSC SECAM
    sudo i2cset -y 8 0x48 0x01 0x00 #Pedestal Off
    sudo i2cset -y 8 0x48 0x03 0xe4 #Manual VCR Gain Luma 0x40B
    sudo i2cset -y 8 0x48 0x04 0x0b #Manual Luma setting
    sudo i2cset -y 8 0x48 0x05 0xc3 #Manual Chroma setting 0x3FE
    sudo i2cset -y 8 0x48 0x06 0xfe #Manual Chroma setting
    sudo i2cset -y 8 0x48 0x12 0x09 #enable I2P, disable TBC, enable 3D comb.
    sudo i2cset -y 8 0x48 0xa7 0x00 #ADI Recommended Write
    #colorspace conversion NTSC to RGB:
    sudo i2cset -y 8 0x4A 0xB0 0x00 # Disable H and v blanking
    sudo i2cset -y 8 0x4A 0xE0 0x83 # Manual CSC mode CSC scaler = 2 A1[12:8]
    sudo i2cset -y 8 0x4A 0xE1 0xA7 # CSC coeff A1[7:0]
    sudo i2cset -y 8 0x4A 0xE2 0x1E # CSC coeff A2[12:8]
    sudo i2cset -y 8 0x4A 0xE3 0x91 # CSC coeff A2[7:0]
    sudo i2cset -y 8 0x4A 0xE4 0x1D # CSC coeff A3[12:8]
    sudo i2cset -y 8 0x4A 0xE5 0xE2 # CSC coeff A3[7:0]
    sudo i2cset -y 8 0x4A 0xE6 0x7D # CSC coeff A4[14:8]
    sudo i2cset -y 8 0x4A 0xE7 0x00 # CSC coeff A4[7:0]
    sudo i2cset -y 8 0x4A 0xE8 0x03 # CSC coeff B1[12:8]
    sudo i2cset -y 8 0x4A 0xE9 0xA7 # CSC coeff B1[7:0]
    sudo i2cset -y 8 0x4A 0xEA 0x07 # CSC coeff B2[12:8]
    sudo i2cset -y 8 0x4A 0xEB 0x61 # CSC coeff B2[7:0]
    sudo i2cset -y 8 0x4A 0xEC 0x00 # CSC coeff B3[12:8]
    sudo i2cset -y 8 0x4A 0xED 0x00 # CSC coeff B3[7:0]
    sudo i2cset -y 8 0x4A 0xEE 0x79 # CSC coeff B4[14:8]
    sudo i2cset -y 8 0x4A 0xEF 0x00 # CSC coeff B4[7:0]
    sudo i2cset -y 8 0x4A 0xF0 0x03 # CSC coeff C1[12:8]
    sudo i2cset -y 8 0x4A 0xF1 0xA7 # CSC coeff C1[7:0]
    sudo i2cset -y 8 0x4A 0xF2 0x00 # CSC coeff C2[12:8]
    sudo i2cset -y 8 0x4A 0xF3 0x00 # CSC coeff C2[7:0]
    sudo i2cset -y 8 0x4A 0xF4 0x04 # CSC coeff C3[12:8]
    sudo i2cset -y 8 0x4A 0xF5 0x29 # CSC coeff C3[7:0]
    sudo i2cset -y 8 0x4A 0xF6 0x79 # CSC coeff C4[14:8]
    sudo i2cset -y 8 0x4A 0xF7 0x00 # CSC coeff C4[7:0]

    I followed all tips of this topic, and the better image I can get was:

    I think it's almost done, but some gray tones becomes pink or something like that.

    Can anyone adjust my script to do this conversion correctly?

    Thanks!

  • Hi,

     It seems you are using 27MHz crystal instead of that use 28.6363MHz  - Use the correct frequency crystal, which is 28.6363 MHz ( ADV7842 uses a 28.6363MHz crystal) .

     Incase If you can't change the OP_CH_SEL then you can swap CSC_B and CSC_C values when you program the CSC. The SDP has a separate color space converter for CVBS/S-video inputs.  It's generally only used for Brightness/Contrast type adjustments since SD is normally YCbCr in and out. You can manually use the CSC as well, the same as shown in section 7.22.7 of the Hardware manual.

    Thanks,

    Poornima

  • Hi,

    Thanks for you reply.

    Why did you said I'm using a 27MHz crystal? I looked at schematic and we are using the 28.6363MHz:

    Is it because of this line?:

    sudo i2cset -y 8 0x20 0xde 0x90 #Manual 27Mhz output clock (undocumented)

    I got it from ADI scripts: /cfs-file/__key/communityserver-discussions-components-files/331/7725.ADV7842_5F00_Evaluation_5F00_Board_5F00_Documents.zip

    And I can't find this reg 0xde of IO anywhere.

    Should I remove it?

    I didn't understand why I need to change OP_CH_SEL, the value selected based on our hardware design.

  • Hi,

     Yes, its not documented but its configured in script, so remove that configuration. 

     Instead of configure the pixel data pins using register 0x04(OP_CH_SEL), just swap CSC_B and CSC_C.

    Thanks,

    Poornima

  • Sorry, I can't understand. Why I need to swap between B and C? will it swap de colors RED and BLUE?

    Our hardware is designed this way:

    Thanks!

  • Hi,

     Have you tried Table 36 on Page107 of 0552.ADV7441A_HW_RevJ.pdf ? These CSC coefficients should work fine for CVBS to RGB conversation.

    ADV7842 is basically a serial to parallel converter(even for analog input), what comes in goes out.
    Have you tried with other sources ?

    Gray noise may caused due to the processor side also.Have you verified output at ADV7842 before it passing to the processor ?

    Thanks,

    Poornima

  • Reply Children
    • Yes I tried with table 36 and got this:

      CSC Mode = 0001:

      CSC Mode = 0011

      No, I didn't tested with other source, but I have a ADV7280 on same board with CVBS input too, and the camera works fine on it, but it convert from CVBS to CSI directly

      The video patch is ADV7842 -> TFP410 -> ADV7482 -> Jetson TX2, I can put colorbars on 7482 and it's ok on Jetson, then I put full color screen on ADV7842 (it don't have colorbar at HD or fullHD resolution) and it's ok (I changed the R, G and B values by hand and colors are ok on screen).

    • Hi,

       Pink usually means when color space is wrong.

       Just turn off the color space. Lets check how the result would be.

      Thanks,

      Poornima

    • Do you mean turn-off the color space conversion?

    • Hi,

        Yes, turn off the color space conversation. This configuration is enough - 0x20 0x02 0xF2 #RGB color space out.

        Above configuration was RGB full range,

        Readback the HDMI map(Addr 68), 0x53 - 0x00 for RGB limited and for full range the register will read 0x01, according to that set your input source . This register - 0x53( Readback of the HDMI input color space decoded from several fields in the AVI InfoFrame) is available to check whether RGB limited or full range coming from the source.

      Thanks,

      Poornima

    • Hi,

      I turned off the csc and tested all values to 0x02 (INP_COLOR_SPACE) register from 0 to 7, with the same results:

      tThe register 0x53 from HDMI returns 0x00 but the input is CVBS, HDMI block can do something in this configuration?

    • Hi,

       Please try to change the CSC setting as auto and check automatic CSC for the SDP path.
       SDP_CSC_AUTO to 0 for manual and 1 for automatic.

      Thanks,

      Poornima

    • It's already turned off, if I turn it on the image goes to a almost dark image with some pink spots.

    • Hi,

       As i already stated 'ADV7842 is an basically a serial to parallel converter(even for analog input), what comes in goes out".
      Is it possible you to check the output of ADV7842 ? To confirm whether the problem is from either ADV7842 or Processor side.

      Thanks,

      Poornima

    • Hi,

      I have two of these ADV7842 on my board, with the same chain (ADV7842 -> isolation -> TFP410 -> ADV7482 -> TX2) these IC are u43 and u53.

      The diference is the input:

      U43 has DVI and CVBS inputs conected

      U53 has DVI and VGA inputs conected

      On u53 I can get a XGA input through vga port with correct colors.

      Now I'm trying to get CVBS input working on u43, but I'm getting the problems above...

      Trying to test if all is correct on chain after ADV7842's ic's I generate colorbars on both u43 and u53, but the result are different:

      Left = u43

      Right = u53

      The script I used is the "best" I have until now:

      sudo i2cset -y 8 0x20 0xff 0xff #full reset
      sudo i2cset -y 8 0x20 0xf1 0x90 #SDP map
      sudo i2cset -y 8 0x20 0xf2 0x94 #SDPIO map
      sudo i2cset -y 8 0x20 0xf3 0x84 #AVLINK
      sudo i2cset -y 8 0x20 0xf4 0x80 #CEC
      sudo i2cset -y 8 0x20 0xf5 0x7c #INFOFRAME
      sudo i2cset -y 8 0x20 0xf8 0x4c #AFE
      sudo i2cset -y 8 0x20 0xf9 0x64 #KSV
      sudo i2cset -y 8 0x20 0xfa 0x6c #EDID
      sudo i2cset -y 8 0x20 0xfb 0x68 #HDMI
      sudo i2cset -y 8 0x20 0xfd 0x44 #CP
      sudo i2cset -y 8 0x20 0xfe 0x48 #VDP
      sudo i2cset -y 8 0x20 0x00 0x01 #VID_STD = SD 4x1 720x480i/576i CVBS
      sudo i2cset -y 8 0x20 0x01 0x00 #V_FREQ = 60Hz, PRIM_MODE = SDP Mode
      #sudo i2cset -y 8 0x20 0x02 0xF2 #RGB color space output
      sudo i2cset -y 8 0x20 0x03 0x4c #24-bit SDR 4:4:4 mode 3 out
      sudo i2cset -y 8 0x20 0x04 0x62 #op_ch_sel = 3
      sudo i2cset -y 8 0x20 0x0c 0x40 #power up all blocks
      sudo i2cset -y 8 0x20 0x15 0x90 #power up pads, Audio out = tristate
      sudo i2cset -y 8 0x20 0x19 0xC3 #LLC_DLL_EN = 1 LLC_DLL_DOUBLE = 1 DLL_PHASE = 0x03
      sudo i2cset -y 8 0x20 0x33 0x40 #LLC_DLL_MUX = 1
      #sudo i2cset -y 8 0x20 0xde 0x90 #Manual 27Mhz output clock (undocumented)
      sudo i2cset -y 8 0x26 0x0c 0x1f #ADI recommended write
      sudo i2cset -y 8 0x26 0x12 0x63 #ADI recommended write
      sudo i2cset -y 8 0x26 0x00 0x0e #ADC0 power Up
      sudo i2cset -y 8 0x26 0x02 0x80 #Manual Mux
      sudo i2cset -y 8 0x26 0x03 0xb0 #Ain11
      sudo i2cset -y 8 0x4a 0x7a 0xa5 #Timing Adjustment 
      sudo i2cset -y 8 0x4a 0x7b 0x8f #Timing Adjustment
      sudo i2cset -y 8 0x4a 0x60 0x01 #SDRAM reset
      sudo i2cset -y 8 0x4a 0x97 0x00 #Hsync width Adjustment Adjustment
      sudo i2cset -y 8 0x4a 0xb2 0x60 #Disable AV codes
      sudo i2cset -y 8 0x48 0x00 0x7f #Autodetect PAL NTSC SECAM
      sudo i2cset -y 8 0x48 0x01 0x00 #Pedestal Off
      sudo i2cset -y 8 0x48 0x03 0xe4 #Manual VCR Gain Luma 0x40B
      sudo i2cset -y 8 0x48 0x04 0x0b #Manual Luma setting
      sudo i2cset -y 8 0x48 0x05 0xc3 #Manual Chroma setting 0x3FE
      sudo i2cset -y 8 0x48 0x06 0xfe #Manual Chroma setting
      sudo i2cset -y 8 0x48 0x12 0x09 #enable I2P, disable TBC, enable 3D comb.
      sudo i2cset -y 8 0x48 0xa7 0x00 #ADI Recommended Write
      #colorspace conversion NTSC to RGB:
      sudo i2cset -y 8 0x4A 0xB0 0x00 # Disable H and v blanking
      sudo i2cset -y 8 0x4A 0xE0 0x83 # Manual CSC mode CSC scaler = 2 A1[12:8]
      sudo i2cset -y 8 0x4A 0xE1 0xA7 # CSC coeff A1[7:0]
      sudo i2cset -y 8 0x4A 0xE2 0x1E # CSC coeff A2[12:8]
      sudo i2cset -y 8 0x4A 0xE3 0x91 # CSC coeff A2[7:0]
      sudo i2cset -y 8 0x4A 0xE4 0x1D # CSC coeff A3[12:8]
      sudo i2cset -y 8 0x4A 0xE5 0xE2 # CSC coeff A3[7:0]
      sudo i2cset -y 8 0x4A 0xE6 0x7D # CSC coeff A4[14:8]
      sudo i2cset -y 8 0x4A 0xE7 0x00 # CSC coeff A4[7:0]
      sudo i2cset -y 8 0x4A 0xE8 0x03 # CSC coeff B1[12:8]
      sudo i2cset -y 8 0x4A 0xE9 0xA7 # CSC coeff B1[7:0]
      sudo i2cset -y 8 0x4A 0xEA 0x07 # CSC coeff B2[12:8]
      sudo i2cset -y 8 0x4A 0xEB 0x61 # CSC coeff B2[7:0]
      sudo i2cset -y 8 0x4A 0xEC 0x00 # CSC coeff B3[12:8]
      sudo i2cset -y 8 0x4A 0xED 0x00 # CSC coeff B3[7:0]
      sudo i2cset -y 8 0x4A 0xEE 0x79 # CSC coeff B4[14:8]
      sudo i2cset -y 8 0x4A 0xEF 0x00 # CSC coeff B4[7:0]
      sudo i2cset -y 8 0x4A 0xF0 0x03 # CSC coeff C1[12:8]
      sudo i2cset -y 8 0x4A 0xF1 0xA7 # CSC coeff C1[7:0]
      sudo i2cset -y 8 0x4A 0xF2 0x00 # CSC coeff C2[12:8]
      sudo i2cset -y 8 0x4A 0xF3 0x00 # CSC coeff C2[7:0]
      sudo i2cset -y 8 0x4A 0xF4 0x04 # CSC coeff C3[12:8]
      sudo i2cset -y 8 0x4A 0xF5 0x29 # CSC coeff C3[7:0]
      sudo i2cset -y 8 0x4A 0xF6 0x79 # CSC coeff C4[14:8]
      sudo i2cset -y 8 0x4A 0xF7 0x00 # CSC coeff C4[7:0]

      And to change it to color bars:

      sudo i2cset -y 8 0x48 0xDD 0XBF

      Now, if I change the CSC values or turn it on or off it has no effect on color bars.

      My questions are:

      1 - Do you know if the color bars are generated after CSC?

      2 - How can I know if the ADV7842 is generating color-bar output in RGB 4:4:4 with 8 bit per color?

      Thanks

    • Hi,

       Are you sure, you giving the CVBS input to AIN pin ? Analog input pin can be provided only through AIN pins.

       Your schematic connection seems AIN pin got disconnected at https://ez.analog.com/video/f/q-a/167725/adv7842-wrong-colors-on-hdmi-input

      Thanks,

      Poornima