game console project/VGA signal problem

Discuss anything not related to the current Uzebox design like successors and other open source gaming hardware
Post Reply
User avatar
Vitis
Posts: 24
Joined: Thu Jul 10, 2014 7:00 pm

game console project/VGA signal problem

Post by Vitis »

Greetings Uzeboxers,

I have created a prototype for my microcontroller-based video game console project. The first prototype is very rudimentary and includes resistor ladder-based DACs for the VGA analog color signals. I wrote an interrupt-driven VGA signal generator program that is supposed to output a red screen, but the LCD monitor just goes black whenever I connect it. I have adjusted the timing parameters, but the problem still persists. I'm using standard VGA signal specifications (640x480 60Hz):
http://www.javiervalcarce.eu/wiki/VGA_V ... ifications

I'm not sure what the issue is, so I figured I would get advice from the Uzebox community before investing more time in a possible dead end.

I have compiled a list of possible problems and possible solutions to each problem:

1) VGA pins 5,6,7,and 8 are connected to ground but 10 is not.
Connect VGA pin 10 to ground.
2) There are no resistors on the HSYNC and VSYNC outputs.
Solder resistors somewhere in the 50-100 ohm range to the VSYNC and HSYNC outputs.
3) The sync pulses use negative logic.
Try positive logic.
4) The microcontroller's pins use 3.3v logic level. (I have read that VGA monitors work with 5v or 3.3v logic, but I don't know if that's true.)
Shift the logic level to 5v using transistors.
5) The falling edge of the vsync pulse coincides with the falling edge of the hsync pulse.
Shift the falling edge of the vsync pulse to coincide with the horizontal front porch.

I don't have an oscilloscope, but the IDE I'm using has a logic analyzer. (I have cut out the domain scale because it doesn't reflect the actual VGA signal. Since the logic analyzer I'm using seems to have a fixed domain, I had to reduce the period just to get the sync pulses to display properly.)

Any help or suggestions would be greatly appreciated.

Regards,
-Vitis
Attachments
activeVideo.png
activeVideo.png (14.35 KiB) Viewed 6716 times
vsync.png
vsync.png (14.16 KiB) Viewed 6708 times
User avatar
Vitis
Posts: 24
Joined: Thu Jul 10, 2014 7:00 pm

Re: game console project/VGA signal problem

Post by Vitis »

I just figured out the problem. I have discovered that if the active video portion of each horizontal line is even one clock cycle too long the screen goes black, and if it's just a single clock cycle too short the image will not fill the entire screen. It took a lot of trial and error to tune the assembly code to get it to work. The attached image is just a test with some random colors displayed on an old LCD screen.
Attachments
VGAcolors.png
VGAcolors.png (447.36 KiB) Viewed 6696 times
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: game console project/VGA signal problem

Post by CunningFellow »

good work :)
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: game console project/VGA signal problem

Post by uze6666 »

Good you found out since not a lot of folks here are familiar with VGA timing. Timing is really a pain with NTSC too since a single cycle off and the whole images shears. In any cases, you have a stable interrupt-driven routine, the hardest part is done! 8-)
User avatar
Vitis
Posts: 24
Joined: Thu Jul 10, 2014 7:00 pm

Re: game console project/VGA signal problem

Post by Vitis »

Yeah, it was difficult to get the timing right, but I'm really happy with the result. I'm currently using 8-bit color, but I'm thinking about switching to 6-bit color to free up some RAM space. I think that there's a lot that can be done with just 64 colors. (The NES did some really interesting games with only 54 colors!) I'm currently trying to figure out how to implement a frame buffer for 6-bit color values without wasting RAM space by using a two dimensional array of unsigned 8-bit integers. I thought about somehow using 6 Boolean variables per pixel, but that approach has its problems.
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: game console project/VGA signal problem

Post by CunningFellow »

16 colours is easy.

You get to use the SWAP instruction.

6Bpp is hard. The quickest way is a 768 (12x64) jump table if you don't have enough clocks to spare for shifts.
User avatar
Vitis
Posts: 24
Joined: Thu Jul 10, 2014 7:00 pm

Re: game console project/VGA signal problem

Post by Vitis »

16 colors would definitely be easier, and it would have the benefit of freeing up enough RAM to significantly increase the resolution. With the higher resolution, dithering would become more effective at simulating a larger color palette.
Post Reply