X11 VGA to PAL scart

This page is yet a mess of things i've stumbled upon while connecting a TV to the VGA port to build a linux arcade. see the pinouts page for comprehensive information.

Once my setup is stable this page will be compacted to vga2scart.

Theroy

As i understand it.

Any (EU) PAL-TV is fixed at 14.76 MHz / 16.625 kHz with a total resolution of 944×625 of which 767×575 are visible. (rounded to /8 : 768×576). A PAL horiz sync line should be 64us (image: 52us, front porch 1.65 us, sync pulse: 4.7us, back porch 5.65us).

Timing description

   <--------1--------> <--2--> <--3--> <--4-->
                               _________
   |-------------------|_______|       |_______

                       R       SS      SE     FL
1: visible image
2: blank before sync (aka front porch)
3: sync pulse
4: blank after sync (aka back porch)
R: Resolution
SS: Sync Start
SE: Sync End
FL: Frame Length

crunching PAL numbers

Modeline Freq R SS SE FL YR Y2 Y3 YL [-hsync -vsync interlace]

Frame length. FL : EU-PAL: 15.625 kHz = DOT-freq/h-scanline eg. 14.68 MHz / 944 = 18.00 MHz / 1052 = 15.00 MHz /960

X resolution: 52us = 767 / 14.76 MHz

Notes:

  • Dot-frequency is “rounded” by the X server and/or hardware.
  • the “counters” for generating the horizontal sync do not honor the lower three bits.

(increments of 8) - i guess this is a hardware issue :)

Modeline Collection

http://www.nexusuk.org/projects/vga2scart/

Modeline "800x576pali" 15.38  800 823 895 984  576 580 583 625 -hsync -vsync interlace
Modeline "800x288pal-half"  15.38  800 823 895 984  288 290 292 313 -hsync -vsync
Modeline "768x576pali" 14.76  768 789 858 944  576 580 583 625 -hsync -vsync interlace
Modeline "768x288pal-half"  14.76  768 789 858 944  288 290 292 313 -hsync -vsync
Modeline "720x576pali" 13.88  720 742 808 888  576 580 583 625 -hsync -vsync interlace
Modeline "720x288pal-half"  13.88  720 742 808 888  288 290 292 313 -hsync -vsync
Modeline "704x576pali" 13.50  704 722 786 864  576 580 583 625 -hsync -vsync interlace
Modeline "704x288pal-half"  13.50  704 722 786 864  288 290 292 313 -hsync -vsync
Modeline "650x576pali" 12.50  650 669 728 800  576 580 583 625 -hsync -vsync interlace
Modeline "800x480ntsci" 15.10  800 808 879 960  480 484 487 525 -hsync -vsync interlace
Modeline "800x240ntsc-half"  15.10  800 808 879 960  240 242 244 263 -hsync -vsync
Modeline "720x480ntsci" 13.59  720 727 791 864  480 484 487 525 -hsync -vsync interlace
Modeline "720x240ntsc-half"  13.59  720 727 791 864  240 242 244 263 -hsync -vsync
Modeline "704x480ntsci" 13.34  704 714 776 848  480 484 487 525 -hsync -vsync interlace
Modeline "704x240ntsc-half"  13.34  704 714 776 848  240 242 244 263 -hsync -vsync
Modeline "657x480ntsci" 12.50  657 667 725 792  480 484 487 525 -hsync -vsync interlace
Modeline "657x240ntsc-half"  12.50  657 667 725 792  240 242 244 263 -hsync -vsync
Modeline "640x480ntsci" 11.32  640 646 703 786  480 484 487 525 -hsync -vsync interlace
Modeline "640x240ntsc-half"  11.32  640 646 703 786  240 242 244 263 -hsync -vsync

http://www.tkk.fi/Misc/Electronics/circuits/vga2tv/linux_tv.html

#Mode 15.314kHz/58.45Hz
"80x25"   14.31818   640 728 792 896   200 222 226 263   +Hsync +Vsync  font 8x8
ModeLine "PALi"  14.16  704 756 828 976 552 556 589 629 +hsync +vsync interlace
Modeline  "Pal"     15.00  688 790 810 960  530 560 580 625 Interlace
ModeLine "PALi"       13.5  704 720 792 864  552 572 605 625 Interlace
Modeline "NTSCi"    14.31818  640 728 792 896   400 444 452 526 Interlace  +Hsync +Vsync

http://sh.nu/nvidia/gtf.c


Working on sputnik:

ModeLine "TV" 18.00 848 920 1000 1152 516 545 550 625 interlace -hsync -vsync
#This kind of works on the "old TV"
#       ModeLine "TV" 18.00 824 944 1024 1152 576 582 620 625 -hsync -vsync interlace

X on TV

X on TV

From the Xserver's point of view a TV with a RGB SCART input is nothing but a fixed sync monitor with a rather low picture quality. This means that you can make a TV compatible signal with a plain vanilla cheapo VGA card.

Modelines

For the European 625 line (575 visible lines) TV standard a modeline looks like this:

Modeline "736x575i" 14.16 736 760 824 904 575 580 585 625 interlace -hsync -vsync

