Unseen wrote:Woozle wrote:Another idea I had is to just clock the FPGA using the GBA's oscillator and generate the video timing from that. The oscillator outputs a sine wave, but I'm not sure how I would use that as a clock signal...I'm thinking connecting the oscillator to some sort of comparator circuit to give me a square wave, anyone have experience with that?
I would use a single inverter from a 74HC14 from that. It will introduce a few nanoseconds delay, but that shouldn't be a problem - if it does, you should be able to compensate for it by setting up timing constraints relative to the clock for all input signals.
You only need to make sure that the FPGA's PLL is specified to work with such a low frequency - I don't remember the values for all Spartan families, but at least some of the older ones needed a minimum of 18MHz for the DLL (e.g. CLK0/CLK90/.../CLK2X outputs) and less than that for the PLL (CLKFX... outputs).
That's another issue. Xilinx Artix-7 PLLs need 8MHz minimum input frequency. I was going to try to mess around and see what they output if I go below that (would they even activate?).
I've been able to get by without using a PLL so far...but the GBA pixel clock was only triggering a few logic elements (write to buffer). Would a PLL matter more now that I'm trying to use the GBA clock to drive multiple sets of logic in the FPGA (meaning routing could cause clock skew between elements receiving the pixel clock) ?
For GBA to RGB (for PVM) I'm thinking about two methods,
-scale 4x horizontally (240 -> 960) then only use every third pixel (960 -> 320), scale 3x vertically (160 -> 480) and drop every other row (480 ->240)
-scale 3x horizontally then drop every other row (240 -> 720 -> 360) as well as cropping the left and right 20 pixel columns. Scale 3x vertically (160 -> 480) and drop every other row.
Both would give an output of 320x240. The first method would mess up the aspect ratio and the second would crop the image. I did a little comparison of a GBA frame in paints scaled these ways and it looked good enough.
Edit: I forgot the gba clock is 16Mhz and would work fine with PLL, 1st sentence was assuming gba had 4mhz clock (brain fart).