Using USB @ 48MHz and VGA: how to generate the two freq?


#1

The USB port needs 48 MHz.
About the VGA I have a lot of pixel frequencies despite I’d like to use the 640x480 @ 60Hz
with 25.1 MHz clock (but 25.0 MHz works well).
How to have the two frequencies using the 16 MHz on-board oscillator and the single available PLL ?


#2

A while back I found this handy bit of old code for a 1.5x clock divider:

reg flop1, flop2;

always @ (posedge CLK48MHz) flop1 <= !(flop1 | flop2);

always @ (negedge CLK48MHz) flop2 <= !(flop1 | flop2);

wire vga_clk;

assign vga_clk = !(flop1 | flop2); //32MHz (1.5x)

…so that would get you a 32MHz clock which might be close enough to use one of the 31.5MHz 640x480 VGA timings? (depending on how forgiving your monitor is :sweat_smile:)

http://tinyvga.com/vga-timing/640x480@73Hz
http://tinyvga.com/vga-timing/640x480@75Hz


#3

What object is (flop1 flop2)?


#4

They’re just registers… sorry I think copy / pasting somehow removed the | characters that should’ve been in there! :face_with_raised_eyebrow: (have edited to fix)


#5

Unfortunately 32MHz gives not perfect images (numbers).
Anyway thanks for the interesting way to have a 1.5x “multiplier”.