Shop OBEX P1 Docs P2 Docs Learn Events
Xtal1 + pll16x — Parallax Forums

Xtal1 + pll16x

PaulFPaulF Posts: 62
edited 2008-06-28 04:31 in Propeller 1
Hi, I'm new to the Prop and I'm really looking forward to using this high spec chip. I am working my way through the Propellor manual, but i can't get the Blinker2.spin object to work when I set _CLKMODE = XTAL1 + PLL16X.
It works when I use XTAL1 + PLL8X.
I have also tried to use Debug_Lcd_Test which also uses XTAL1 + PLL16X but no joy there either. Any suggestions?

Comments

  • QuattroRS4QuattroRS4 Posts: 916
    edited 2008-02-24 11:10
    followed by .....

    _xinfreq = 5_000_000

    if the board you have is based on a 5MHz crystal as some (hydra) has a 10MHz Crystal

    JT

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Necessity is the mother of invention'
  • PaulFPaulF Posts: 62
    edited 2008-02-24 11:18
    Hi QuattroRS4,
    yes i have _xinfreq = 5_000_000. The crystal is a 5Mhz, as I said the program runs fine with xtal1 + pll8x but not with xtal1 + pll16x.
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2008-02-24 11:24
    can you post your code ? .. Sounds a bit odd !

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Necessity is the mother of invention'
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-24 11:25
    (a) When you say you are a "newbie" then many things can be the cause.. In most cases those are minor misunderstandings that are obvious when seeing the complete code!

    (b) There are situations when the crystal is not connected correctly or malfunctioning. In that case the Propeller is using a rather undefined frequency... This might work with some PLL-values and not with others...

    So can you make sure the Processor runs at 40Mhz with your setting? This needs no special equipment, but rather the observation of the LED blinking, and recalculating the delay!

    ----
    Edit:

    (c) There are some crystals that better work with XTAL2 but this is rare....

    Post Edited (deSilva) : 2/24/2008 11:32:06 AM GMT
  • PaulFPaulF Posts: 62
    edited 2008-02-24 11:36
    Here's the code,
    CON
    _CLKMODE = XTAL1 + PLL16X
    _XINFREQ = 5_000_000
    MAXLEDS =1 'Number of LED objects to use

    OBJ
    LED[noparse][[/noparse]6] : "Output"

    PUB Main
    {Toggle pins at different rates, simultaneously}
    dira[noparse][[/noparse]16..23]~~
    LED[noparse][[/noparse]NextObject].Start(16, 100_500_000, 1)
    LED[noparse][[/noparse]NextObject].Start(17, 100_500_000, 1)
    LED[noparse][[/noparse]NextObject].Start(18, 500_000, 1)
    LED[noparse][[/noparse]NextObject].Start(19, 500_000, 1)
    LED[noparse][[/noparse]NextObject].Start(20, 500_000, 1)
    LED[noparse][[/noparse]NextObject].Start(21, 500_000, 1)
    LED[noparse][[/noparse]NextObject].Start(22, 500_000, 1)
    LED[noparse][[/noparse]NextObject].Start(23, 500_000, 1)
    ' LED[noparse][[/noparse]0].Start(16,2_000_000, 0)

    repeat

    PUB NextObject : Index
    {Scan LED objects and return index of next available LEDobject.
    Scanning continues until one is available.}

    repeat
    repeat Index from 0 to MAXLEDS-1
    if not LED[noparse][[/noparse]Index].Active
    quit
    while Index == MAXLEDS
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-24 11:38
    Just displaying the indentation...
    CON
      _CLKMODE = XTAL1 + PLL16X
      _XINFREQ = 5_000_000
      MAXLEDS =1                   'Number of LED objects to use
    
    OBJ
      LED[noparse][[/noparse] 6] : "Output"
    
    PUB Main
    {Toggle pins at different rates, simultaneously}
        dira[noparse][[/noparse] 16..23]~~
        LED[noparse][[/noparse]NextObject].Start(16, 100_500_000,  1)
        LED[noparse][[/noparse]NextObject].Start(17, 100_500_000,  1)
        LED[noparse][[/noparse]NextObject].Start(18, 500_000,  1)
        LED[noparse][[/noparse]NextObject].Start(19, 500_000,  1)
        LED[noparse][[/noparse]NextObject].Start(20, 500_000,  1)
        LED[noparse][[/noparse]NextObject].Start(21, 500_000,  1)
        LED[noparse][[/noparse]NextObject].Start(22, 500_000,  1)
        LED[noparse][[/noparse]NextObject].Start(23, 500_000,  1)
       ' LED[noparse][[/noparse] 0].Start(16,2_000_000, 0)
    
        repeat
         
    PUB NextObject : Index
    {Scan LED objects and return index of next available LEDobject.
     Scanning continues until one is available.}
    
      repeat
        repeat Index from 0 to MAXLEDS-1
          if not LED[noparse][[/noparse] Index].Active 
            quit
      while Index == MAXLEDS
    
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-24 12:00
    Edit:
    I shall come back to the S/W issues later... I need some time to check, as there are some funny things I do not understand in Blinker2...

    Post Edited (deSilva) : 2/24/2008 12:34:19 PM GMT
  • PaulFPaulF Posts: 62
    edited 2008-02-24 12:29
    I think it is the crystal that is faulty (I received the Propellor starter kit 2 days ago). If I use the following code

    _clkmode = xtal1
    _xinfreq= 5_000_000

    the program does not execute. However if I use xtal1 + pll1x (or pll2x, pll4x, pll8x) it seems to run. I have also modified the code to use delays in milliseconds but the delays appear to about half of what I expected.
    As I have no prior experience with crystals, what will happen if I use a crystal with a different frequency? What range of crystals can I use with the demo board.

    Thanks again for your help
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-24 12:36
    RivTec

    Use a different test program, e.g.
    PUB main
       DIRA := 1
       REPEAT
          waitcnt(cnt+clkfreq/2)
          !OUTA
    



    Check whether it's 1 Hz (half second on, half second off) at Pin 0 (or take another pin by changing DIRA)
    The propeller should ALWAYS work with it's internal RC clock @ 12 MHz

    Then change yout clock settings and see how long it goes well.

    Crystals: You can use nearly every crystal between 1 to 10 MHz!

    Post Edited (deSilva) : 2/24/2008 12:45:59 PM GMT
  • PaulFPaulF Posts: 62
    edited 2008-02-24 12:52
    I don't know what has happened but the program and others are now workig. I believe it is a dodgy crystal or crystal socket. thanks very much for your help and patience.

    Kind regards to all
    Paul
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-24 13:10
    Good to hear... It should had to be somthing like that... I was laid astray for some time as Blinker2 is not exactly a masterpiece of didactical programming smile.gif First problem is that there are many versions, and many versions of Output.spin as well..

    And as you are not using COUNT = 0 but COUNT = 1 this could give peculiar effects..

    My remarks here:

    (a) DIRA in the main program is redundant and confusing

    (b) When COUNT has expired in OUTPUT, the variable "Cog" is reset but the COG itself is not killed; this gives most intersing effects when experimenting...

    (c) The technique used (use of NextObject) is far beyond the grasp of the beginner, and could be considered very bad style even for very advanced programmers.

    (d) The permanent use of nested one-liners leaves the beginner helpless. Yes I know it's the way Start and Stop are used; but it will do no harm do write it out more extensively in the beginning.

    (e) As I avoid using the REPEAT count variable outside the loop (to many options in too many languages smile.gif ) I have not been aware that it is one above the limit when the loop terminates regularly (and one below when counting backwards?) This is used very a-propos in one of the central examples... I do not like that...

    Post Edited (deSilva) : 2/24/2008 1:15:09 PM GMT
  • Kevin HinesKevin Hines Posts: 8
    edited 2008-06-28 03:45
    RivTec said...
    Hi, I'm new to the Prop and I'm really looking forward to using this high spec chip. I am working my way through the Propellor manual, but i can't get the Blinker2.spin object to work when I set _CLKMODE = XTAL1 + PLL16X.
    It works when I use XTAL1 + PLL8X.
    I have also tried to use Debug_Lcd_Test which also uses XTAL1 + PLL16X but no joy there either. Any suggestions?
    RivTec,

    I'm also new to the Propeller, and I lost·a couple of days trying to figure out this same problem·... so I called Parallax Tech Support, and was told that this issue with "PLL16X" not working, but "PLL8X" working, is a "known issue" (i.e., a known bug with some Propellers which had been shipped to customers), and so they sent me a replacement PropStickUSB.·

    The replacement PropStickUSB does not have this problem, i.e.,·it·works·just fine·with "PLL16X".

    In the meantime, while waiting on the replacement unit, I·got into the habit of changing every program to use "PLL8X", as I don't trust that every·Propeller I get in the future will continue working properly if·the software·uses "PLL16X", and I don't want one of my robots·to fail·at an inopportune moment.

    Good Luck!
    Kevin
  • Ken PetersonKen Peterson Posts: 806
    edited 2008-06-28 03:55
    I don't know about PropStick, but with a 5MHz crystal and PLL16X you should have no problem. It is well within spec. I have used both the Demo Board and the Protoboard with the 5MHz crystal and PLL16X and have had no problems.

    I believe the Propstick uses a 10MHz crystal. You can't use PLL16X with a 10 MHz crystal because that would give you a system clock of 160MHz which is way out of spec.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-28 04:17
    Trust is often something easily lost and hard to establish. Consider your experience with Tech Support. They readily acknowledged that there was a problem, that it happened with a limited number of units, and (most importantly) sent you a replacement unit that works as it should. Consider the philosophy behind the way the Propeller was designed (as described in Chip's essay) and the kind of testing that went into the Propeller's datasheet. There's no particular reason to run the Propeller at maximum speed unless you need the speed and the lower speed reduces the power needed.
  • Kevin HinesKevin Hines Posts: 8
    edited 2008-06-28 04:31
    Ken Peterson said...
    I don't know about PropStick, but with a 5MHz crystal and PLL16X you should have no problem. It is well within spec. I have used both the Demo Board and the Protoboard with the 5MHz crystal and PLL16X and have had no problems.

    I believe the Propstick uses a 10MHz crystal. You can't use PLL16X with a 10 MHz crystal because that would give you a system clock of 160MHz which is way out of spec.

    Ken,

    Yes, Good point... the PropStickUSB comes with a 5MHz crystal (at least the two that I've had, both came with 5 MHz crystals).

    And Yes, you are correct, PLL16X *should* always work with the 5MHz crystal, but my first PropStickUSB (I got it·a few weeks·ago) did not work when set to PLL16X, but did work when set to PLL8X.··

    To see this in the manual, for anyone experiencing this issue, go to the PropStickUSB page:
    http://www.parallax.com/Store/Microcontrollers/PropellerProgrammingKits/tabid/144/CategoryID/20/List/0/SortField/0/Level/a/ProductID/506/Default.aspx
    and download the PDF manual entitled "Setup and Testing Lab and Code (.zip)·", v1.0, and go to page 29, section 9.c., where the manual informs the reader that if they have a problem running PLL16X, to try PLL8X, and if that solves the problem, then they·should contact Parallax Tech Support.· That's the issue my PropStickUSB had, that's why I contacted tech support,·that's how I learned about this issue, and got a replacement PropStickUSB.

    When·I called tech support,·I was told there was a "known issue" with a batch of Propellers, (I have no idea what batch) and·Parallax replaced the PropStickUSB for me, which I appreciate.···smile.gif

    The new, replacement PropStickUSB works just fine with PLL16X and the 5MHz crystal.···smile.gif

    Kevin
Sign In or Register to comment.