Generating composite video with an FPGA

Requests, not necessarily related to fpga4fun...

Generating composite video with an FPGA

Postby elpuri » Mon Apr 05, 2010 10:58 pm

Hi,

has anyone tried generating (NTSC) composite (chroma + luma) video signal with an FPGA without a clock source that is a multiple of the color carrier frequency? I'm stuck with 50Mhz and 27Mhz that are available on the Altera DE2 board and I'm just not able to get any colors on the screen.

Does anyone have an idea how close to the nominal color carrier frequency should I be able to hit to get a normal TV to lock to it? I am just wondering if it's the frequency or am I just doing something else wrong. What I'm currently seeing are these about 1 "pixel" (~320 "pixels" per line) wide faint stripes which makes sense if the chroma data is outside of the band of a bandpass filter.

I was also wondering if something like this would work: I wouldn't even try to clock the FPGA with a multiple of the color carrier frequency, but either

a) use that accumulator trick demoed in the UART example on this site (http://www.fpga4fun.com/SerialInterface2.html). Or

b) generate a more at least 10 cycles long (the length of the color burst at the beginning of the line to which the TV tries to lock into) lookup table that I would output as fast as I can (~75Mhz?) and which would generate a sine wave with a frequency hopefully closer to the right one.

Could a or b work or can I get close enough by with the 27/50Mhz clocks and an internal PLL?
elpuri
 
Posts: 55
Joined: Thu Apr 12, 2007 6:55 pm

Postby NickH » Tue Apr 06, 2010 8:52 pm

Hi there,

ISTR it needs to be very accurate (3ppm or something?). But I guess a version of (a) might work. Take a look at this too: http://www.fpga4fun.com/DDS.html

You could have a phase accumulator with (say) 24 bits; increment it every clock cycle by (1<<24)*burst_freq/clock_freq. Then take the top 6 (or so) bits, to index a sine wave LUT. The frequency accuracy will be limited by your crystal oscillator.

Adding an offset before you do the LUT, will give a different phase. (Changing the amplitude is a bit harder... you could have a few different LUTs for fine control, and a shifter for coarse?)

Regards,

Nick
NickH
 
Posts: 88
Joined: Tue Sep 02, 2008 1:53 pm

Postby elpuri » Wed Apr 07, 2010 3:04 am

Thanks for the input! I tried the phase accumulator + LUT trick with several different "native" clock frequencies (created from the onboard 50MHz with a synthesized PLL), but still no-go :(

I searched for other implementations and found this: http://opencores.org/project,fbas_encoder (needs opencores.org account). He seems to be doing fine with 16, 32 and 40MHz clocks and does pretty much the same thing I'm doing, yet I get no colors.

I checked with Signal Tap II and the output looks ok
Image

The opencores implementation has low-pass filtering hardware between the fpga and the tv, but then again he is outputting a squarewave and I'm making a LUT sine which shouldn't contain that much those high frequencies. Also I've seen people pull it off with square waves and without LPFing (http://www.rickard.gunee.com/projects/v ... /howto.php). I don't know if it makes a difference, but my boards video DAC is actually a current source and not a voltage source like those resistor ladders in those other designs.

I'm really at a dead end here. Anyone want to take a look at the VHDL? I can post it after a small clean up.
elpuri
 
Posts: 55
Joined: Thu Apr 12, 2007 6:55 pm


Return to Help requests