I'm happy to show a major milestone tonight; I got NTSC working on VGATonic's rev A board!
Call it NTSCTonic!
Here are the vitals:
- 320x240 'Fake' Progressive scan (as in not interlaced)
- 4 Bit Color
- (There are a lot more available for a future 256 color mode; I'll explain below)
- 21.977 MHz estimated top SPI Speed (so, 71 frames per second - capped at 60)
- Equation derived here, with a user clock of (17,896,845.40452/2) Hz
Getting NTSC To Work
It's in a messy state right now so I won't post the firmware that made it happen (watch for it soon!), but here's the rough sequence I took to getting NTSC working on VGATonic:
- Find a clock setting on the Linear LTC6903 which is a multiple of the NTSC colorburst frequency of 3.57954 MHz - OCT 14 DAC 100 gives us 17,896,845.40452 Hz, or a .005% error for 5x the NTSC clock
- Figure out which shades of colors I had. 360 degrees divided by 5 means 5 phases/colors, but since it is an odd number I can also INVERT those phases (shift them by 180) for 5 free phases. That leaves us with this:
Phase Degrees from Colorburst 0 36 72 108 144 180 216 252 288 324 Color Name Yellow Light Green Green Cyan Indigo Blue Purple Magenta Red Orange
- If you look at the schematic for the rev A board (linked nearby) you'll note I also have a number of outputs for "Luma", which controls brightness. For this firmware release, I wanted to easily match one of the VGA modes, and 16 color/4 bit allowed me to do that with limited colors and luma.
- A motivated builder could get up to 10 shades + Black/White Gray (11) and 16 shades of luma, or 176 colors by just changing the mapping. For more colors, you'll need a higher frequency for more phases.
- Also, note that the colors won't match VGA perfectly, so you'll have to come up with translations (these 16 are hard coded in VHDL and it fits easily in the CPLD).
- In practice, my colorburst frequency was .07% off - it works on my monitors, but seriously... if you do an NTSC project, use an oscillator with a magic frequency multiple of 3.57954 MHz instead of trying to do it like this!
I will post some code soon if you want to build it, then I will work on adding a higher resolution VGA option on the rev B board!