+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 20 of 30

Thread: What are the standard clkfreq values above 80MHz?

  1. #1

    Default What are the standard clkfreq values above 80MHz?

    I'm working on a new VGA object and I figured out pretty much that you need to have an exact frequency output to get all monitors to lock at 60Hz. That screen slowly fadding to white problemˇthat others have had comes actually from the fact that by trying to calculate the VGA frequency output with integer mathˇyou do not get an exact result that is usable for the pixel clock.

    So... I'm just going to use precomputedˇvalues and thenˇuse a different one for each clock frequency.

    So far I have 80Mhz, 100Mhz, and 96Mhz as supported values. Are there any more popular clock frequencies that people use?

    Honestly, I'd rather not hardcode this but... I need 64 bit math to get a proper result and I'm not really that good at breaking stuff up yet.

    What I need to do is this....ˇˇ((6,293,750 * 4,294,967,296) / clkfreq)

    If I had 64 bit math the result would then come out to 337,893,130... The exact answer I need is 337,893,131 so I need to round up after the divide.

    Thanks for your help,

    Oh, and about the screen slowly fadding to white error. The reason this happens is because the pixel clock is not as high as it needs to be for the number of pixels you are pumping out to the screen. Because of this, each frame to the monitor is longer than it should be and the monitor will probably see like a 59Hz signal instad of 60Hz. This causes the monitor to basically get confused. So, you can fix the problem by either increasing the pixel clock frequency until it matches the number of pixels sent to the screen or you can reduce the number of pixels sent to the screen.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,

    Post Edited (Kye) : 7/1/2010 6:22:16 PM GMT
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  2. #2

    HollyMinkowski's Avatar
    Location
    Everywhere .......... (I'm a non-local phenomenon)
    Posts
    1,399

    Default

    You have the three frequencies that I use

    I especially like 96mhz since the xtals are so much cheaper than the 6.250 xtals.
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  3. #3

    Default

    Hi Kye.

    I run so many different Frequencies that drivers that are not reprogramming have not any use for me.



    Regards

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make itˇas simple asˇpossible yet as versatile as posible.


    Sapieha
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  4. #4

    Default

    10.4857600 MHz is poplar around here:)

    That's a 6.553600 MHz XTAL which I have a few of. The fastest I have pushed the TriBladeProp so far.

    For BST users use #defines to set the frequency at build time and issue a warning if none is defined. Put the formula clearly in the code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  5. #5

    Default

    So.... suggestions on how to do 64 bit math? =) Then I could fix this problem.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  6. #6

    Default

    Kye said...
    What I need to do is this.... ((6,293,750 * 4,294,967,296) / clkfreq)
    Are both numbers in the numerator constant?
    If so, the numerator is evenly divisible by 100,000.
    But that would be too easy ....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  7. #7

    Default

    Yes both numbers in the numerator are constants. I just have to divide by a changing clkfreq. But I need the most exact result possible rounded up.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  8. #8

    Default

    Phil put up some spin code umath.spin sometime - can't find the pointer at the moment - 64bit unsign math, multi/div/add. div is 64 bit /32 bit -> 32bit.
    http://obex.parallax.com/objects/415/
    ˇ
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  9. #9

    Default

    Spending great effort to support anything other than reasonable frequencies is very nice of you.

    People can use any frequency they like I guess as long as they realize what they're doing, but frequencies with big round numbers are commonly available. How much do those other frequencies cost for production? Is there really a great return in using them (other than that's what happened to be laying on the hobby workbench)?

    Cheers,
    --Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  10. #10

    Default

    I just want my code to be as flexible as possible. I don't mind taking up extra space for that. I'm trying very hard to avoid magic numbers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  11. #11

    Default

    Okay, this solves it.

    Code:
        pinGroup := constant(25_175_000 / 4)
        frequencyState := 1
        
        repeat 32
          pinGroup <<= 1                        
          frequencyState <-= 1
          if(pinGroup => clkfreq)
            pinGroup -= clkfreq
            frequencyState += 1

    pinGroup is a variable I'm resusing and frequencyState is the output.

    Rather nasty however. I would have liked a one line solution.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  12. #12
    Cluso99's Avatar
    Location
    Sydney/Brisbane Australia or 'sailing on the high seas'
    Posts
    9,244

    Default

    Kye, I use 104MHz (6MHz * 16) because 6.5MHz xtals are cheap and readily available at DigiKey. Also I intend going to 108MHz (13.5MHz * 8) in the future as these are also readily available. To use these, a good pcb layout is mandatory. Also, Bill and others are using his 6.25MHz * 16 (100MHz) xtals.

    I did some work on calculations for my latest 1pin TV driver which uses the compiler to do the hard work in calculations which saves space in the actual code. It no doubt has the same inaccuracies due to rounding as you have found, but it may be worth a look for you. I was not originally aware I could create these calculations using the compiler.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    ˇ Home of the MultiBladeProps: TriBlade,ˇRamBlade,ˇSixBlade, website
    ˇ Single Board Computer:ˇ3 Propeller ICsˇand aˇTriBladeProp board (ZiCog Z80 Emulator)
    ˇ Prop Tools under Development or Completed (Index)
    ˇ Emulators: CPUs Z80 etc; Micros Altair etc;ˇ TerminalsˇVT100 etc; (Index) ZiCog (Z80) , MoCog (6809)ˇ
    ˇ Prop OS: SphinxOSˇ, PropDos , PropCmdˇˇˇ Search the Propeller forumsˇ(uses advanced Google search)
    My cruising website is: ˇwww.bluemagic.bizˇˇ MultiBlade Props: www.cluso.bluemagic.biz
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  13. #13

    Default

    Kye, a double precision accumulator is not necessary. This is a ratio calculation of the form
    f = x * a/b where x here is 232.

    a=NCO frequency desired = 6_293_750 in your original example
    b=cpu CLKFREQ = 80_000_000 for example, but this is a variable too.

    Code:
    PRI frqVal(a, b) : f      ' return f = a/b * 2^32, given a<b, a<2^30, b<2^30
      repeat 32                           ' 32 bits
         a <<= 1
         f <<= 1
         if a => b
            a -= b
            f++



    returns f = 337_893_130 in your example with a=6_293_750 and b=80_000_000. That f is what goes into the frqa register for the NCO. The multiplication by 232 happens automatically in the algorithm.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  14. #14

    Default

    Crazy how similar Kye's and Tracy's algorithms are! It would be interesting to know how each of you gentlemen arrived at your solutions. Care to elaborate?
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  15. #15
    Cluso99's Avatar
    Location
    Sydney/Brisbane Australia or 'sailing on the high seas'
    Posts
    9,244

    Default

    Here is the code derived from Chip's code that I used to calculate the frqa counter for NTSC and PAL TV.
    Code:
    PRI Setforxtalfreq : f | Freq, PropFreq, shift
    '' Return frqa value for the current clkfreq
    '' Derived from CTR.SPIN by Chip Gracey
      Freq := ocolsfrq * ocols * 8                          'frequency required
      shift := 4 - >|((Freq - 1) / 1_000_000)               'determine shift 
      PropFreq := CLKFREQ
      if shift > 0                                          'if shift, pre-shift Freq or PropFreq left
        Freq <<= shift                                      'to maintain significant bits while
      if shift < 0                                          'insuring proper result
        PropFreq <<= -shift
     
      repeat 32                                             'perform long division of Freq / PropFreq
        f <<= 1
        if Freq => PropFreq
          Freq -= PropFreq
          f++                                               'compute frqa value
        Freq <<= 1

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    ˇ Home of the MultiBladeProps: TriBlade,ˇRamBlade,ˇSixBlade, website
    ˇ Single Board Computer:ˇ3 Propeller ICsˇand aˇTriBladeProp board (ZiCog Z80 Emulator)
    ˇ Prop Tools under Development or Completed (Index)
    ˇ Emulators: CPUs Z80 etc; Micros Altair etc;ˇ TerminalsˇVT100 etc; (Index) ZiCog (Z80) , MoCog (6809)ˇ
    ˇ Prop OS: SphinxOSˇ, PropDos , PropCmdˇˇˇ Search the Propeller forumsˇ(uses advanced Google search)
    My cruising website is: ˇwww.bluemagic.bizˇˇ MultiBlade Props: www.cluso.bluemagic.biz
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  16. #16

    Default

    I just took code from the synth object in the propeller library. Then modified it to add 1 to the final answer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  17. #17

    Default

    Oh, that's what "frequencyState := 1" and the "<-=" are for! Clever!
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  18. #18

    Default

    Takes up no extra code space too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  19. #19

    Default

    I've had a DIP32 prop running off of a scavenged 7.00 MHz crystal x16ˇ(112MHz) with no problems, but if i recall right, the various guts in the P8x32A silicon start malfunctioning around 128MHz, but as always, i could be (and probably am) wrong.

    Tracy Allen said...
    Kye, a double precision accumulator is not necessary. This is a ratio calculation of the form
    f = x * a/b where x here is 232.

    a=NCO frequency desired = 6_293_750 in your original example
    b=cpu CLKFREQ = 80_000_000 for example, but this is a variable too.

    Code:
    PRI frqVal(a, b) : f      ' return f = a/b * 2^32, given a<b, a<2^30, b<2^30
      repeat 32                           ' 32 bits
         a <<= 1
         f <<= 1
         if a => b
            a -= b
            f++



    returns f = 337_893_130 in your example with a=6_293_750 and b=80_000_000. That f is what goes into the frqa register for the NCO. The multiplication by 232 happens automatically in the algorithm.

    It took me a few minutes to understand what was going on here. I learned not to long ago in my AEES course how binary math is done, and how it is accomplished within hardware.. the repeat loop to multiply is beautiful, because binary multiply can beˇdone as a series of additions. Its funny the more things i learn in colledge, the more i see implimented in the code i read.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quicker answers in the #propeller chat channel on freenode.net. Don't know squat about IRC? Download Pigin! So easy a caveman could do it...
    http://folding.stanford.edu/ - Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.

    Post Edited (RinksCustoms) : 7/7/2010 10:11:32 PM GMT
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

  20. #20

    Default

    I haven't ran into problems at 200 Mhz (25 x 8) but just started using this setup a couple days ago. I haven't had any success higher than that though.
    Last edited by ForumTools; 10-02-2010 at 06:02 PM. Reason: Forum Migration

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts