Shop OBEX P1 Docs P2 Docs Learn Events
_clkmode — Parallax Forums

_clkmode

samsearchersamsearcher Posts: 13
edited 2006-11-13 17:25 in Propeller 1
I'm using this code to flash a LED every second on pin 17 and it works fine

CON
_clkmode = xtal1
_xinfreq = 5_000_000

PUB Toggle
dira[noparse][[/noparse]17]~~
repeat
!outa[noparse][[/noparse]17]
waitcnt(clkfreq + cnt)


This doesn't work

CON
_clkmode = xtal1 + pll1x
_xinfreq = 5_000_000

PUB Toggle
dira[noparse][[/noparse]17]~~
repeat
!outa[noparse][[/noparse]17]
waitcnt(clkfreq + cnt)

Am I missing something here?
I'm using a 5MHz Crystal Digi-key P/N CTX081-ND
is this the wrong code or part?
Thanks

Comments

  • Tracy AllenTracy Allen Posts: 6,657
    edited 2006-11-13 02:57
    If the first code works, then the choice of xtal surely has nothing to do with it.

    Okay, I tried it, and both versions worked okay. Are you sure you didn't lose something in the formating of the REPEAT loop in the second case? You can maintain the indents in your post by enclosing the text in code tags.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • samsearchersamsearcher Posts: 13
    edited 2006-11-13 03:54
    I'm sure the indenting was the same. I couldn't make the second example work so what I did is comment out the pll1x to create the first example that will work.

    [noparse][[/noparse]
    This will work

    CON
    _clkmode = xtal1' + pll1x
    _xinfreq = 5_000_000

    PUB Toggle
    dira[noparse][[/noparse]17]~~
    repeat
    !outa[noparse][[/noparse]17]
    waitcnt(clkfreq + cnt)

    This will not work

    CON
    _clkmode = xtal1 + pll1x
    _xinfreq = 5_000_000

    PUB Toggle
    dira[noparse][[/noparse]17]~~
    repeat
    !outa[noparse][[/noparse]17]
    waitcnt(clkfreq + cnt)
    code]

    I'm beginning to think maybe I damaged the chip. When I first setup the board I missed the ground to the 3.3v power supply and when I tested the voltage going to the chip it was about 4.5 volts. I fixed the problem and every thing has been fine until I tried the PLL Constant.
    I figured that if the chip worked it was fine, now I'm wondering if you can damage part of the chip and not effect the rest.
  • samsearchersamsearcher Posts: 13
    edited 2006-11-13 04:01
    I tried to use the code tag in the previous post but obviously I didn't get that right ether. Anyway I did palace two spaces before !outa[noparse][[/noparse]17] and
    waitcnt(clkfreq + cnt) in both examples.

    Thanks for trying this for me.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-13 17:25
    Sam,
    ·
    ·· It would appear that the excessive voltage has damaged the PLL circuit on the Propeller.· We have seen this happen at least once before, so it is a good bet.·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.