Synchronise your video engines

The importance of applying the correct video sync signal to your TV, monitor, scan converter, HDMI adaptor or projector.
This post tries to answer some of the many questions I get relating to the GBS-8200 and non-standard video types. I will
provide information on how to help identify the correct synchronisation or sync signal for shortness, for common applications
and describe some of the effects you may see when you get it wrong. I do not have a guaranteed fix for any problem, this is more
a how to guide to help you fix any issues you may encounter.

Topics covered in this post

What are synchronisation(sync) signal(s)?
Understanding your composite from your H/V and Sync On green type?
Basic information on video sync timings, PAL, NTSC, CGA, EGA, VGA.
Converting video sync amplitude
Sync strippers/cleaners/separators
Best options for the GBS-8200

What are synchronisation(sync) signal(s)?

Let’s start with a basic description of a sync signal. I took the following from the Tektronix Video Measurements glossary:

Sync – a) Abbreviation for synchronization. Usually refers to the synchro-
nization pulses necessary to coordinate the operation of several intercon-
nected video components. When the components are properly synchro-
nized, they are said to be “in sync”. b) Signals which control the sweep of
the electron beam across the face of the display. The horizontal sync, or
HSYNC for short, tells the display where to put the picture in the left-to-
right dimension, while the vertical sync (VSYNC) tells the display where
to put the picture from top-to-bottom. c) The portion of an encoded video
signal which occurs during blanking and is used to synchronize the opera-
tion of cameras, monitors, and other equipment. Horizontal sync occurs
within the blanking period in each horizontal scanning line, and vertical
sync occurs within the vertical blanking period.

With the move to LCD displays we are not concerned with movement of an electron beam but it is useful to understand how
the horizontal and vertical sync signals play their part in creating the display you see.

Basic information on video sync timings, PAL, NTSC, CGA, EGA, VGA.

 

Video type Horizontal
frequency
Vertical
frequency
Interlaced? Number
of lines
Notes
 PAL  50 Hz  15.625 KHz  Yes  576 active  (1)
 NTSC  59.94 Hz  15.750 KHz  Yes  480 active  (1)
 CGA  60 Hz  15.750 KHz  Yes  200  TTL signals. (2)
 EGA  60 Hz  15.750 KHz/21.80 KHz  No  350?  Vertical frequency changes depending on the mode,
200 line display is 15.750KHz, 350 line display is 21.80 KHz. TTL signals
 VGA  60 Hz  31.469 KHz  No  480+  Lowest resolution shown, extends up to 2014×1536

(1) Quite often when a system states PAL or NTSC output, e.g. a camera, the signal is a composite video signal. For higher quality
conversions, either a Y/C(S-video) or an RGB output is preferred. The sync is embedded with the video.
(2) CGA is unique in that it uses TTL digital signals, with an intensity pin to get 16 colours. If you don’t have an adaptor board to convert
the RGB+intensity to analogue, most converters will struggle. Has separate H/V syncs

You will note that I state that NTSC has a vertical frequency of 59.94 Hz, where as most of the other standards are 60Hz, indeed some
literature states 60 Hz for NTSC. In practice, most of the time this 0.06Hz deviation makes no difference.

Understanding your composite from your H/V and Sync On green type?

So you have a retro game console or computer and you want to connect it to a modern LCD  display or a projector, should be straightforward right?

Depending on the equipment you may have a single signal or multiple types. The table below details the main types:

Sync type Voltage Description
Composite video 1V Normally a yellow plug, contains video and a combined sync. Used by SCART inputs.
CSYNC TTL (2-5V signal) Output by some graphics cards or a TTL signal from retro equipment. It only contains timing information, no video.
HSYNC TTL (2-5V) signal Provides the horizontal video timing, which details the start and end of a line.
VSYNC TTL (2-5V) signal Provides the vertical sync timing, which describes the frame rate.
Sync-on-green 1V A -0.3V sync signal attached to a 0.7V peak green video signal.

An important point is that you need to know what signal amplitude is expected by your TV/monitor/scaler/converter. A common mistake, is to connect
a CSYNC signal, either from a retro device or a computer, to a SCART socket. The SCART standard expects composite video on pin 20, if you feed in a
TTL CSYNC signal, you could be supplying a signal upto 5x higher than expected. My Amiga SCART  and Atari SCART cables fixed multiple video issues,
with a simple fix to the sync amplitude, by adding a series resistor on the sync signal.

