VGA RGB from a FPGA - Page 1
Forum section: electronics / projects

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 10, 2018, 02:10:52 pm
content: As part of my retro gaming diversion I would like to generate VGA from a FPGA (probably MachXO3 and or Cyclone V)...The resolution will be low (around256x256768 x 224) with a 6MHz pixel clock and appropriate blanking to drive an old fashioned CRT.I seem to have two preferred solutions... use a ADV7123 or use a resistor DAC (3 channels, 7 bits each) and then a THS7314.The ADV7123 is a pretty expen$ive device but otherwise would be my preferred solution. The THS7314 is cheap but I am a bit worried by wiring FPGA outputs together through the low R values in the least significant bits of the DAC.Any suggestions/ideas?Thanks in advance

author: NiHaoMike
author_rank: Super Contributor
timestamp: July 10, 2018, 02:42:40 pm
content: If the FPGA is fast enough to output HDMI (even at just 480p), do that and use a HDMI to VGA converter.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 10, 2018, 03:02:16 pm
content: Quote from: NiHaoMike on July 10, 2018, 02:42:40 pmNope. I am planning to produce native256x256768 x 224

author: james_s
author_rank: Super Contributor
timestamp: July 10, 2018, 04:09:00 pm
content: I've bought ADV7123s for a few dollars each on ebay and they worked fine.Resistor DACs are fine too though, for such low resolutions you're not going to notice any difference at all. I use resistor DACs for VGA on several of my FPGA boards and the video looks great.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 10, 2018, 04:29:52 pm
content: Quote from: james_s on July 10, 2018, 04:09:00 pmThanks for that.I was wondering about the current on the FPGA outputs with the two least significant bits potentially fighting? 20mA limit on each pin?

author: tooki
author_rank: Super Contributor
timestamp: July 10, 2018, 05:08:31 pm
content: Quote from: NivagSwerdna on July 10, 2018, 03:02:16 pmDo you actually think any display will sync to that?!

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 10, 2018, 05:21:15 pm
content: Quote from: tooki on July 10, 2018, 05:08:31 pmSorry... i'm trying to multi-task and doing badly.... the screen is actually 768 x 224

author: SiliconWizard
author_rank: Super Contributor
timestamp: July 10, 2018, 05:49:30 pm
content: You may also consider the THS8135 from TI which is significantly cheaper.

author: james_s
author_rank: Super Contributor
timestamp: July 10, 2018, 06:32:26 pm
content: Quote from: NivagSwerdna on July 10, 2018, 04:29:52 pm20mA seems high enough that it shouldn't matter. Admittedly I have not looked at the signals with a scope, but I have driven VGA monitors using 2-4 bits per color with simple resistors many times and it works just fine, don't over-think it. My DE-2 has a real DAC (ADV7123) but all of my other dev boards just use resistors.

author: tooki
author_rank: Super Contributor
timestamp: July 10, 2018, 09:07:42 pm
content: Quote from: NivagSwerdna on July 10, 2018, 05:21:15 pmI was gonna say! :p I doubt any VGA receiver/decoder chip would even attempt to sync to that low a signal!

author: BrianHG
author_rank: Super Contributor
timestamp: July 11, 2018, 12:54:16 am
content: Line double your video output. IE, repeat every line twice, running your pixel clock at double frequency. Then, you have a change of an off the shelf VGA screen working with your source video.You will need to adapt the number of lines before and after your V-Sync so the video output will look similar to a xxx X 480 VGA 480p signal.

author: Ultron81
author_rank: Contributor
timestamp: July 11, 2018, 01:12:27 am
content: There's a similar project that's been made for a Nintendo 64 -http://etim.net.au/n64rgb/tech/He used a CPLD and used a R2R ladder as the DAC. It works really well. He (Tim Worthington) has a lot of information about the project on his site. Just to give you some idea.Also, the THS7314s work pretty well, I have used them in console RGB projects before.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 11, 2018, 09:09:17 am
content: Quote from: BrianHG on July 11, 2018, 12:54:16 amI need this to work with old arcade monitors

