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
game console project/VGA signal problem
game console project/VGA signal problem
- Attachments
-
- activeVideo.png (14.35 KiB) Viewed 6718 times
-
- vsync.png (14.16 KiB) Viewed 6710 times
Re: game console project/VGA signal problem
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 (447.36 KiB) Viewed 6698 times
-
- Posts: 1486
- Joined: Mon Feb 11, 2013 8:08 am
- Location: Brisbane, Australia
Re: game console project/VGA signal problem
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!
Re: game console project/VGA signal problem
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.
-
- Posts: 1486
- Joined: Mon Feb 11, 2013 8:08 am
- Location: Brisbane, Australia
Re: game console project/VGA signal problem
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.
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.
Re: game console project/VGA signal problem
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.