RGB Scart

From MythTV Official Wiki
Revision as of 10:19, 9 July 2012 by Eoin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Wikipedia-logo-en.png
Wikipedia has an article on:


Warning

Warning.png Warning: As these types of cables are directly driving the television, there exists potential for damage through mistakes in cabling or even sending an out-of-spec signal to the television. Consider yourself warned and proceed at your own risk.


Foreword

This guide is dedicated to all UK GAME employees.

Me: "Have you any proper scart cables?"
Employee: "There's one included."
Me: "That's a composite over scart converter."
Employee: "They're all the same."
Me: "No they're not, you see RGBs is not composite sync, and a scart can cary s-video, etc..."
Employee: "They're all the same."
Me: "Err... ok then."

Introduction

End on view of metal, mis-shaped rectagular data plug with 20 vertical blade pins, housed in plastic case.
SCART plug (male).

SCART is a European standard for connecting audio-visual equipment together. Different methods of transmitting video such as composite, Y/C (S-video) and RGB are supported on the same cable. The RGB method of transmission is of particular interest as it uses Red, Green, Blue and Composite Sync pins, which is very close to the way signal is carried over a VGA cable, Red, Green, Blue, Horizontal Sync and Vertical Sync. This makes is possible to adapt a VGA output to drive a RGB-capable SCART television directly.

The RGB signals in VGA and the RGB signals found in a SCART connector are electrically compatible, but the sync signals aren't. In VGA the vertical sync and horizontal sync are carried on separate wires, but in SCART they are both combined into a composite sync signal carried along a single wire. You need to convert the component sync signals into a composite sync compatible with SCART. The red, green and blue signals can be connected through as-is.

Advantages

Driving a TV directly has some advantages. The quality is superior to composite or S-video, and as the video card's TV encoder is completely bypassed, custom resolutions and refresh rates can be programmed. On the down side, this method can require some experimentation to get right.

  1. You get to fiddle with all the timings yourself by programming your VGA card (e.g. setting modelines in X), so you can set exactly how much overscan the picture has.
  2. One-to-one relationship between the lines - if you run your graphics card in 800x600 and then use the TV output, the card needs to scale the picture down (576 lines for PAL). So either some of the lines get blurred together or some of the lines don't get drawn at all. If you're really unlucky then the graphics card won't pay attention to interlacing and it'll blend some of the odd lines into even lines. If you drive the graphics card at the native PAL specification and feed the signal straight into the TV then you can guarantee that each even line in the framebuffer will match up with exactly one line in the even field on the screen and every odd line will match exactly one line in the odd field.
  3. VBI sync - your graphics card can tell the software when the vertical blanking interval has started so the software can synchronise video playback, etc with the TV so you don't get tearing.
  4. RGB output - graphics cards generally give you composite and S-Video outputs. If your TV will accept RGB then use it and get a better quality picture.

Requirements

  • A television with an RGB capable SCART socket. Just the presence of a SCART socket does not mean the television accepts RGB, as it will also accept a composite over SCART image. Check the manual, or try changing between Composite and RGB output on a SCART connected device to see if there is any change in image quality (the yellows will be noticeably more vibrant in RGB mode).
  • A video card and drivers capable of supporting interlaced resolutions - some don't, notably early versions of the official nVidia drivers for Linux are broken and won't let you turn on interlacing.
  • A video card capable of supporting a very low dot-clock frequency (14.76 MHz for PAL, 13.34 MHz for NTSC.)
  • With Nvidia cards, you must tell your graphics card to use negative vsync and hsync polarities.
  • You need to be able to tell your graphics card to use your own resolutions and timings - if you're running Windows you should try using Powerstrip. See below for suitable modelines.
  • Some TVs need pin 16 of the SCART connector driven high (powered with 1 to 3V) to enable the input. You can check this by blocking pin 16 (with some electrical tape) on a seperate RGB device; if the output changes to composite or no image with pin 16 blocked, your TV needs 16 driven high. You could pull power from the keyboard connector, connect up a 1.5V battery, etc. Bob van Loosen has provided a circuit which derives the required voltage from the vsync pin.

VGA Cable