author: james_s
author_rank: Super Contributor
timestamp: July 11, 2018, 08:21:37 pm
content: Old arcade monitors use the same scan rate as standard definition NTSC television and CGA computer monitors. It's pretty trivial either way though, with the FPGA you can have whatever scan rates you want. I even have some recreations of arcade games where I have it outputting native standard resolution and line doubled VGA simultaneously through separate ports, it works just fine. Something to consider if you want to drive an arcade monitor though is the RGB lines are usually expecting 0-5V rather than the 0-0.8V or so of a VGA monitor. Because if this you'll likely need an amplifier unless you level shift the FPGA pins upstream of the resistor DAC.

author: Bassman59
author_rank: Super Contributor
timestamp: July 12, 2018, 04:20:39 am
content: Quote from: NivagSwerdna on July 10, 2018, 04:29:52 pmYour resistors should all go into an op-amp buffer. It’s the standard adder circuit, the resistors tied together at the summing node (inverting input) of an op-amp. Something like this..Resistor values should be high enough so that the FPGA output has no trouble driving them.

author: hamster_nz
author_rank: Super Contributor
timestamp: July 12, 2018, 05:10:38 am
content: Quote from: Bassman59 on July 12, 2018, 04:20:39 amIf it was me, I wouldn't bother with the buffer - you will have more problems selecting and implementing the video buffer it that it will solve.For a sample design that is in wide production, have a look at:Fromhttps://reference.digilentinc.com/reference/programmable-logic/nexys-4-ddr/reference-manualAn FPGA won't have any problems driving these loads (6.6mA @ 3.3V), and I've used it with 100+ MHz pixel clocks with no issues.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 12, 2018, 10:05:38 am
content: Quote from: hamster_nz on July 12, 2018, 05:10:38 amI still feel a bit reluctant to expose my sensitive FPGA pins to the world albeit through a resistor network.

author: james_s
author_rank: Super Contributor
timestamp: July 12, 2018, 04:39:24 pm
content: Unless this is a very expensive FPGA I wouldn't worry about it. I have a pile of really cheap Cyclone II FPGA boards that have all the IO pins fully exposed with no protection at all. I've abused them numerous times driving speakers directly, monitors, LEDs, buttons, with no real thought at all on protection. After several years of playing with these things I've yet to damage one.On a related note, if you're interested in FPGA retro gaming I've been gradually plugging away at recreating the 70s Atari arcade games.https://github.com/james10952001

author: BrianHG
author_rank: Super Contributor
timestamp: July 12, 2018, 06:07:42 pm
content: Quote from: NivagSwerdna on July 12, 2018, 10:05:38 amJust add dual schottky diodes right at the VGA plug to GND and 3.3v to clamp the signals from the VGA plug.Unity gain rail-rail 3.3v high speed analog buffer amps will also work. Use 2x 3 channel ones, 1 for the RGB and the second for the syncs.When using the unity gain amps, don't forget to add a 150-470 ohm load at the input and a 75 ohm series resistor at the output.Even a simple high speed PNP emitter follower, like a MPSH81, with a 75 ohm pullup on the emitter + 75 ohm series resistor to the vga plug would also work.

author: james_s
author_rank: Super Contributor
timestamp: July 12, 2018, 06:52:56 pm
content: The one reason I could see using an amp here is for driving arcade monitors. As I mentioned earlier they typically expect 5V for full beam current and are not 75 Ohm. It will usually sort of work to drive them from a resistor DAC from 3.3V FPGA pins but you have to crank the brightness up and some monitors may not have enough range to provide a correct picture.

author: BrianHG
author_rank: Super Contributor
timestamp: July 12, 2018, 07:44:38 pm
content: Quote from: james_s on July 12, 2018, 06:52:56 pmIf you are driving an arcade monitor which might need a blanking black level, use an extra output bit with resistor on each color output as an active video signal & switch from my PNP emitter follower to a NPN emitter follower with a pull-down on the output.Personally, I would prefer using 2x 74HC574 powered from 5v to buffer the output of the FPGA. Clock them from another FPGA output as well. With this IC buffer, it's getting tough to kill the FPGA behind it.