| View previous topic :: View next topic |
| Author |
Message |
jwdonal

Joined: 27 Jun 2009 Posts: 244 Location: USA, NM
|
Posted: Wed Mar 10, 2010 4:30 pm Post subject: Still possible to buy a 21.47727MHz Oscillator? |
|
|
Are there any vendors that you can buy a 21.47727MHz oscillator from? I can find some vendors that have 21.47727MHz *crystals*...but no oscillators. And I don't want to have to make an RC-network in order to get an oscillator unless I absolutely have to.
Anyone know where I can buy one (or a few)?
Thanks!
Jonathon  |
|
| Back to top |
|
 |
kyuusaku
Joined: 27 Sep 2004 Posts: 1354 Location: .ma.us
|
Posted: Wed Mar 10, 2010 5:32 pm Post subject: |
|
|
This is why FPGA have DLL!
A) Most boards come with a 50 MHz: 50 * 3 / 7 = 21.429 MHz (<0.3% slow)
B) Use a very common 14.318 MHz: 14.318 * 3 / 2 = 21.477 MHz
C) Use a somewhat common 3.579 MHz: 3.579 * 6 = 21.477 MHz |
|
| Back to top |
|
 |
jwdonal

Joined: 27 Jun 2009 Posts: 244 Location: USA, NM
|
Posted: Wed Mar 10, 2010 7:07 pm Post subject: not that simple |
|
|
It's not that simple. In Xilinx devices the DCMs (what you're calling a DLL) and PLLs are restricted to certain minimum/maximum input/output clock frequencies. You are also restricted to certain M / N values based on those frequencies. In my case with my particular boards it is not possible to achieve a really good approximation of the 21.47727MHz rate of the original NES.
Also, using a device primitive to generate the clock is not what I really want since it makes my code architecture/device specific. I want the appropriate oscillator frequency coming right into the FPGA and then just some generic clock divider logic that can be used on any device. This will keep my code the most portable.
So with that said, anyone know where I can buy one still? I was thinking if all else failed I could buy an NES online and steal the oscillator from it. But I don't know if the NES used an all in one oscillator or if it used a crystal with additional on-board analog components to create the oscillator. Does anyone know which it is?
Pz!
Jonathon  |
|
| Back to top |
|
 |
kyuusaku
Joined: 27 Sep 2004 Posts: 1354 Location: .ma.us
|
Posted: Wed Mar 10, 2010 7:35 pm Post subject: |
|
|
It's not that big of an issue, which devices by Xilinx, Altera and Lattice CAN'T handle simple integer multiplication? I really don't see what it has to do with code portability, for each board you target, you still need to specify hardware constraints; think of clock generation as another constraint. As you can see 21.477 MHz oscillators are just not sustainable, so this is really the best option. I use 14.318 MHz oscillators since after being used in the IBM PC, they aren't going away.
The NES has a discrete crystal oscillator, so that won't be much use. 14.318 MHz osc I'm tellin' ya! |
|
| Back to top |
|
 |
jwdonal

Joined: 27 Jun 2009 Posts: 244 Location: USA, NM
|
Posted: Wed Mar 10, 2010 8:09 pm Post subject: ok |
|
|
| Quote: | | I really don't see what it has to do with code portability, for each board you target, you still need to specify hardware constraints |
There is some truth in that. I suppose requiring the user to figure out how they want to generate the input clock to the system is not really asking that much. Haha. Either way, it would still be nice if I just had to divide by 12 and 4 using some logic and be done. It would greatly simplify my clock generation block.
-----
So my DCMs minimum input clock frequency is 32MHz. No help there. My PLLs min CLKIN * (M/N) value is 400MHz. With a min CLKIN freq of 19MHz. The N divider value for the final output freq can be a pretty large number however. But that still doesn't really help.
So what is your suggestion for this situation? I really like your 14.318 MHz solution - I wasn't aware that that was a popular frequency. Good to know for sure. But...I don't see how it helps me with my particular setup.
I'm certainly open to any suggestions. Maybe there is some way of doing this that i just haven't thought of.
Last edited by jwdonal on Wed Mar 10, 2010 8:40 pm; edited 2 times in total |
|
| Back to top |
|
 |