I show a TTL signal as a 2-5V signal, for good reason. A retro computer or video system will have 5V logic, a logic 1 output can be from 2.4V (min) to 5.5V(max).
When you connect one of these signals to a 3.3V video chip, like that on the GBS-8200, you are damaging the device as the input signal exceeds the supply voltage.
The ESD protection diodes conduct and soft of allow the system to work, but they are not meant to be used continuously and will fail, at the same time as your board.
The next section details various methods of converting sync signals.

Converting video sync amplitude

So how do you convert a composite video to separate h/v sync or reduce a 5V TTL signal to 3.3V LVTTL or any or a number of options?

Some conversions are simple and can use readily available modules, others need a little circuit board. The table below will help:

From To Solution
Composite  CSYNC (3.3V or 5V)  Sync stripper
 Composite  H & V Sync (3.3V or 5V)  Sync stripper2
 CSYNC  Composite (1V) level  Resistor circuit
 H & V Sync  CSYNC (3.3V or 5V)  OR/XOR gate
 Sync on green  CSYNC (3.3V or 5V)  Sync stripper2
 Sync on green  H & V Sync ((3.3V or 5V)  Sync stripper2
 5V TTL  3.3V TTL  Level converter

Examples of each circuit element are shown in the sections below. What is not shown are power supplies and connectors. This is left to the developer,
though for all circuits shown, a simple linear regulator would suffice.

Sync strippers/cleaners/separators

When I first started researching video adaptors and converters I came across ‘sync strippers’ and wondered what they were. They are relatively simple
circuits, based around commonly available  sync separators, the most widely used being the National Semiconductor (now Texas Instruments) LM1881.
They accept a composite video signal and strip the colour burst off the signal and in the case of the LM1881, output a 5V TTL CSYNC signal.

Syncstripper circuit

LM1881-circuit

Taken from the LM1881 datasheet. Widely used as it’s a readily available part in a DIP package.
There are two limitations of this part:
1) The 5V TTL output is not compatible with modern TVs/HDMI adapters/projectors. It needs a level translator.
2) It does not provide a separate horizontal sync output. If your adaptor only needs CSYNC, great, otherwise try the Syncstripper2 circuit below.
You may get away with using CSYNC for HSYNC but it is by no means guaranteed.

Syncstripper2 circuit

LMH1980-circuit

Again taken from the datasheet. Being a surface mount device will put some people off, the VSSOP-10 package is a bit small but you can
easily buy a SSOP to DIP adaptor off ebay. If you power it from a 3.3V supply, the logic level outputs will be compatible with modern
display devices, no external converter needed. It provides true H/V and C sync outputs and works with a wider range of video types and frequencies.

Would an adaptor board with this circuit, video amplifier and maybe a scanline generator be of interest?

Potential divider and logic level converters

Resistive potential divider circuits
The first circuit converts 5V TTL signals to 1V CSYNC for SCART

5VTTL-SCART

This is a simple potential divider circuit. The output voltage is 75/(75+330) x Vin which gives an output voltage that is ~18% of the
input or around 0.92V.

The second variant is for the GBS-8200 or a modern monitor that is not 5V tolerant.

5VTTL-LVTTL_resistors

With a VESA VGA video monitor or equivalent, the input impedance of the display is much higher, in this instance, 2K. As the aim is to
reduce the signal to be approximately 3.3V, we reduce the amplitude by 27-30%.

One disadvantage of this circuit is that the RC time delay does affect the rising/falling edge of the sync pulse slightly. In most circumstances,
this will not matter but some systems may have issues if the time delay extends past a 100ns rise/fall time. For a cleaner, faster signal, use
logic devices.

Transistor logic level convertor

An improvement is to use a transistor circuit.
FET_level_Translator

This circuit is simple to implement and provides faster edges than resistor networks. You will also find this on ebay as a
level translator for the Arduino, it is acceptable to use it for video.
LevelConverter-L

 

OR/XOR sync combiner circuit
HV_Sync_Csync

The circuit shown above has the option to use either an OR gate or an XOR gate to combine separate HSYNC and VSYNC into a CSYNC signal.
Most of the time, the OR gate will suffice. Depending on the display you interface, you may need to invert the vertical syn portion,
hence the option to use an XOR gate. The 33R resistors were added to damp any ringing when driving long cables. With careful selection of the logic
family, you can use a 5V tolerant part, operating from a 3.3V supply.

