VGA controller

Building your first 6502-based project? We'll help you get started here.
Post Reply
zakr
Posts: 2
Joined: 25 Dec 2016

VGA controller

Post by zakr »

Recently I've build very simple 6502 computer. Now I want to add VGA controller to it. I want to build a simple board with avr communicating via I²C with main board. The problem is I don't know how to solve timing problems when processing orders from main board. As I understood AVR needs to constantly send VGA signal. So if I interrupt avr when it needs to generate VGA signal I won't have time to process 6502's order. I can also interrupt avr to process order but then my VGA timing will be off and the video will be disturbed. What's the correct way of doing that? I think I haven't understood something or there's completely different methode to generate VGA signal.
Vladimir
Posts: 78
Joined: 20 Jul 2016
Location: Irkutsk, Russia

Re: VGA controller

Post by Vladimir »

User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: VGA controller

Post by GARTHWILSON »

See also the serial VGA circuits available that are shown at the end of the 6502 primer's "Displays" page, at http://wilsonminesco.com/6502primer/displays.html .
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
zakr
Posts: 2
Joined: 25 Dec 2016

Re: VGA controller

Post by zakr »

Thanks
Vladimir
Posts: 78
Joined: 20 Jul 2016
Location: Irkutsk, Russia

Re: VGA controller

Post by Vladimir »

I'll add a little. If you want to do your own project, as a first step you should study the theory of VGA, i.e. how it works. The VGA signal is not continuous, it does have holes.
Communication with the VGA monitor is an unconditioned priority for ATmega. Here, all events must come very timely (match to right clock pulse). I mean the edges of horizontal and vertical synchronization pulses and video. The communication between ATmega and 6502 SBC is possible mainly during vertical flyback. This is not a lot of time, but a possibility anyway. Study the VGA timings.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: VGA controller

Post by cbmeeks »

One thing I'd like to add is that the Propeller micro-controller from Parallax is an excellent source for VGA output.

It cost $8 (plus a small EEPROM for about $1-$2) and passives. That's pretty much all you need and any USB to serial programmer can program it.

There are TONS of NTSC and VGA drivers developed for it and the assembly language it uses is pretty easy to learn.

The only downside is that it's 3v3 only. But many things are these days.

https://www.parallax.com/

The Propeller has 8 cores called "COGS" that run in parallel. A single COG can drive a VGA interface while another COG would fetch video data, etc.

Anyway, it's probably about the best non-PLD/FPGA solution for driving video.
Cat; the other white meat.
User avatar
KC9UDX
Posts: 246
Joined: 07 Dec 2013
Location: The Kettle Moraine

Re: VGA controller

Post by KC9UDX »

Isn't someone here running a Propeller at 5V for some long time?
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: VGA controller

Post by cbmeeks »

KC9UDX wrote:
Isn't someone here running a Propeller at 5V for some long time?
If you ask the people over at Parallax, some will say they've pushed it to 5V. Especially for just I/O. But it isn't recommended.

It's one of those things that if it works...then great. But don't expect it to. And I've never read anyone say they run it at 5V for anything close to production.
Cat; the other white meat.
User avatar
KC9UDX
Posts: 246
Joined: 07 Dec 2013
Location: The Kettle Moraine

Re: VGA controller

Post by KC9UDX »

cbmeeks wrote:
KC9UDX wrote:
Isn't someone here running a Propeller at 5V for some long time?
If you ask the people over at Parallax, some will say they've pushed it to 5V. Especially for just I/O. But it isn't recommended.

It's one of those things that if it works...then great. But don't expect it to. And I've never read anyone say they run it at 5V for anything close to production.
I did, it's someone here, I think. I can't quite recall who or what the project was.

It got my attentioin, because upon finding out that the Propeller I bought was 5V intollerant, I put it in permanent storage. To add bus transceivers to the project I intended to use it for defeated the point of using it.
User avatar
jac_goudsmit
Posts: 229
Joined: 23 Jun 2011
Location: Rancho Cucamonga, California
Contact:

Re: VGA controller

Post by jac_goudsmit »

