Shop OBEX P1 Docs P2 Docs Learn Events
Prop stops spinning... — Parallax Forums

Prop stops spinning...

siljamickesiljamicke Posts: 66
edited 2011-01-24 12:51 in Propeller 1
How come a program which works just fine in one clockspeed, all of a sudden fails when sped up?

I have an audio application, which outputs audio fine with:
_CLKMODE = XTAL1 + PLL1X
_CLKMODE = XTAL1 + PLL2X
_CLKMODE = XTAL1 + PLL4X

  _XINFREQ = 6_000_000

but fails miserably with:
_CLKMODE = XTAL1 + PLL8X
_CLKMODE = XTAL1 + PLL16X

  _XINFREQ = 6_000_000

The outputted audio should be well within audio frequency, so it's got nothing to do with transposing the audio above the limit for hearing.

I'm crossing some other sort of threshold here, probably electrical... I get two pops, (where there should have been a stream of pops = PWM, :smile:) for the last two PLL settings...

My prop is powerded by two AA batteries (3 volt). On the pin outputting audio i have a 220R, a 4.7uF from the resistor to ground (Low pass RC), and a 220uF DC blocking cap. Electrically i always shoot from the hip, as long as it works somewhat so so, it's fine for me! But maybe i'm being to naive here assuming it should work for all clockspeeds...

Comments

  • LeonLeon Posts: 7,620
    edited 2011-01-19 05:14
    Schematic?
  • SapiehaSapieha Posts: 2,964
    edited 2011-01-19 05:17
    Hi siljamicke.

    How are Yours Propeller PCB build.


    siljamicke wrote: »
    How come a program which works just fine in one clockspeed, all of a sudden fails when sped up?

    I have an audio application, which outputs audio fine with:
    _CLKMODE = XTAL1 + PLL1X
    _CLKMODE = XTAL1 + PLL2X
    _CLKMODE = XTAL1 + PLL4X
    
      _XINFREQ = 6_000_000
    

    but fails miserably with:
    _CLKMODE = XTAL1 + PLL8X
    _CLKMODE = XTAL1 + PLL16X
    
      _XINFREQ = 6_000_000
    

    The outputted audio should be well within audio frequency, so it's got nothing to do with transposing the audio above the limit for hearing.

    I'm crossing some other sort of threshold here, probably electrical... I get two pops, (where there should have been a stream of pops = PWM, :smile:) for the last two PLL settings...

    My prop is powerded by two AA batteries (3 volt). On the pin outputting audio i have a 220R, a 4.7uF from the resistor to ground (Low pass RC), and a 220uF DC blocking cap. Electrically i always shoot from the hip, as long as it works somewhat so so, it's fine for me! But maybe i'm being to naive here assuming it should work for all clockspeeds...
  • MagIO2MagIO2 Posts: 2,243
    edited 2011-01-19 05:45
    Do other programs run at full speed?

    If so, my guess is that there are some calculations for the timing done in a driver. If you do these calculations the wrong way you can have a overrun in between.

    For example:
    8 * 6_000_000 means that _clkfreq equals 48_000_000. So, if some code multiplies _clkfreq with a number bigger than 89 you have an overrun and the result of the calculation will be wrong. And very likely smaller than the expected value. So, doing a waitcnt with this result might cause the problem.
  • siljamickesiljamicke Posts: 66
    edited 2011-01-19 06:20
    @Sapieha:
    PCB?!! Muahahaha! I use a mix of breadboarding and sort of laying conducting wires upon other conducting wires, hoping that they'll stay put. Don't bother trying to calculate stray capacitances in my setup, hehe.

    @MagIO2 (now i noticed the spelling of your nick name, it's an i not L)
    Yes other programs run fine in 6mhz*pll16. And i am not basing any calcs on clkfreq. It should scale just fine. It sounds like the prop goes "Hey man, i just don't feel like bothering flippin your damn pin on and of at like thousands of times per second. Half is enough, my arm hurts, and the sound sucks anyway!"

    I realize i will have to attach some code and schematic, i will do that asap!
  • siljamickesiljamicke Posts: 66
    edited 2011-01-24 12:51
    In case someone reads this thread further on, it's working now. It was a power issue. 4 new batteries instead of 2 old seemed to do the trick! :thumb:
Sign In or Register to comment.