Effect of supplying a 5V signal to a 3.3V device

This could be very detailed and lengthy discussion detail the effects of electromigration and it’s detrimental impact on device reliability. I’ll summarise,
DON’T CONNECT 5V LOGIC TO MODERN MONITORS OR ADAPTORS!
Whilst it will appear to work, you may see odd effects, occasional display artefacts or issues displaying a stable image occasionally. If a device is powered
from 3.3V and you feed in 5V, you are exceeding the power supply by upto 1.7V, not a good start. The internal ESD protection diodes, will clamp the signal
to around 3.9/4.0V, which you might think is OK. The clamping action distorts the signal and can cause the video display/adaptor to incorrectly sample the sync signal.
The ESD diodes are only meant to  have short term use to protect from static electricity, which is normally a short, sharp shock. If they are continuously used, they
will fail and when they do, the full 5V signal is fed into the IC. Depending on many factors, the distortion will get worse but one thing is 100% certain, the device will fail.

Best options for the GBS-8200

I would recommend as a minimum that any sync signals are scaled using at least a potential divider circuit or a transistor level shifter as they are readily
available, providing your source produces a C sync signal. If you need to to combine H and V Sync, use the logic circuit shown above.
If your system provides a composite video signal, use one of the sync strippers but ensure you condition the output to be 3.3V LVTTL compatible.

Summary

I hope this guide has been useful and informative. It is only meant to provide guidance on common issue I have encountered when inter-connecting various video
systems it is not a definitive guide of what you must do. Sometimes you need to experiment, if you have an oscilloscope, make some measurements.

I’ll be taking a break for a bit whilst I get busy with the CAD tools but I will read and respond to your comments.

Advertisements

GBS-82XX experiments part 2

GBS-8200 and GBS-8220 experiments part 2

Work has continued, experimenting with these low cost but potentially highly capable video adaptor boards.

Fixing the random speckles on the display

I believe I have found the cause of the occasional white speckles seen on the display. The default setting for the GBS-82XX board is to clock the 166 MHZ speed grade SDRAM at 162 MHz. It appears to be worse if the Hynix HY57V643220DT-6 is fitted compared to the EtronTech EM638325TS-6G device, which appears to be fine.

I measured the SDRAM clock at 162 MHz and recorded this:

gbs-clock-small

Whilst the signal is a bit noisy, it does not violate the +/-2V overshoot/undershoot limits of the SDRAM devices used.

The simplest fix was to reduce the SDRAM clock speed to 129.6 MHz, with a single I2C write. This has fixed the issue. Halving the SDRAM speed to 81 MHz caused distortion on the video, the next speed increment of 108 MHz was sufficient for 1360×768 pixel output. A proper fix would be to adjust the timing of the DQM strobes with regard to the data bus as on SDRAM the DQM strobes clock the data out of the SDRAM. If this is adjusted, you also need to consider the timing of the SDRAM clock to the control bus (RAS, CAS, CKE, CS, BS0/1 and WE) and the Data bus. This is not too difficult if you have the PCB artworks as you can measure the PCB track lengths and adjust the timing by 7ps/mm. With the GBS-82XX board, it would be tricky and fraught with false starts. We could of course measure it and adjust accordingly, or reduce the clock speed by 20% and have more timing margin (an extra nanosecond) on the clock.

Now that the speckling problem appears to be fixed, I am looking at some general video quality issues. When using a 50 Hz PAL screen-mode, scan-converted to 60 Hz, there are some noise bands, particularly noticeable on a grey Workbench background. It is hoped that some digital filtering/sampling will help alleviate this.

Synchronising the GBS-82XX

I have experimented with different ways to synchronise the GBS-82XX device. As those of you that have experimented with the board now, sometimes it can be a bit ‘hit and miss’ with the video source (games console or computer).

When using the GBS-82XX with the Amiga, this is the cable I use:
GBS-82XX-cable

The 680 ohm resistor is essential. It reduces the CMOS Composite sync signal from the Amiga to < 3.6V. The TVIA-5725, the device under the big heatsink, accepts a maximum voltage of +3.6V and a minimum voltage of -0.3V. The Amiga’s video sync, measured on the A1200, looks like this:Amiga_CSYNC_680R_GBS8220
The TVIA-5725 accepts a 3.3V TTL signal, via a Schmitt input, this changes logic levels slightly so a logic 1 is 2.4V to 3.3V,  and a logic 0 is 0 to 1.0V. The 680 Ohm resistor works as the GBS-82XX follows the Vesa VSIS specification, which requires synchronisation inputs to have a 2K impedance to ground. My 680 ohm resistor (+47 ohms in the Amiga), creates a potential divider, reducing the signal level to a safer level. This is cheap and easy to implement and does not degrade the video sync significantly.