Officially the horizontal resolution is 767 (4 / 3 * 575) pixels with a clock of 14.76 MHz. However, since the clock used is 14.16 MHz, I reduced the horizontal values proportional to 14.16 / 14.76 (and rounded them to the nearest multiple of 8). 14.16 MHz / 904 yields a horizontal deflection frequency of 15.664 kHz, which should work on most EU (15.625 kHz) (and US, 15.75 kHz) TV's. If your VGA card's clock is different from 14.16 MHz, you need to change the horizontal values.

You can probably use the following modeline for the US 525 line (485 visible lines) standard:

Modeline "736x485i" 14.16 736 760 824 904 485 491 496 525 interlace -hsync -vsync

If you want to make a 640×480 screen with a black border you can you use this line:

Modeline "640x480i" 14.16 640 712 776 904 480 532 537 625 interlace -hsync -vsync

You can centre it by altering the 2nd and 3rd horizontal and vertical values (this example shifts the picture to the left):

Modeline "640x480i" 14.16 640 728 792 904 480 532 537 625 interlace -hsync -vsync

You can make a non interlaced signal with this modeline:

Modeline "736x288" 14.16 736 760 824 904 288 290 292 312 -hsync -vsync

More information on the X Window system

Howtos

  • The Linux XFree86 HOWTO
  • XFree86 Video Timings HOWTO
  • The X Window User HOWTO

Books

  • Volume 3M: X Window System User's Guide
  • Volume 8: X Window System Administrator's Guide

Hardware

The VGA RGB signals are compatible with the SCART bus, the sync signals are not. You have to create a composite sync signal of 0.3 … 0.5 Vpp. The circuit below acts both as a AND gate and a level translator. It doesn't need a power supply and can be mounted inside a VGA plug:

-VS ------------------------+
                            |
                            |
                        |  /
      +-----+           |/
-HS --+ 3k3 +-----*-----|     BC 548 B
      +-----+     |     |\
                  |     |  \|
                  |        -|     +-----+
                  |         *-----+ 68  +----- -CS 0.3 Vpp
                  |         |     +-----+
                 +++       +++
                 | |       | |
                 | |       | |
                 +++       +++
                  |         |
GND --------------*---------*----------------- GND
                 1k2       820

You can use any general purpose low frequent low power Si NPN transistor instead of the BC 548 B The resistors are all standard 250 mW carbon film resistors;

68 = 68 Ohm
820 = 820 Ohm
1k2 = 1200 Ohm
3k3 = 3300 Ohm

I have a page with both the VGA and SCART connectors. If you apply the pin out you get this;

VGA                                                SCART

 1 -O------------------------------------------O- 15 R
 2 -O------------------------------------------O- 11 G
 3 -O------------------------------------------O-  7 B
 
 6 -O------------------------------------------O- 13 R Gnd
 7 -O------------------------------------------O-  9 G Gnd
 8 -O------------------------------------------O-  5 B Gnd
 
 5 -O-+
      |
11 -O-+

Connector --------------------------------------O- 21 Connector
shell                                                 shell
 
 14 -O------------------------+ 
-VS                           |
                              |
                          |  /
        +-----+           |/
 13 -O--+ 3k3 +-----*-----|     BC 548 B
-HS     +-----+     |     |\
                    |     |  \|
                    |        -|     +-----+
                    |         *-----+ 68  +-----O- 20
                    |         |     +-----+       -CS
                   +++       +++
                   | |       | |
                   | |       | |
                   +++       +++
                    |         |
 10 -O--------------*---------*-----------------O- 17
Gnd                1k2       820                  Gnd

You can connect all grounds with each other if you like;

5,6,7,8,Shell ------------------------------------ 5,9,13,17,21

Notes:

  • The link between 5 (Gnd) and 11 (Mid0) tells your VGA card that your `monitor' is colour.
  • The R-, G- and B grounds are in fact shields (The R-, G- and B wires are in fact little coaxes). The same goes for the `-CS' wire.
  • The connector shells are connected to a common shield screening all wires and coaxes inside the cable.
  • If you use a female SCART connector, use pin 19 for -CS.

Use

There are several ways to tell your TV to use the RGB Scart input. In some cases you can use the remote control for this purpose. Some TV's have a switch near the Scart plug. In some cases however, you will have to force pin 16 high. A voltage of 0 … 0.3 V represents off, while a voltage of 0.9 … 3 V tells the TV to use the RGB Scart input. Warning: A voltage > 3 V on pin 16 might damage your TV!

Other resources

S-Video to Composite

This simple adapter can be used to convert Y/C video (S-video) to a composite video. This adapter is useful in cases where your video output device has only S-video output but your signal source accepts only composite video input. This circuit works with both PAL and NTSC video standards.

Y-ground------------------+
                          +---------- RCA/composite ground
C-ground------------------+

Y-------------------------+
                          +--------- RCA/composite video
C------------||-----------+
            470pF

compare: http://www.tkk.fi/Misc/Electronics/circuits/svideo2cvideo.html

 
wiki/vga2pal.txt · Last modified: 11.03.2006 11:03 (external edit)