One of the main components is a VGA male connector. Unless you want to solder individual wires to an unwired connector, you can make life easy on yourself by using a normal VGA cable, cutting it in half or off the end of an old monitor. If the latter, take the monitor apart before hand as the wires should be exposed inside and you can just snip them off the solder points so you don't have to worry about stripping them later. But presumably you have loads of those double male ended VGA cables lying around that came free with your LCD (and you used the DVI, didn't you?).

Whichever you use, the first thing you need to do is figure out which wires correspond with which pin; not an easy task as there's no standard colouring. If you cut one in half, start by just looking. You should see three larger cables with their own shields around the center, these may well be coloured red, green and blue, though you may find one or more coloured differently. Anyway, these are your RGB cables (pins 1, 2, 3 with grounds 6, 7, 8).

Now you need to find HSync, VSync and Sync Ground. If yours are anything like mine, you should have a bunch of four or five smaller cables to one side of the VGA cable, coloured something like brown, white, yellow, black, maybe red. You'll have to check for continuity to make sure, but if it's anything like mine then White will be HSync (pin 13), yellow (or a smaller white) VSync (pin 14), and black Sync Ground (pin 5/10).

But to make sure, you need to test them all for continuity. If you have a multimeter, great. If not, you can connect a couple wires to a battery then find an electrical device with a low amperage draw and try to power it through various pins on the VGA cable. I used a 40mm computer fan and 9V battery as I had a 9v connecter spare and the fan had nice small pointy wires to poke in to pins and other wires.

Anyway, once you're figured out what goes where, make a note and continue...

Required Reading

If you're planning on making any of the below cables then you should farmiliarise yourself with both the Scart pinout and VGA pinout, along with a good understanding of configuring xorg.conf under Linux (or use of Powerstrip under Windows).

Cable types

These fall into two groups. Some Radeon video cards are capable of generating composite sync directly and therefore need only a simple cable connecting the pins together. All other cards require a small circuit to convert the horizontal/vertical sync into composite sync. You can tell the circuits apart by the fact that the more complex version will have at least one transistor.

ATI Cable

As the ATI Radeon cards should be able to output composite sync directly, the cable is very simple and requires no more than a single resistor between two pins along with the correct wiring pinout. Matrox G and Millenium series cards are also capable of generating composite sync, so this cable works with them as-is.

An untested guide for this is available at http://ryoandr.free.fr/english.html , with the pinout being as below:

VGA 	SCART 	Function
1 	15 	Red
2 	11 	Green
3 	7 	Blue
6 	13 	Red ground
7 	9 	Green ground
8 	5 	Blue ground
9 	8 	AV Commutation (+5V)
9 	16 	RGB Commutation
10 	17 	Composite sync ground
13 	20(19) 	Composite sync

A 75 Ohm resistor should connect pins 8 and 16 on the scart.

Note that the power from pin 9 to scart 8 is only needed for resolution mode switching (4:3 or 16:9) and probably isn't needed for most standard def TVs, and the resistor between 9 and 16 supposedly drops the 5v voltage to between 1V and 3V which is needed to enable RGB Scart mode on some TVs. In other words, you may only need to connect pin 9 to pin 16, or not even that if your TV can be manually switched between RGB and Composite input on the scart socket or if you use an alternate method of providing 1V - 3V on pin 16 (a 1.5v battery works wonders but isn't permanent...). If you are sure that your circuit is correct, but are still getting nothing but a blank screen, try providing the correct voltage to SCART pin 8, as some TVs require this.

Optionally you could connect VGA pin 13 to SCART pin 20 via a 75 Ohm resistor:

Depending on TV make and VGA buffers used, it could happen that the sync signal causes some reflections in the image. Connecting it via 75 Ohm (like the other video signals) removes this reflection.

Nvidia Cable

The complicated one ;o) Most information below is taken directly from Steve Hall's guide at http://www.nexusuk.org/projects/vga2scart/ .

As Nvidia cards have no option for outputting a composite sync, you need to create a small circuit that combines both the Horizontal and Vertical sync from the VGA port in to a Composite sync for the Scart. The schematic for this circuit is below:

Sync Converter Schematic

The components referenced in the schematic (R = Resistor, Q = Transistor) are:

Component  Type

R1 	   3.3 Kilohms (3k3)
R2 	   1.2 Kilohms (1k2)
R3 	   820 Ohms
R4 	   68 Ohms
Q1 	   BC548B

Note that most general purpose NPN transistors will work in place of Q1.