A number of people use the venerable LM1881 video sync separator, any device or circuit that uses this, should have the 680 ohm resistor added as shown above. The LM1881 outputs 4-5V sync levels that are not compatible with the GBS-82XX/TVIA-5725. Alternative devices are the EL1883 or the LMH1980 but they are not available in hobbyist friendly DIP packaging.

I have tested the LMH1980 with the Amiga, I used the composite video output of the A1200 to create LVTTL (3.3V) HSYNC, VSYNC and CSYNC. The GBS-8200 I have synchronised with the CSYNC perfectly, the same as using a resistor. It did not work reliably when I supplied separate HSYNC and VSYNC, I had a very wavy display.

A final note, the GBS-8200 did synchronise to the Composite video output of the A1200 but it is not recommended. The 2V (approx) video contains colour information that is not filtered out and would in all eventualities, cause problems at a later date.

Cleaning up the power supplies

I have been reading numerous web-forums on GBS-8200/GBS-8220 problems to look for common trends and solutions. One topic that crops up a lot is related to the power supplies. I have already proven, in part one, that a 5V 2A supply is not required.

During my testing, I noticed an occasional, high frequency, burst of noise, on the +3.3V supply. I traced it back through the circuit to the power input. Changing the timebase of the oscilloscope, I spotted something important, it happened at 20ms/50Hz intervals. In the UK and Europe, the AC mains operates at 50Hz so when you see a 50Hz noise pulse, you know where it came from. Currently my GBS-8200 is powered from my bench power supply, built 20 years ago, with 3 linear regulators and still on the original electrolytic capacitors.

Also connected to the +5V output was my 5V to 3.3V TTL buffer board. Two of the eight inputs were in use, the other six were floating. I made a mistake here. You should never leave TTL inputs unconnected, they will pick up noise and oscillate, in this instance, they picked up 50Hz mains noise. Quickly dis-connecting the buffer board, removed the noise. The 3.3V (switchmode) and 1.8V (linear) regulator supplies now have about 20-30mV of noise, perfectly acceptable.

To ensure I do not have any further conducted noise issues I added a clip on ferrite bead:
GBS_with_ferrite

You can see the buffer board in the top right of the photo. Whilst this ferrite was a little large, it did cut the noise out. If you are using the DC power jack (the black plug) either pick a PSU that has a ferrite fitted or measure the cable diameter and purchase a clip-on ferrite from a local supplier or ebay. I spent two hours trying to work out where the noise was coming from, reading datasheets and measuring the board.

To date I have changed a single capacitor on the board. I briefly touched on this in my first post but after additional testing, I am happy to confirm it needs changing.
Here it is:
Capacitor_to_change-medium

The 1.8V regulator is used for the core supply of the TVIA-5725. with a ceramic capacitor, I was able to cause the power supply to glitch by switching my overhead inepection light on/off or my soldering iron transformer. Since changing it to a 16V, 22uF, tantalum bead capacitor, this has not happened. The original capacitor, shown under Kapton tape, had an ESR of 0.02 ohm, the recommended range for the LM1117 (similar to the AMS1117 used here) is 0.3 to 22 ohms! The part I fitted had an ESR of around 2 ohms.

The software settings solution?

Some people ask what the final software settings solution will be?

My preferred option is to use an Arduino Nano like this:

ArduinoNanoFront_3_lg

(Image from http://arduino.cc/en/Main/arduinoBoardNano)

This would be used to read and write the I2C commands to the TVIA-5725 device which provides the video scaling functions, among others. It is readily available and clones can be cheaply procured, finally it can be easily updated using the Arduino environment.

My aim is to make the design data readily available, for free. This will include the video settings. I’ve seen too many scammers on ebay selling ‘Amiga modified’ equipment for extortionate prices, I will not have this solution exploited.

Another option, still using the Arduino approach is a module that piggybacks on the 8051 microcontroller clone on the GBS board. This would allow access to the onboard switches and no wiring. The downside is it would be more expensive.

Until the final settings are known, the end solution is fluid.

Until the next update.