Beagleboard VGA output
This article describes how you can extract a VGA signal from the LCD headers on a revision C beagleboard using two transistors and a bunch of resistors.
Overview
The beagleboard normally provides two video signals, DVI-D and S-Video. We're going to hook into some of the signals going from the OMAP chip to the TFP410 chip (DVI interface). This means that we'll tell the operating system to use the DVI-D interface (rather than S-Video), and read out the digital pixel values as they are transmitted. The DVI-D signal will not be affected, so you could connect both a VGA monitor and a DVI-D monitor and see the same image, as long as the video mode is compatible with both monitors.
Hardware
The hardware consists of three digital-to-analog converters (R-2R ladders), one each for the red, green and blue channel, and two level shifters for the sync signals.
The present solution assumes that the system is using 16-bit pixels in 5-6-5 format, but you can easily extend it to full 24-bit colour by making the resistor ladders longer.
You will need:
Quantity | Part | Needed for |
---|---|---|
13 | 60 Ω resistor | R-2R ladders |
19 | 120 Ω resistor | R-2R ladders |
2 | 100 Ω resistor | Level shifters |
2 | 1 kΩ resistor | Level shifters |
2 | NPN transistor, e.g. BC547C | Level shifters |
If you can't find resistors with these exact values, pick something close enough (but see "explanation" below). Try to match the ladder resistors so that one is exactly twice as resistive as the other. I ended up using 60.4 Ω and 121 Ω myself. Use low-tolerance metal film resistors for the ladders.
I would recommend some kind of header or other means of connecting and disconnecting the adapter from the beagleboard, in case you want to change things later. I settled for ribbon cables with headers on one end, soldered directly to the beagleboard at the other end. Another approach would be to solder two receptacles directly to the beagleboard, and plug two 20-way ribbon cables or a PCB with matching headers into them. It's up to you.
Schematic
Disclaimer: There could be errors in the diagram. Please double check all connections and pin numbers with the beagleboard system reference manual. If you've successfully built the adapter from the schematic, let me know and I'll remove this disclaimer.
You can pick up the 5 V rail from J4:1 and ground from J4:20, or use the supply which is powering the beagleboard.
Explanation
The digital data lines carry the actual pixel values, expanded into 24 bits. The expansion is done by repeating the most significant bits, so e.g. the five red bits R4 R3 R2 R1 R0 are transmitted as R4 R3 R2 R1 R0 R4 R3 R2 on lines 23 through 16. A logic one is encoded as 1.8 V, and a logic zero is at ground potential. The resistor ladder has an equivalent series resistance of 60 Ω, and the VGA load (monitor) has an input impedance of 75 Ω according to the VGA specification. These resistances will form a voltage divider, converting the 1.8 V peak voltage into 1.8 * 75 / (75 + 60) = 1.0 V, which is the specified peak voltage for a VGA signal.
The sync signals are also at 1.8 V, but VGA requires 5 V TTL signals. The transistors act as TTL inverters. When the base is at ground potential, the transistor blocks, and the output signal is pulled up to 5 V via a 1 kΩ resistor. When the base is at 1.8 V, the transistor becomes open, essentially shorting the output signal to ground. Modern VGA monitors don't care about sync polarity. If you are planning to use a really old VGA monitor, you may have to add an extra inverter to either or both of the sync signals, depending on which video resolution you'll be using.
Caution
You probably already know this, but please take measures to avoid electrostatic discharge. If you're standing on a vinyl floor, wearing rubber shoes, combing your hair with a cat while handling the beagleboard, it may become damaged in non-obvious and strange ways.
Don't forget to verify that your newly attached wires aren't shorted, preferably before connecting power.
Software
Once the hardware is up and running, you may or may not get a picture on your VGA monitor. In either case, you should still get a valid DVI-D signal, allowing you to interact with the system. However, it's a good idea to issue the following commands over an ssh connection to the beagleboard, if possible, because you'll be manipulating the video timing parameters and the picture could disappear completely.
First, make sure to select your desired resolution at boot, e.g. omapfb.mode=dvi:1024x768-16@60. Avoid the R flag (reduced blanking).
When the system is up, cat the following file: /sys/devices/platform/omapdss/display0/timings
The output is in the format pixclock,xres/hfp/hbp/hsw,yres/vfp/vbp/vsw
Field | Unit | Description |
---|---|---|
pixclock | picoseconds | The duration of one pixel |
xres | pixels | Width of visible area (typically width of framebuffer) |
hfp | pixels | Horizontal front porch |
hbp | pixels | Horizontal back porch |
hsw | pixels | Horizontal sync width |
yres | rows | Height of visible area (typically height of framebuffer) |
vfp | rows | Vertical front porch |
vbp | rows | Vertical back porch |
vsw | rows | Vertical sync "width" (in rows) |
Details are available in the kernel sources, in Documentation/arm/OMAP/DSS.
Getting an image at all
As root, experiment with the values in timings. If your monitor can display the current horizontal and vertical frequency, study how they change.
Try out various pixclock values first, until you have a stable image on the screen. Then tweak the porches and sync widths until you're satisfied with the size and placement of the image.
Fixing the right border
Some display lines may look strange. This is because the digital data bus we're sampling doesn't revert to black after each display line, so the rightmost pixel will "carry over" through the horizontal blanking period and into the beginning of the next line. Some monitors calibrate themselves during horizontal blanking, so whatever voltage they see during that time will be considered black in the upcoming line. Try to move the mouse cursor along the right end of the screen and see if you get this strange phenomenon.
If so, you can fix it easily by adding a black pixel to the right of each video line:
The timings file describes the dimensions of the actual video signal. The framebuffer, i.e. the chunk of memory where all the pixels are stored, is described using something called an overlay (/sys/devices/platform/omapdss/overlay0/...).
This means that we can modify the dimensions of the video signal, extending it somewhat to the right, without modifying the size of the framebuffer. The width has to be a multiple of eight pixels, so we have to go from e.g. 1024 to 1032.
This fixes the VGA signal, but unfortunately the DVI-D picture now has a small black border along the right edge. I don't know of a way to fix this properly, but most monitors allow the user to resize and move the image around freely, so you might be able to scroll those black pixels off the screen.
Examples
My monitor works with the following parameters:
Boot mode | Modified timings |
---|---|
1024x768-16@60 | 60000,1032/120/128/32,768/3/15/4 |
800x600-16@75 | 50000,808/34/198/20,600/23/37/6 |
I have configured my boot scripts to update the timings file automatically one second after x.org has started.
A better way?
Writing to timings directly is a kludge, and it's probably possible to get x.org to use VGA-compatible timings in the first place. This will definitely be an issue if you want to be able to switch between different video modes during regular use. I'm using a fixed resolution, so I haven't looked into this yet, but it's probably just a matter of putting the right thing in your xorg.conf.
Please post your suggestions on this page!
Troubleshooting
Verify that there are no shorts or breaks. When the device is on, verify that the board is configured for DVI-D output, and that the DVI-D signal is still working. Fill the screen with pixels in various colours (black, white, red, green, blue, ...) and study the DC voltage at various points in the circuit. Experiment with different resolutions and timings.
Posted Sunday 17-Jan-2010 17:00
Discuss this page
Disclaimer: I am not responsible for what people (other than myself) write in the forums. Please report any abuse, such as insults, slander, spam and illegal material, and I will take appropriate actions. Don't feed the trolls.
Jag tar inget ansvar för det som skrivs i forumet, förutom mina egna inlägg. Vänligen rapportera alla inlägg som bryter mot reglerna, så ska jag se vad jag kan göra. Som regelbrott räknas till exempel förolämpningar, förtal, spam och olagligt material. Mata inte trålarna.
Mon 18-Jan-2010 15:17
Wed 20-Jan-2010 10:42
Fri 22-Jan-2010 00:53
For the R2R ladder would maybe save some money if instead of using resistors of double the resistance, just put two in series? I do that with R2R DAC's for VGA and sound production. For example, interfacing with a VGA I use a bunch of 270 ohm resistors to approximately match the 75ohm impedance of the VGA. For audio, I use 10K resistors mostly.
SMD resistors on a roll, are usually from the same batch, so they are pretty well matched. Saves on buying 1% types, but the price difference between 5% is small anyway.
Wed 27-Jan-2010 23:37
Linus Åkesson
Thu 28-Jan-2010 16:18
It's a TM7100 from Deltaco, 7" TFT 1024x768, VGA and two composite inputs. Very handy when playing around with video signals.
Thu 28-Jan-2010 22:19
How would you modify the design to send out a combined sync signal? I have a display in my car that is 400 x 234 but the input is RGBs.
Thank you.
Trevor Johnson
Wed 17-Feb-2010 15:54
Sun 7-Mar-2010 16:31
I just got my VGA converter ready and it seems to work great. The picture on the VGA side has some top rows on the bottom even after i adjusted the monitor(quite old nokia 500 Xa LCD monitor). The colors seem ok(the orange angstrom logo and the blue text), though i haven't had any full color pictures up yet, so don't know about the graduated colors, that TrevJ commented about. I have both VGA and DVI on(straight HMDI cable to a TV).
The schematic is fine. I added the DDC lines, 5V and 1,8V lines including voltage converters for the DDC lines on mine based on the sparkfun i2c level converter.
Just finished it like half an hour or so ago.
Thank you very much.
Trevor Johnson
Mon 8-Mar-2010 10:19
My BeagleBoard just arrived last week but I'm having to use a borrowed monitor until I sort out something else (like this adapter).
Sun 21-Mar-2010 07:28
Just out of curiosity, do you know if S-Video to VGA converter will work? like http://www.svideo.com/video2vga.html.
Linus Åkesson
Tue 23-Mar-2010 07:09
Just out of curiosity, do you know if S-Video to VGA converter will work? like http://www.svideo.com/video2vga.html.
Yes, it should work. You'd be limited to S-Video resolution, though.
Sun 4-Apr-2010 11:40
I've been struck with a beagleboard for 6 months now( i don't have anything except VGA monitors!) and now i'm going to try this. Can you throw some light on the connections to be taken from the beagle board? Images would be of great help.
Cheers,
pracas
Fri 9-Apr-2010 06:09
Isn't the nominal current only 0.1 mA ? I have this info from the OMAP3530 datasheet.
Linus Åkesson
Sat 24-Apr-2010 18:52
Isn't the nominal current only 0.1 mA ? I have this info from the OMAP3530 datasheet.
Good point! I didn't think of that. This should in theory cause non-linearities, but I have looked at gradients and they look all right.
Thu 8-Jul-2010 20:10
From information in the net, only some non standard monitors use 1v level
http://microvga.com/faq/electrical/what-are-vga-voltage-levels
http://en.wikipedia.org/wiki/Video_Graphics_Array#Technical_details
http://www.ti.com/litv/pdf/slas343a
Or this beacuse the blanking level is 350mV and this offsets the 700mV to be 1v peak white?
Wed 22-Sep-2010 11:01
Thanks and regards,
..Partha
ajaysusarla at gmail [dot]com
Fri 24-Sep-2010 17:30
Anybody with any experience so far ??
Thu 25-Nov-2010 13:16
I have no experience with this, but wouldn't it be possible just to connect an HDMI to DVI adapter followed by a DVI to VGA adapter to the HDMI port on the BB?
/G
Sun 28-Nov-2010 04:53
I have no experience with this, but wouldn't it be possible just to connect an HDMI to DVI adapter followed by a DVI to VGA adapter to the HDMI port on the BB?
/G
Fri 3-Dec-2010 17:20
OMAP2-DSS allows you to set this easily in display-generic.c, in generic_panel_probe():
dssdev->panel.config = OMAP_DSS_LCD_TFT;
dssdev->panel.timings = rwc_vga_panel_timings;
dssdev->panel.acbi = 0;
dssdev->panel.acb = 0x28;
Wed 2-Mar-2011 13:47
I tried using the same system for a BB XM. Somehow the board does not boot up when the circuit is plugged in. I am getting the DVI output but nothing on the VGA screen (plugged in after the boot). Any ideas??
André van Schoubroeck
Sat 19-Mar-2011 20:03
I just got my VGA converter ready and it seems to work great. The picture on the VGA side has some top rows on the bottom even after i adjusted the monitor(quite old nokia 500 Xa LCD monitor). The colors seem ok(the orange angstrom logo and the blue text), though i haven't had any full color pictures up yet, so don't know about the graduated colors, that TrevJ commented about. I have both VGA and DVI on(straight HMDI cable to a TV).
The schematic is fine. I added the DDC lines, 5V and 1,8V lines including voltage converters for the DDC lines on mine based on the sparkfun i2c level converter.
Just finished it like half an hour or so ago.
Thank you very much.
I have a question about the DDC lines. These are to return the monitor identification and information.
But what does the BeagleBoard do with the values. Will it auto-configure the display timings based on these values?
Also, if I look at these I will need to supply 5 volts on pin 9 http://pinouts.ru/Video/VGAVesaDdc_pinout.shtml
The SDA and SCL, are they supposed to be level shifted to 5 volts? Or what's their signal level supposed to be?
Tue 26-Apr-2011 19:23
Andre wrote:
I just got my VGA converter ready and it seems to work great. The picture on the VGA side has some top rows on the bottom even after i adjusted the monitor(quite old nokia 500 Xa LCD monitor). The colors seem ok(the orange angstrom logo and the blue text), though i haven't had any full color pictures up yet, so don't know about the graduated colors, that TrevJ commented about. I have both VGA and DVI on(straight HMDI cable to a TV).
The schematic is fine. I added the DDC lines, 5V and 1,8V lines including voltage converters for the DDC lines on mine based on the sparkfun i2c level converter.
Just finished it like half an hour or so ago.
Thank you very much.
I have a question about the DDC lines. These are to return the monitor identification and information.
But what does the BeagleBoard do with the values. Will it auto-configure the display timings based on these values?
Also, if I look at these I will need to supply 5 volts on pin 9 http://pinouts.ru/Video/VGAVesaDdc_pinout.shtml
The SDA and SCL, are they supposed to be level shifted to 5 volts? Or what's their signal level supposed to be?
The VESA E-DDC specification specifies use of I2C at +5V.
Wed 11-May-2011 19:17
Some monitors provide support for 1V peak-to-peak signals,
but they are not standardized.
So why not 0.7v in your calculations?
Option: Using two 2R's in parallel to make the R's
And a there are less R's than 2R's,
so less waste than putting two R's in series to make 2R
Tue 31-May-2011 17:49
Thu 2-Jun-2011 17:03
Sat 4-Jun-2011 06:02
Linus Åkesson
Fri 1-Jul-2011 12:00
Andre wrote:
Also, if I look at these I will need to supply 5 volts on pin 9 http://pinouts.ru/Video/VGAVesaDdc_pinout.shtmlIn my experience, if you don't need DDC then you can leave pin 9 floating; all monitors will gladly display the signal anyway.
Linus Åkesson
Fri 1-Jul-2011 12:31
Some monitors provide support for 1V peak-to-peak signals,
but they are not standardized.
So why not 0.7v in your calculations?
Hmm, you are quite right. The answer is that it's a mistake. However, my setup is working, and a possible explanation might be that the digital signals are current limited or have an internal resistance that compensates for this error.
And a there are less R's than 2R's,
so less waste than putting two R's in series to make 2R
Splendid!
Thu 22-Mar-2012 15:54
echo "your new timings" > /sys/devices/platform/omapdss/display0/timings
Thu 21-Jun-2012 14:21
http://beagleboard.org/static/BB-xM_REV_C-2011-05-23.zip
Sat 19-Jan-2013 06:31
Tue 2-Apr-2013 20:38
Mon 10-Jun-2013 18:45
https://sites.google.com/site/scidiy/pc-diy/hdmi-to-vga
As none can see anything in the section "How to wire it up:", can anyone show us? (that site has no way to contact (or know who is) the owner...)
I'm wondering here, can someone draw the schematics using that thinking, with the suggested improvements:
a) The original project uses software to generate the H/Vsync signals and thereby it uses up 2 valuable GPIO's. So we need to generate these signals with a couple cheap and simple oscillators (NE556). The maker chose to generate them with software but maybe it is more convenient to do that electronically with a NE556 dual timer IC.
1) added the DDC lines, 5V and 1,8V lines including voltage converters for the DDC lines on mine based on the sparkfun i2c level converter.
2) For the R2R ladder would maybe save some money if instead of using resistors of double the resistance, just put two in series? I do that with R2R DAC's for VGA and sound production. For example, interfacing with a VGA I use a bunch of 270 ohm resistors to approximately match the 75ohm impedance of the VGA. For audio, I use 10K resistors mostly. SMD resistors on a roll, are usually from the same batch, so they are pretty well matched. Saves on buying 1% types, but the price difference between 5% is small anyway. (Saves room too, for those who desire smaller mountings)
3) Option: Using two 2R's in parallel to make the R's
And a there are less R's than 2R's,
so less waste than putting two R's in series to make 2R
4) Or one could try to use a FMS-3818 tripple dac
Can anyone? Thanks.
Paul
Mon 21-Oct-2013 08:45
Fri 31-Jan-2014 01:31
.....10k ohm... |/---- Red (repeat for Green and Blue)
hblank... -/\/\--|
...................... |\ 2n3904 transistor
........................ |
...................... gnd
Sat 29-Mar-2014 15:55
.....10k ohm... |/---- Red (repeat for Green and Blue)
hblank... -/\/\--|
...................... |\ 2n3904 transistor
........................ |
...................... gnd
Fri 30-Jun-2017 14:15
I have no experience with working with the confusing and complex LCD variations. to be honest, I don't know what to do with most the LCD pins on a BBB
for reference: https://www.element14.com/community/message/224509/l/bbb-and-tft-lcd-driver-board#224509