The vga to scart connections then needed are:

Function 	 VGA 	Converter 	Scart (Male) 	Scart (Female)
Red 	 	 1 	 	 	15 	 	15
Green  		 2 	 	 	11 	 	11
Blue  		 3 	 	 	7 	 	7
Red Ground 	 6 	 	 	13 	 	13
Green Ground  	 7 	 	 	9 	 	9
Blue Ground 	 8 	 	 	5 	 	5
VSync 	 	 14 	VSync
HSync 	 	 13 	HSync
Sync Ground 	 10 	Gnd 	 	17 	 	17
CSync 	 	 	CSync 	 	20 	 	19

This circuit does no frequency conversion or scaling, etc. so your graphics card must output a signal at PAL or NTSC specification if your TV is going to have any chance of syncing with it. If you see 2 images side by side then your graphics card is outputting a standard VGA signal and your TV just happens to be syncing with every other sync pulse (the horizontal sync in VGA runs at exactly twice the frequency of PAL).

Video cards

Cards known to support interlaced resolutions and TV frequency dot clocks
Name Interlacing? <15 MHz dot clock?
nVidia GT240 YES NO (X will accept modelines and start, but no picture)
nVidia 7800 GS YES  ?
nVidia 7600 GT YES YES
nVidia 7600 GS YES YES
nVidia 8500 GT YES  ?
nVidia FX 5200 series YES † YES
nVidia GeForce4 MX YES YES
nVidia GeForce 6200 TC YES YES
nVidia GeForce 2 MX 200 PROBLEMS YES
ATI Radeon 9000 YES ‡ YES
ATI Radeon 9100 IGP YES YES
ATI Radeon X1250 IGP YES ‡ YES
ATI HD3200 IGP YES ‡ YES
ATI Radeon 8000 series
ATI Radeon 7500 YES YES
ATI Radeon X300SE
(RV370 - Dell Optiplex GX280)
YES YES
ATI Rage 128VR (PCI) YES YES
Matrox G200 AGP YES YES
Matrox Millenium II PCI
(Compaq OEM)
YES YES
Via Unichrome IGP
Intel GMA950 YES ˆ YES

† requires use of nVidia's legacy drivers, for which XV handles interlacing incorrectly, so you need lots of grunt from the CPU. Doesn't work at all with nv or nouveau drivers as of Novemeber 2008.

‡ use radeon driver (not radeonhd or ati). As of Feb 2009 git master of the radeon driver is believed to support this mode of operation for all supported chips.

ˆ requires intel xserver patch in order to enable interlacing and low dot clock support.

Xorg Configuration

X Windows needs to be configured to generate the signals at the right frequencies for your TV.

Example xorg.conf

This is a working Interlaced PAL TV setup. The relevant sections of xorg.conf are below. Note the "composite" keyword which causes the Radeon to generate composite sync directly.

Script.png xorg.conf

...

  Section "Monitor"
        Identifier   "Generic Monitor"
        HorizSync    14.0 - 18.0
        VertRefresh  45.0  - 65.0
        Option      "DPMS"
        Modeline     "720x576" 15.125 720 778 834 968 576 579 607 625 composite interlace +hsync +vsync
  EndSection
  Section "Device"
        Identifier  "ATI Technologies, Inc. RV370 5B60 [Radeon X300 (PCIE)]"
        Driver      "ati"
        Option      "DynamicClocks" "true"
        Option      "ForceMinDotClock" "14MHz"
        Option      "MergedFB" "false"
        Option      "IgnoreEDID" "true"
        Option      "VGAAccess" "false"
        BusID       "PCI:1:0:0"
  EndSection

...

If you have managed to get a clear image on your TV, but are not able to get the full vertical resolution displayed, try reducing the vertical resolution without changing the total number of lines drawn (625 for PAL, 525 for NTSC). This could lead to a nonstandard resolution, but MythTV will use this without issue.

MythTV settings

Set MythTV to use the "Interlaced x2" deinterlacer. That isn't truly a deinterlacer, but it is necessary to ensure that the two fields of each frame get sent in the correct order. Without it, you will find playback alternates between two modes, one perfect, and the other with motion showing combs and wildly jumping backwards and forwards.

You must also avoid using zooming or time stretch.

Links

Here are some links to information on how to convert the VGA out signal to a suitable signal for a RGB Scart input.