Periodic Timer for 1 millisecond - Linux

This is a discussion on Periodic Timer for 1 millisecond - Linux ; Hi all I need to implement a periodic timer callback for 1 millisecond with a accuracy of +/- 100 ppm . The OS is monta vista linux version 2.4 and the target is mpc 8260. 1) How can I achieve ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Periodic Timer for 1 millisecond

  1. Periodic Timer for 1 millisecond

    Hi all

    I need to implement a periodic timer callback for 1 millisecond with a
    accuracy of +/- 100 ppm .

    The OS is monta vista linux version 2.4 and the target is mpc 8260.

    1) How can I achieve a periodic timer callback for 1 millisecond ?

    2) How can I test the accuracy of the periodic timer callback function
    is within +/- 100 ppm?

    Can anyone let me know how can I go about acheiving the above in MPC
    8260?

    Regards
    Abha


  2. Re: Periodic Timer for 1 millisecond

    Hi

    Thanks for the post

    Since in our target MPC8260 , HZ is defined to be 100 , so the variable
    jiffies will be updated every 10 millisecond duration.

    So the below calculation for 1 millisecond will not be accurate right ?

    >>jiffies + HZ/1000;



    So how can I acheive a accurate 1 millisecond timer with +/- 100 ppm?

    Regards
    Abha


  3. Re: Periodic Timer for 1 millisecond

    Hiya,

    Abha wrote:
    > I need to implement a periodic timer callback for 1 millisecond with a
    > accuracy of +/- 100 ppm .
    >
    > The OS is monta vista linux version 2.4 and the target is mpc 8260.
    >
    > 1) How can I achieve a periodic timer callback for 1 millisecond ?
    >
    > 2) How can I test the accuracy of the periodic timer callback function
    > is within +/- 100 ppm?
    >
    > Can anyone let me know how can I go about acheiving the above in MPC
    > 8260?


    For the timer, can you do your processing in the interrupt context? If so
    you could use one of the 16 CPMs RISC timers to generate an interrupt.

    As for high resolution timing on 8260, I often use the PPC decrement
    counter. It is incremented every four bus clock cycles.

    Another method, when hardware test points permit, is to drive one of the
    pins at the timing point and measure the frequency using a scope...

    For more replies, this question might be a bit more suited to
    comp.os.linux.embedded.

    Cheers,
    --
    John McCallum
    Artesyn CP, Edinburgh

    For email, leave the web and we're not so small.

  4. Re: Periodic Timer for 1 millisecond

    "Abha" wrote in message
    news:1150696103.452386.213790@p79g2000cwp.googlegr oups.com...
    | Hi all
    |
    | I need to implement a periodic timer callback for 1 millisecond with a
    | accuracy of +/- 100 ppm .
    |
    | The OS is monta vista linux version 2.4 and the target is mpc 8260.
    |
    | 1) How can I achieve a periodic timer callback for 1 millisecond ?
    |
    | 2) How can I test the accuracy of the periodic timer callback function
    | is within +/- 100 ppm?
    |
    | Can anyone let me know how can I go about acheiving the above in MPC
    | 8260?
    |
    | Regards
    | Abha

    If this is a one-off system and you can control the OS selection, look into
    Real-Time Linux. There's a freeware version with timers accurate to at
    least 100 uS (10KHz) from personal experience and probably to a few 10's of
    uS for non-periodic events.

    Norm


  5. Re: Periodic Timer for 1 millisecond

    Hi

    We are going to use Monta Vista Linux 2.4 alone .

    Can I use the Time Base Register in MPC 8260 to measure the accuracy of
    the Periodic timer for +/- 100 ppm?

    In that case how can i perform 64 bit division with floating point
    support in Linux kernel mode ?

    say
    ----------------------------------------------------------------------------------------------------------
    #define TIMEBASE_FREQ_HZ 16500000

    double start_time = 0;

    double end_time = 0;

    start_time = getTimeBaseRegister( );

    /* do some processing */

    end_time = getTimeBaseRegister( );

    diff = (end_time - start_time)/ TIMEBASE_FREQ_HZ

    ----------------------------------------------------------------------------------------------------------

    Regards
    Abha


  6. Re: Periodic Timer for 1 millisecond

    I guess you have do it your own in a interrupt context. As thekernel
    tick is 100, at 10millisecond inertval. That said the kernl services
    can help you. Unless you want a busy waiting at very rare occasions.
    But from you you described, you want it periodicly.

    Abha wrote:
    > Hi
    >
    > We are going to use Monta Vista Linux 2.4 alone .
    >
    > Can I use the Time Base Register in MPC 8260 to measure the accuracy of
    > the Periodic timer for +/- 100 ppm?
    >
    > In that case how can i perform 64 bit division with floating point
    > support in Linux kernel mode ?
    >
    > say
    > ----------------------------------------------------------------------------------------------------------
    > #define TIMEBASE_FREQ_HZ 16500000
    >
    > double start_time = 0;
    >
    > double end_time = 0;
    >
    > start_time = getTimeBaseRegister( );
    >
    > /* do some processing */
    >
    > end_time = getTimeBaseRegister( );
    >
    > diff = (end_time - start_time)/ TIMEBASE_FREQ_HZ
    >
    > ----------------------------------------------------------------------------------------------------------
    >
    > Regards
    > Abha



  7. Re: Periodic Timer for 1 millisecond

    Hi

    Can anyone send me some reference code which I can use to set up a CPM
    RISC timer
    for 1 millisecond?

    Regards
    Abha


  8. Re: Periodic Timer for 1 millisecond

    "Abha" wrote:
    >
    >Can anyone send me some reference code which I can use to set up a CPM
    >RISC timer for 1 millisecond?


    You are going to have to ask Monta Vista about this, or at least a Monta
    Vista newsgroup or mailing list. Standard Linux cannot do this, so this
    group is not likely to be helpful.
    --
    - Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

+ Reply to Thread