KC9UDX wrote:
Isn't someone here running a Propeller at 5V for some long time?
I did. I used a Propeller Quickstart board running a modified verison of my L-Star software as a troubleshooting tool, ROM replacement and virtual peripheral for my 5V MicroKim in my KimStar project (a side project of L-Star). See https://hackaday.io/project/4418. I had the I/O lines connected to the 5V bus for many hours and never had a problem.

If your project is simply to add a VGA output with a Propeller, you will run out of pins if you want to put the Propeller on the entire data bus to give the 6502 access to the VGA memory space. But if you want to just generate e.g. 80x25 columns of text, you only need 11 address lines instead of 16, so you should have enough lines left over for a 6-bit (+hsync + vsync) VGA text output. I'm thinking of doing this to add video to my MicroKim some day.

For graphics, you will need more hardware: the Propeller only has 32K of (hub) RAM and the firmware is loaded there too. But it's possible to let multiple Propellers work together and in sync (clock them all from the same oscillator) and let each of them generate part of the picture. But with graphics, you'll probably also run out of address space on the 6502 really quickly so you would have to think of different ways of interfacing anyway.

===Jac
Martin_H
Posts: 837
Joined: 08 Jan 2014

Re: VGA controller

Post by Martin_H »

I tried running one at 5 volts and it acted erratically, when I switched it back to 3.3 volts it worked normally, so I haven't tried it since.

One thing I am curious about. Is it possible to use the VGA driver with external RAM? That would allow for bitmapped graphics including text using the internal font in ROM.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: VGA controller

Post by BigEd »

Jac - were you running the Propeller with a 3V supply, but with all I/O at 5V? That would be a sort of hybrid solution, moderately convenient, all it needs is a 3V regulator. Or a big resistor!
Martin_H
Posts: 837
Joined: 08 Jan 2014

Re: VGA controller

Post by Martin_H »

BigEd wrote:
Jac - were you running the Propeller with a 3V supply, but with all I/O at 5V? That would be a sort of hybrid solution, moderately convenient, all it needs is a 3V regulator. Or a big resistor!
Many people mix the Propeller running at 3.3 volts with 5 volt components. For output pins you can ignore the issue if the receiver interprets 3.3 volts as logic 1. For input pins you put a large resistor (3.3 K ohm or greater) to drop the current low enough that the Propeller can no longer be damaged by a voltage above 3.3 volts.
User avatar
jac_goudsmit
Posts: 229
Joined: 23 Jun 2011
Location: Rancho Cucamonga, California
Contact:

Re: VGA controller

Post by jac_goudsmit »

BigEd wrote:
Jac - were you running the Propeller with a 3V supply, but with all I/O at 5V? That would be a sort of hybrid solution, moderately convenient, all it needs is a 3V regulator. Or a big resistor!
I ran the Propeller with a 3.3V supply (the QuickStart board has a built-in 3.3V regulator so I was forced to do it that way) and it was attached to the 5V address bus and data bus, and the R/!W and Phi2 outputs of the NMOS 6502. Data in both directions was transfered without problems (at 1MHz) and the Propeller didn't even get warm.

The MicroKIM has pull-up resistors on the data bus if I'm not mistaken, which helps with the 3.3V signals that the Propeller would put on the data bus, but I've used the Propeller on a 6502 (NMOS) system without pullups too.

Reversely, the Propeller seems to be fine with the 5V input signals. It's CMOS based so the inputs have a very high impedance. The thing that kills the I/O pins is current, and if the voltage is too high, the diode will sink too much current to keep the internal voltage down, and destroys itself. Based on the specifications of the Propeller, you should have a 2700 Ohm series resistor on input pins to make them 5V tolerant. There's an article on the Internet somewhere that explains it better than this.

Either way, direct connections without series resistors worked fine in my case but "your mileage may vary". I won't take responsibility if you let the Magic Smoke escape. By the way, if the 6502 in your system happens to be a CMOS (65C02) version, it also has high impedance inputs so if there are 2k7 series resistors on the data bus, the Propeller should still be able to drive the data bus of the 65C02 high. I must have also tried 2k7 series resistors in an NMOS 6502 system at 5V but I think I must have; when I started on my Propeddle project, I didn't have many chips and I was very careful not to fry anything.

Anyway, I always had the power supply of the Propeller at 3.3V, not 5V.

===Jac
Post Reply