kyuusaku
Joined: 27 Sep 2004 Posts: 1354 Location: .ma.us
|
Posted: Wed Mar 10, 2010 8:29 pm Post subject: |
|
|
Which chip and osc. frequency are you currently using?
Last edited by kyuusaku on Wed Mar 10, 2010 8:31 pm; edited 1 time in total |
|
| Back to top |
|
 |
jwdonal

Joined: 27 Jun 2009 Posts: 244 Location: USA, NM
|
Posted: Wed Mar 10, 2010 8:31 pm Post subject: |
|
|
Virtex-5 LXT
2 onboard oscillators available: 100MHz and 25MHz
There is also 1 open oscillator socket (which is what I wanted to put the 21.47727MHz oscillator in). |
|
| Back to top |
|
 |
kyuusaku
Joined: 27 Sep 2004 Posts: 1354 Location: .ma.us
|
Posted: Wed Mar 10, 2010 9:10 pm Post subject: |
|
|
| That minimum seems crazy, most of the time it's a couple MHz. Also, if the minimum frequency is 32 MHz, you can't DCM the 25 MHz osc? At the very least you could use use your 100 MHz: 100 / 14 * 3 = 21.43 MHz. It's not exact, but SIGNIFICANTLY more accurate than PC emulators and not perceivable anyway. |
|
| Back to top |
|
 |
jwdonal

Joined: 27 Jun 2009 Posts: 244 Location: USA, NM
|
Posted: Wed Mar 10, 2010 9:37 pm Post subject: hmmm |
|
|
Ok, so I went back and looked in the datasheet for the V5 to be sure I had the correct min input freq. The min I specified is correct. I also ran the architecture clocking wizard to see if it would let me specify anything less than 32 - it would not.
!HOWEVER! In looking at the extremely fine print in the datasheet I found that there is a "special" mode that you can put the DCM into which will allow for a minimum input clock freq of 1MHz! I have never used this mode before so I never knew about it until now. I'm used to designing for 100MHz+ systems at my job so I never had to use this mode. A concern I have however is that this mode does not allow you to utilize the clock feedback loop of the DCM which is used to help with real-time adjustments to clock skew/phase shifts. I'm going to give it a shot anyway and see what happens. First, I will try it using the 25MHz osc, then if that works fine I guess I will be on my way to buying a 14.318MHz osc! This will be really cool if this works!
I'm very glad we had this discussion! It seems I still learn something new almost every day about these Xilinx devices and I've been using them for over 8 years! |
|
| Back to top |
|
 |
jwdonal

Joined: 27 Jun 2009 Posts: 244 Location: USA, NM
|
Posted: Thu Mar 11, 2010 1:37 am Post subject: thanks! |
|
|
So it turns out kyuusaku is The Man! I swapped out my 100M osc for a 25M osc and my NES clocking is now much more accurate!!
With 100M the best I could get was:
DCM Output = 44MHz
2A03 = 44M / 24 = 1.83 MHz (~2.23% faster than original NES)
2C02 = 44M / 8 = 5.50 MHz (~2.23% faster than original NES)
With 25M I've got:
DCM Output = 21.4286 MHz
2A03 = 21.4286M / 12 = 1.786 MHz (~0.227% slower)
2C02 = 21.4286M / 4 = 5.357 MHz (~0.227% slower)
As you can see the 25M option is MUCH better!! Nice little upgrade!
I am still sacrificing the clock feedback correction loop but it doesn't seem to matter from what I can tell so far - this is certainly only because I am clocking at such low rates though. I will need to check the timing analyzer output but I've been playing my NES for a while now with a bunch of different games at this new frequency and it seems fine. If there were any major timing issues I probably would have seen it by now.
I'm not even sure that I will bother getting the 14.318M osc cause the 25M option is already so close. If I purchased a 14.318M osc I could get the following:
DCM Output = 21.477 MHz
2A03 = 21.477M / 12 = 1.789 MHz (~0.001% slower)
2C02 = 21.477M / 4 = 5.369 MHz (~0.001% slower)
Anyway, thanks again for the help kyuusaku!
Jonathon  |
|
| Back to top |
|
 |
