Author Topic: VGA RGB from a FPGA  (Read 4619 times)

0 Members and 1 Guest are viewing this topic.

Offline NivagSwerdnaTopic starter

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
VGA RGB from a FPGA
« on: July 10, 2018, 02:10:52 pm »
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 (around 256x256 768 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
« Last Edit: July 10, 2018, 05:21:43 pm by NivagSwerdna »
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 8951
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: VGA RGB from a FPGA
« Reply #1 on: July 10, 2018, 02:42:40 pm »
If the FPGA is fast enough to output HDMI (even at just 480p), do that and use a HDMI to VGA converter.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline NivagSwerdnaTopic starter

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: VGA RGB from a FPGA
« Reply #2 on: July 10, 2018, 03:02:16 pm »
If the FPGA is fast enough to output HDMI (even at just 480p), do that and use a HDMI to VGA converter.
Nope. I am planning to produce native 256x256 768 x 224
« Last Edit: July 10, 2018, 05:22:04 pm by NivagSwerdna »
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: VGA RGB from a FPGA
« Reply #3 on: July 10, 2018, 04:09:00 pm »
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.
 

Offline NivagSwerdnaTopic starter

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: VGA RGB from a FPGA
« Reply #4 on: July 10, 2018, 04:29:52 pm »
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.
Thanks 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?
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11265
  • Country: ch
Re: VGA RGB from a FPGA
« Reply #5 on: July 10, 2018, 05:08:31 pm »
If the FPGA is fast enough to output HDMI (even at just 480p), do that and use a HDMI to VGA converter.
Nope. I am planning to produce native 256x256
Do you actually think any display will sync to that?!
 

Offline NivagSwerdnaTopic starter

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: VGA RGB from a FPGA
« Reply #6 on: July 10, 2018, 05:21:15 pm »
If the FPGA is fast enough to output HDMI (even at just 480p), do that and use a HDMI to VGA converter.
Nope. I am planning to produce native 256x256
Do you actually think any display will sync to that?!
Sorry... i'm trying to multi-task and doing badly.... the screen is actually 768 x 224
 
The following users thanked this post: tooki

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14230
  • Country: fr
Re: VGA RGB from a FPGA
« Reply #7 on: July 10, 2018, 05:49:30 pm »
You may also consider the THS8135 from TI which is significantly cheaper.
 
The following users thanked this post: NivagSwerdna

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: VGA RGB from a FPGA
« Reply #8 on: July 10, 2018, 06:32:26 pm »
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.
Thanks 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?

20mA 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.
 
The following users thanked this post: NivagSwerdna

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11265
  • Country: ch
Re: VGA RGB from a FPGA
« Reply #9 on: July 10, 2018, 09:07:42 pm »
If the FPGA is fast enough to output HDMI (even at just 480p), do that and use a HDMI to VGA converter.
Nope. I am planning to produce native 256x256
Do you actually think any display will sync to that?!
Sorry... i'm trying to multi-task and doing badly.... the screen is actually 768 x 224
I was gonna say! :p I doubt any VGA receiver/decoder chip would even attempt to sync to that low a signal!
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7638
  • Country: ca
Re: VGA RGB from a FPGA
« Reply #10 on: July 11, 2018, 12:54:16 am »
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.
 

Offline Ultron81

  • Contributor
  • Posts: 33
  • Country: us
Re: VGA RGB from a FPGA
« Reply #11 on: July 11, 2018, 01:12:27 am »
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.
 
The following users thanked this post: NivagSwerdna

Offline NivagSwerdnaTopic starter

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: VGA RGB from a FPGA
« Reply #12 on: July 11, 2018, 09:09:17 am »
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.
I need this to work with old arcade monitors
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: VGA RGB from a FPGA
« Reply #13 on: July 11, 2018, 08:21:37 pm »
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.
 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
Re: VGA RGB from a FPGA
« Reply #14 on: July 12, 2018, 04:20:39 am »
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.
Thanks 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?

Your 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.
 
The following users thanked this post: NivagSwerdna

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Re: VGA RGB from a FPGA
« Reply #15 on: July 12, 2018, 05:10:38 am »
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.
Thanks 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?

Your 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.

If 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:



From https://reference.digilentinc.com/reference/programmable-logic/nexys-4-ddr/reference-manual

An 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.
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 
The following users thanked this post: NivagSwerdna

Offline NivagSwerdnaTopic starter

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: VGA RGB from a FPGA
« Reply #16 on: July 12, 2018, 10:05:38 am »
An 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.
I still feel a bit reluctant to expose my sensitive FPGA pins to the world albeit through a resistor network.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: VGA RGB from a FPGA
« Reply #17 on: July 12, 2018, 04:39:24 pm »
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
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7638
  • Country: ca
Re: VGA RGB from a FPGA
« Reply #18 on: July 12, 2018, 06:07:42 pm »
An 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.
I still feel a bit reluctant to expose my sensitive FPGA pins to the world albeit through a resistor network.
Just 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.
« Last Edit: July 12, 2018, 06:12:59 pm by BrianHG »
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: VGA RGB from a FPGA
« Reply #19 on: July 12, 2018, 06:52:56 pm »
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.
 
The following users thanked this post: NivagSwerdna

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7638
  • Country: ca
Re: VGA RGB from a FPGA
« Reply #20 on: July 12, 2018, 07:44:38 pm »
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.
If 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf