Home - IanSB/RGBtoHDMI GitHub Wiki

RGB to HDMI

Introduction

The RGBtoHDMI interface converts the "digital" RGB video signal from vintage computers like the BBC Micro or PC MDA/CGA/EGA to HDMI or DVI compatible with most modern TVs/Monitors. The interface comprises a Raspberry Pi Zero and a specially designed Hat containing a small CPLD. Custom firmware on the Raspberry Pi, in conjunction with the CPLD, is able to correctly sample each of the supported video modes to give a pixel-perfect rendition. The HDMI output is locked to the input so there are no frame drops, repeats or tears and it also has low lag of around 4 milliseconds (less than a quarter of a frame - see Lag Measurement)

An addon analog interface is available for the 6-12 bit versions of the converter to support a limited number of computers with a few levels of analog RGB / YUV output such as Amstrad CPC, Spectrum, Atom, Dragon or Tandy Color Computer, or monochrome composite output such as Apple II /IIe/IIc, UK101, Superboard II, ZX80 and ZX81. Note this interface can only distinguish a few analog levels and is not suitable for systems with many levels of RGB or YUV.

One unusual feature of the converter is optional integer scaling where one original pixel on the computer is scaled to an exact number of lcd pixels without using any interpolation filtering. This results in the low resolution output from real hardware looking as clean and sharp as sources output at the native resolution of the lcd (see the Gallery of Screencaps for examples) although you can use filtering if you prefer.

Due to the way the video is sampled and re-quantised, when everything is setup correctly the output is totally noise free even when passing through an analog stage and it effectively makes the output of real hardware look like it is coming from an emulator.

RGBtoHDMI integer scaling output: images/integer.jpg

Typical output from other scalers that have interpolation filtering: images/interpolated.jpg

3 bit converter 'hat' fitted to Raspberry Pi zero: images/IMG_1390.JPG

6-12 bit RGBtoHDMI fitted into recommended case with optional analog interface: images/case.jpg

Purchasing

Assembled boards for sale

Support

There is a development thread on the stardot forums: Stardot Thread

Software

Current Documentation

Earlier Documentation

Technical Challenge

The main challenge with this project was successfully sampling Mode 7 on the Beeb.

The difficulty here is that the pixel spacing is very uneven:

images/IMG_0913.JPG

This is because of the way the Beeb generated the 6MHz clock from 2, 4 and 8MHz clocks:

images/6M_clock_beeb.png

The clock edges (both are used by the SAA5050) deviate from where they should be with a pure 6MHz clock, but crucially the differences repeat every 6 edges.

The CPLD on the RGBtoHDMI interface allows the pixel sampling points to varied in units of 10.4ns (1/96MHz) over a range of +/- half a pixel. In mode 7, six possible sampling points can be configured, to match the clock skew.

An automatic calibration process is used to set these sample points.