Shop OBEX P1 Docs P2 Docs Learn Events
Javelin running to fast — Parallax Forums

Javelin running to fast

EnriqueEnrique Posts: 90
edited 2008-05-09 15:24 in General Discussion
I’m driving a stepper motor using a Javelin. I noticed that sometimes the motor would spin much faster than usual. After taking some signal samples using an USBee probe I noticed that in those cases the Javelin was actually running faster.
·
Has anybody had a case of the Javelin clock sometimes running faster than usual?

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-05-09 10:54
    Do you also use uarts in your program on that specific javelin? Do these work?

    If there would be a different crystal frequency (javelin uses 25MHz) then those uarts
    would never work in which case we would have seen posts about
    uarts never working. As I have not seen such posts it is more likely
    there is something in your program setup that sometimes makes
    your steppers run faster.

    regards peter
    ··
  • EnriqueEnrique Posts: 90
    edited 2008-05-09 14:10
    I don’t use UARTS, the only virtual peripheral is the timer.
    ·
    I have a very simple program the uses pins 0-3 to drive the motor and I used pin 4 to check how many times the main loop iterates on every timeout.
    ·
    In both the fast and the slow cases the program loops four times for every phase change, just that in the fast case the pin 4 pulses are 1.6 ms apart and in the slow case they are 2.77 ms apart.
    ·
    I am uploading the program and I saved the logic probe samples in case someone wants to take a look at them.
    ·
    ·
    Enrique
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-05-09 14:41
    What do you measure on a 'fast' and 'slow' javelin if you leave out
    the call to motor.Run(), so you just have

    while (true) {
    · CPU.pulseOut(1,pin);
    }

    That would really show if you have a fast javelin.

    The motor.Run() takes different timing depending on the step value.
    As a result·you could miss a timeout just, in which case an
    addtional timeout test is done before Run returns.
    That could explain the 1.17msec difference.

    regards peter
  • EnriqueEnrique Posts: 90
    edited 2008-05-09 15:02
    First you must understand that this is happening on the same Javelin, not two different controllers, which makes this weird. After I reset the Javelin it will sometimes run faster.

    I measured the pin4 interval both in the fast and the slow run when there is a phase change and when there isn’t, these are the results I got.

    Run No phase change Phase change
    Slow 2.7ms 4.4ms
    Fast 1.6ms 2.6ms

    How do you explain this?


    Enrique
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-05-09 15:24
    I have no obvious explanation, however I do think it is
    related to the use of the Timer function timeout().
    That's why I asked to run just a while (true) loop with the
    pulseOut call. That·should give persistent results
    no matter how many times you reset the javelin.
    If however, you get the same variation running just
    the pulseOut command, then the cause could be
    the crystal I suppose.

    regards peter
Sign In or Register to comment.