11

I've been looking around on the internet and I can't find anything in depth on how the cable/connection functions. I've only been able to find simple pin out descriptions.

If someone can link me or point me in the right direction, I would be very grateful.

Josh Beckwith
  • 229
  • 1
  • 3
  • 7
  • 3
    You plug it in and the transports signals from one end to the other? Are you talking about the VGA signals themselves? – Matt Young Apr 26 '15 at 02:32
  • I guess I wasn't very specific. Yes, I was looking to study on the signals that are being carried through the cable. I'm looking to start a project involving a vga cable from a computer to an arduino, and was hoping to understand the VGA component before starting. – Josh Beckwith Apr 26 '15 at 02:40
  • Not sure what you're planning, but the first thing I would call to your attention is the [signal timings](http://en.wikipedia.org/wiki/Video_Graphics_Array#Signal_timings). The VGA signals are faster than a AVR clocked at 16 MHz will handle. Maybe if you use the the Arduino with the ATSAM on it, depending what you're doing. This stuff is usually done in purpose built hardware or an FPGA. – Matt Young Apr 26 '15 at 02:46
  • So what I'm getting at from this, is that the screen is lit from the left to the right, top to bottom, just like reading a book, using hex color values from the system memory. Is this correct? – Josh Beckwith Apr 26 '15 at 02:57
  • Pretty much, it's called a raster pattern. – Matt Young Apr 26 '15 at 02:58
  • 1
    And it looks like the industry standard of 640x480 has a pixel clock of 25.17MHz, and the Arduino Due has a clock speed of 84MHz, so I should be able to read the color data in quick enough, right? – Josh Beckwith Apr 26 '15 at 03:01
  • The RGB signals on VGA are analog. Suggest looking at DMA features for spitting the data out to the DACs. – Spehro Pefhany Apr 26 '15 at 03:11
  • I can't just read them into the analog pins on the ArduinoDUE using AnalogRead(pin); ? – Josh Beckwith Apr 26 '15 at 03:13
  • 1
    For three muxed channels probably 2 orders of magnitude too slow (100x too slow). – Spehro Pefhany Apr 26 '15 at 03:27
  • 1
    @JoshBeckwith Unlikely. The ADC on the Due has a maximum speed of 1000 ksps, considerably slower than would be necessary to sample VGA. –  Apr 26 '15 at 05:02
  • Have you seen the [Arduino MicroVGA page](http://playground.arduino.cc/Main/MicroVGA)? – David Apr 26 '15 at 07:14
  • No Arduino platform is fast enough to read in a VGA signal in real time. I would suggest an FPGA platform of some sort. Several of the Xilinx reference boards come with VGA ADCs that split the analog VGA signal out into a parallel digital bus. – alex.forencich Apr 26 '15 at 08:01

1 Answers1

15

The OP asked how a VGA cable works, so I'll start with the wiring for a standard cable, which is a DE-15 15-pin connector (sort of like the DB-9 connector used for RS-232, but with an extra row):

enter image description here

H-SYNC and V-SYNC stand for horizontal and vertical sync. The rest are self-explanatory. H-SYNC and V-SYNC are digital (TTL) level signals, active low, and the color signals are analog, 0v (black) to 0.7v (full color).

As implied by the presence of the H-SYNC and V-SYNC, there is horizontal timing and vertical timing. This diagram shows the timing for 640x480 VGA, which was one of the original VGA formats.

enter image description here

The horizontal timing, shown at the top of the picture above, represents one line of the screen (e.g. 640 visible pixels of a 640x480 display). Between each line of pixel data, there is a horizontal blanking area where no video is shown (this originally was primarily used in TV's to allow the CRT trace to move back from the right side to the left side of the screen, ready for the next line).

The horizontal sync is used to start the timing of each line. It is not quite as wide as the blanking area. Just before the horizontal pulse, there is a delay called the front porch. And just following the horizontal pulse is another delay called the back porch.

Although 640 pixels are displayed, 800 pixels are actually needed per line: 96 for the horizontal sync, 48 for the back porch, 640 for the video, and 16 for the front porch.

As shown in the diagram, each line is 31.77 µs long. Diving this by 800 pixels results in 39.7 ns per pixel. This corresponds to a 25.1 MHz clock rate.

The lines are gathered into frames, shown at the bottom of the picture. Like the timing for each line, there is a vertical blanking interval at the beginning of each frame (this originally was primarily used in TV's to allow the CRT trace to move back from the bottom of the screen to the top, ready for the next frame). On some older CRT TV sets, it was possible to "roll" the picture down and actually see this interval as a black bar across the screen. Like the line timing, there is a front porch and back porch area in the timing.

Although 480 lines are displayed, 521 lines are actually needed per frame: 2 for the vertical sync, 29 for the back porch, 480 for the visible lines video, and 10 for the front porch.

As shown in the diagram, each frame is 16.784 ms long. This corresponds to a 59.5 Hz frame rate.

tcrosley
  • 47,708
  • 5
  • 97
  • 161
  • I dont understand that why we need front porch and back porch, I mean we could just send a horizontal sync signal after this line finished, RGB signal ... H sync, next line. RGB signal ... H sync, next line and so on – krosshj May 26 '20 at 06:23
  • @krosshj - it makes more sense if you look at how a (simple) CRT monitor works. The display is actually >640px wide, and the front porch / back porch is essentially just padding the image with black. This means that even if your alignment is off by a few pixels the image isn't clipped, and means you don't need separate circuitry to shut off the electron guns while scanning to the next line. That being said, there are reduced-porch timings for LCDs. – TLW Oct 10 '21 at 21:45
  • @TLW Thanks, got it – krosshj Nov 28 '21 at 03:37
  • I suppose GND means "ground", and N/C means "no connection", rather than "normally closed". – H. H. Sep 28 '22 at 03:51