tepples

Joined: 19 Sep 2004 Posts: 6104 Location: NE Indiana, USA (NTSC)
|
Posted: Thu Mar 11, 2010 7:24 am Post subject: |
|
|
| kyuusaku wrote: | | That minimum seems crazy, most of the time it's a couple MHz. Also, if the minimum frequency is 32 MHz, you can't DCM the 25 MHz osc? At the very least you could use use your 100 MHz: 100 / 14 * 3 = 21.43 MHz. It's not exact, but SIGNIFICANTLY more accurate than PC emulators and not perceivable anyway. |
The NTSC color subcarrier frequency is defined as 39.375/11 = 3.579545 MHz, and you propose using a frequency of 100/28 = 3.571429 MHz, a difference of 0.224%. If you generate subcarrier from an incorrect crystal, you'll get hue-shifted colors toward the right side of the screen. The picture is 256*2/3 = about 170 color subcarrier cycles wide, so at the right side of the screen, pixels will end up hue-shifted by 1-(100/28/39.375*11)*170*100 = 38.5%. In fact, the recommendation is that the frequency be accurate to 0.0003 percent, or plus or minus 10 Hz, in order to keep hue shifting to a minimum.
If at all possible, I'd recommend starting from the 14.32 MHz oscillator, which is specially designed to generate a signal exactly four times the rate of the NTSC color subcarrier. Or just bite the proverbial bullet and put an RC around the same 21.47 MHz crystal that the original NES used. |
|
| Back to top |
|
 |
kyuusaku
Joined: 27 Sep 2004 Posts: 1354 Location: .ma.us
|
Posted: Thu Mar 11, 2010 8:39 am Post subject: |
|
|
This is true, but the frequency is RGB/YCbCr palette-safe.
| jwdonal wrote: | | Anyway, thanks again for the help kyuusaku! |
Pshh it was nothing! |
|
| Back to top |
|
 |
tepples

Joined: 19 Sep 2004 Posts: 6104 Location: NE Indiana, USA (NTSC)
|
Posted: Thu Mar 11, 2010 9:30 am Post subject: |
|
|
| kyuusaku wrote: | | This is true, but the frequency is RGB/YCbCr palette-safe. |
In that case, it just depends on whether you want your FPGA's color encoder to act like that of an NTSC PPU or that of an RGB PPU. The NTSC PPU in the NES directly generates the composite signal with a shortcut that results in luma/chroma crosstalk artifacts. These artifacts make some games look worse and others look better. The RGB PPU in the PlayChoice and Famicom Titler doesn't have these artifacts, but it has a different one. Its internal HSV to RGB table has a few slightly mismeasured colors; Google says it affects Pit's hair in Kid Icarus. |
|
| Back to top |
|
 |
kyuusaku
Joined: 27 Sep 2004 Posts: 1354 Location: .ma.us
|
Posted: Thu Mar 11, 2010 10:16 am Post subject: |
|
|
| I don't see why NTSC simulation couldn't be synthesized in hardware. |
|
| Back to top |
|
 |
tepples

Joined: 19 Sep 2004 Posts: 6104 Location: NE Indiana, USA (NTSC)
|
Posted: Thu Mar 11, 2010 11:22 am Post subject: |
|
|
| kyuusaku wrote: | | I don't see why NTSC simulation couldn't be synthesized in hardware. |
If you plan to have exclusively RGB or component output, then yes, you could directly generate NTSC, decode NTSC, and output RGB or YPbPr. But for a composite output, the process of directly generating NTSC at the wrong rate, decoding it to YPbPr, and reencoding it to composite at the right rate sounds like it would produce even muddier video output.
jwdonal: What kind of video output do you plan to have on your clone of the PPU? |
|
| Back to top |
|
 |
|