Xbox VGA HOWTO
From Xbox-Linux
Version 0.3
DISCLAIMER: The information in this document is supplied as is, without any warranty. If you build any of the cables / circuits in this document you will void the warranty of your Xbox, you may even damage your Xbox, your monitor, or both. I take no responsibilities for any damages that may result from the cables and circuits described in this document. Use at your own risk.
| Table of contents |
Introduction
This document describes how to connect a VGA monitor to your Xbox and get it to work under Linux.
The basics
On a standard PC you'll find a VGA plug that delivers 5 signals:
- 3 analog color signals for red, green and blue (RGB) components
- 1 digital horizontal sync signal
- 1 digital vertical sync signal
A VGA monitor uses these signals to generate the image on its screen. The sync signals tell the monitor when to start a new image line or a new image frame.
Back in the old days of discrete VGA adaptors, the main components on a VGA board were the VGA graphics controller and the DAC. The VGA graphics controller generates all the digital image information. To convert the color information into analog signals the digital image information is passed to a fast digital-analog-converter (DAC) which generates the analog RGB signals.
In the Xbox things work similarly. The graphics controller still generates old-style RGB and sync signals. Instead of a plain DAC the Xbox uses a video encoder that will normally generate the TV signal. The video encoder can be programmed to support a range of different TV signal standards (e.g. Composite, RGB-SCART, S-Video, HDTV etc.)
The different TV signal standards usually combine one or more of the above mentioned video signals into one single signal. RGB-SCART, the TV standard closest to VGA, still uses 4 signals:
- 3 analog color signals for red, green and blue components
- 1 composite sync signal containing both hsync and vsync information.
HDTV uses even fewer signals:
- 2 analog color signals for red and blue components
- 1 analog color signal for green component with embedded sync signals.
As a consequence the Xbox only offers a maximum of 4 video signals on its AVIP connector. It's therefore impossible to generate a completely VGA compliant signal on the AVIP connector.
There a two general ways to solve this problem:
a) A lot of modern monitors support a feature called "Sync On Green" (SOG). In this mode the sync information is embedded into the green VGA color signal, just as in the HDTV mode. For a list of monitors that support sync on green see http://playstation2-linux.com/sog.php.
b) Use external hardware to extract the sync information from either the green signal or the composite sync signal and split it up into hsync and vsync signal.
Additionally you need VGA support in the software you're running.
The hardware
There are a number of options to build your own VGA cable for Xbox. They differ in the method used for sync generation, as described above.
If you need a sync splitter because your monitor does not support "Sync On Green" there's a bit more work to do.
Another option would be to buy a converter for about 30EUROS/USD. They are made for consoles to be played on a normal VGA-screen. You can find them in various internet shops. They work with every monitor and you don't need to build them. But this option is expensive.
Using sync on green
If your monitor supports Sync-on-Green you're lucky - you just need a plain cable to connect your AVIP connector with your VGA monitor. No additional electronic components are necessary.
The pin numbering below is with respect to the back of the AVIP plug, where the pads onto which you'll be soldering are located, not the front of the plug, which enters the AVIP port.
_______________________________
/24 22 20 18 16 14 12 10 8 6 4 2\
| 23 21 19 17 15 13 11 9 7 5 3 1 |
-----------------------------------
AVIP Connector
And here's the VGA connector, again seen from the back of the connector plug:
___5_______1____
\ o o o o o /
10 \ o o o o o / 6
\o o o o o /
----------
15 11
VGA Connector
You need to make the following connections:
AVIP Pin 19 to VGA Pin 1 (red) AVIP Pin 22 to VGA Pin 2 (green) AVIP Pin 18 to VGA Pin 3 (blue) AVIP Pin 17 to VGA Pin 6 (red ground) AVIP Pin 20 to VGA Pin 7 (green ground) AVIP Pin 16 to VGA Pin 8 (blue ground) AVIP Pin 9 to AVIP Pin 10 (Mode select, Bit 0) AVIP Pin 13 to AVIP Pin 14 (Mode select, Bit 2)
The connections of AVIP Pin 9 and 13 are necessary to select the cable ID. The above connections will result in a cable ID of "2" (make sure AVIP Pin 11 is unconnected). This way Cromwell and the Linux kernel will be able to detect the VGA cable and set the correct modes.
For audio signals, use AVIP Pin 2 (right channel), Pin 4 (GND), Pin 3 (left channel) and Pin 5 (GND).
I recommend that you get a cheap Xbox SCART adapter, remove the SCART plug and solder a VGA plug.
Using a sync splitter
If your monitor does not support sync on green you need an additional sync splitter. The sync splitter used here is the LM1881N from National Semiconductor ( http://www.national.com/pf/LM/LM1881.html ).
You need to build the same cable as described above. Additionally, build the following circuit:
VGA LM1881N
Pin 13 | -------- AVIP
-------|1 8|----- Pin 1 (+ 5 Volt)
AVIP 0.1uF | |
Pin 22 ---||--|2 7| ____ 575 kOhm
| | |----|____|---|
VGA -------|3 6|---| |---|
Pin 14 | | |------||-----| |
|-|4 5| 0.1uF |
| -------- |
|______________________________|
|
|
AVIP Pin 12 (GND)
For a layout of a PCB board that will fit in the AVIP cable connector go to Xbox-2-VGA-PCB (http://www.instructables.com/id/EOOC58HHZTEX503A63)
Both methods, pure sync-on-green and sync-splitter, suffer from the
fact that the XBox does not deliver VESA compliant sync-on-green
signals. The VESA standard requires sync pulses with negative voltage,
with the color signal starting at 0 Volt. The XBox, however, cannot
produce negativ sync pulses. Instead it uses a positive voltage offset
on the green signal with the sync pulses going down to 0 Volt. This may
result in a slight colour shift, depending on how well your monitor is
able to cope with the voltage offset. Usually dark gray colors will
appear slightly green.
One way to solve this problem in hardware is to subtract the sync information from the green signal and deliver the resulting signal to the monitor. Some vendors sell VGA adapters for PS/2 that use this approach, e.g. Blaze (http://www.blaze-gear.com/p2_017.htm). If you replace the PS/2 plug with an XBox AFIP plug the adapter will also work on an XBox.
Another problem is the width of the sync pulses which is fixed by the Conexant mode, i.e. it cannot be modified by software. The higher the pixel clock rate gets the shorter the sync pulses become. It's up to the sync logic in your monitor how well it will cope with the short sync pulses at higher pixclock rates.
Using a XBOX(HDTV) to VGA converter
Neoya (http://www.x2vga.com) offers the X2VGA (http://www.x2vga.com) converter for the Xbox which converts the HDTV image information and sync pulses to VGA signals. It supports the 480p (720x480), 720p (1280x720) and 1080i (1920x1080 interlaced) HDTV modes and delivers perfect VGA pictures. Currently Xbox-Linux will only support 480p and 720p as well as some custom resolutions (see below).
The X2VGA converter will work on both PAL and NTSC Xboxes with all video encoder chips in Linux. However, it seems that Microsoft has disabled HDTV support for PAL boxes in their BIOS, so you cannot use it to play games on PAL boxes.
The exact level of support is as follows:
Conexant: All HDTV modes, with adjustable resolution Focus: All HDTV modes, but only fixed 480p, 720p, 1080i. Xcalibur: 480p only
(This is the latest xboxfb driver in the Xbox-linux CVS. Not all of these features may have found their way into the distributions yet.)
Other XBOX(HDTV) to VGA converters
Be aware that some other VGA adapters sold on the market are very good for game playing but do not have a high resolution output therefore can not be used to read text, or do some work on linux. This is true even if the monitor that you use is a very good one. One has to be very carefull when buying a VGA adapter to be sure that it will suport high resolution mode.
Using the Xbox's internal sync signals
This method will deliver the best sync signals but is also the most difficult to build. You should have several years of soldering experience with SMD devices before trying this method.
The digital interface between the NVidia GPU and the Conexant chip uses a HSYNC and VSYNC signal. Unfortunately these signals are only used internally, they are not available on the AVIP.
It's not advisable to use the HSYNC and VSYNC signals directly, since the sync lines of a monitor are usually terminated with a 75 Ohm load. Instead you have to use a buffer to drive the signals. To make matters worse, the interface between the Conexant chip and the GPU uses only 1.5 signal voltage. However, some monitors are able to cope with this.
HSYNC is available at pin 35 of the CX25871, VSYNC at pin 36. I recommend to use two Schmitt-Triggers of a 74HC14 as buffers. The supply voltage of the 74HC14 has to be 1.5 Volt (available from pin 40 of the CX25871), otherwise the input threshold of the Schmitt-Trigger is too high.
I strongly advise not to solder wires directly onto the CX25871, since you're likely to shorten two or more pins. The sync signals are available from two small soldering pads close to the upper edge of the GPU. There are also two points on the bottom of the board that are easier to get to after you scrape the points. (Points on top of motherboard) (http://members.cox.net/sandman1687/con3e.JPG) (Points underneath motherboard) (http://members.cox.net/sandman1687/conunde.JPG)
Connect the ouput of the buffer driven by pin 35 of the Conexant to pin 13 of the VGA connector. Connect output of the buffer driven by pin 36 of the Conexant to pin 14 of the VGA connector.
Since this method doesn't depend on sync pulses embedded in the green signal it doesn't suffer from the colour problems described above.
A full guide showing an implementation of this method, with some adjustments (http://forums.xbox-scene.com/index.php?showtopic=624248)
The software
On the Xbox a number of software components set the video mode. First, the Xbox BIOS will set the initial video mode after power-up. Depending on your boot method the BIOS is either a modified Microsoft BIOS or Cromwell. Most of the modified Microsoft Bios do not support VGA, so you cannot expect any output in the early boot process.
If you are using Cromwell as your BIOS to boot Linux you will get VGA support immediately after power-on. Cromwell will detect a VGA cable if it has a cable Id of "2" and switch to a resolution of 800x600 @ 56 Hz which should work on any VGA monitor.
Once the Linux kernel is booted it will take control of the video settings (provided that you use the rivafb driver for Xbox, which you should). You need a kernel which was built from the latest kernel sources from http://Xbox-linux.sf.net. The kernel shipped with Ed's Debian 0.3.1 is too old to support the VGA feature.
Note: The video driver in Xebian 1.0.0 contains a bug that makes it impossible to use VGA with sync on green. The bug is fixed in the video driver sources in CVS. If you're running Xebian 1.0.0 you need to recompile the kernel as described above.
If your cable uses another ID than 2 you can still force the kernel to switch to VGA modes. To do so, add a statement "tv=VGA" to the parameters of rivafb in the append line in linuxboot.conf.
Important: If you're using ed's Debian distro you have to remove the line "rivafb y" (or "vesafb y") from your linuxboot.cfg, otherwise the bootloader will force the kernel to use PAL or NTSC output. It's also a good idea to delete or rename the script /etc/rcS.d/S75xconfig which tries to create a symbolic link for your X11 configuration file (/etc/X11/XF86Config-4). It doesn't know about VGA and creates a link pointing nowhere.
Once you got Linux running you can modify the timing and resolution parameter using "fbset", just as you would on a PC. The timing parameter to use depend very much on your monitor and the sync method you use. The timing values are outside the scope of this document, for details see the XFree86 Video Timings HOWTO, e.g. from http://www.yolinux.com/HOWTO/XFree86-Video-Timings-HOWTO.html.
Here are some values that worked for me (consult the specification of your monitor before trying any of them):
Sync on green, 640x480, HSync 31.469 kHz, VSync 59.942 kHz: fbset -g 640 480 640 480 32 -t 39721 40 24 32 11 96 2 Modeline: Mode "640x480" 25.177 640 664 760 800 480 491 493 525 -hsync -vsync Sync on green, 800x600, HSync 46.382 kHz, VSync 73.623 kHz: fbset -g 800 600 800 600 16 -t 22000 110 20 15 10 50 5 Modeline: Mode "800x600" 45.456 800 820 870 980 600 610 615 630 -hsync -vsync Sync on green, 1024x768, HSync 53.314 kHz, VSync 65.577 kHz: fbset -g 1024 768 1024 768 32 -t 15200 180 10 20 20 20 5 Modeline: Mode "1024x768" 65.790 1024 1034 1054 1234 768 788 793 813 -hsync -vsync Internal sync, 1024x768, HSync 60.020 kHz, VSync 75.025 kHz: fbset -g 1024 768 1024 768 32 -t 12699 176 16 28 1 96 3 -hsync high -vsync high Modeline: Mode "1024x768" 78.747 1024 1040 1136 1312 768 769 772 800 +hsync +vsync X2VGA converter, 640x480, HSync 82.222 Hz, VSync 43.167 kHz: fbset -g 640 480 640 480 8 -t 27000 96 58 31 7 64 7 Modeline: Mode "640x480" 37.038 640 698 762 858 480 487 494 525 -hsync -vsync X2VGA converter, 800x600, HSync 71.000 Hz, VSync 46.764 kHz: fbset -g 800 600 800 600 16 -t 22000 100 8 50 2 64 2 Modeline: Mode "800x600" 45.456 800 808 872 972 600 602 604 654 -hsync -vsync X2VGA converter, 1024x768, HSync 57,424 Hz, VSync 45,824 kHz fbset -g 1024 768 1024 768 8 -t 16000 220 40 22 3 80 5 Modeline: Mode "1024x768" 62.501 1024 1064 1144 1364 768 771 776 798 -hsync -vsync
Limitations
All hardware solutions use the DACs of the Conexant chip to generate the color signals. The Conexant chip is specified to run at pixel clock rates up to 80 MHz. This is enough for 1024x768 at about 80 Hz and 1152x864 at about 60 Hz, but higher resolutions and / or higher screen refresh rates are not possible.
Newer models of Xbox
The newer Xbox models (Version 1.4 and Version 1.5) have a different video driver chip: FOCUS. Be aware that the versions of Cromwell (2.31) and Xebian (1.0.3) do not fully suport this chip. In particular the VGA modes will not have a real RGB output, but a HDTV output instead. That means that the "green" output is not green but is an "Intensity". This system is called YCrCb. This means that you can not connect the monitor using the sync separator as described above. You will get a green image. This issue should be resolved in a newer version of cromwell / kernel. Another solution for 1.4 and 1.5 boxes would be to use a YPrPb - to - RGB converter together with the internal sync signals.

