Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Interval timer

Is it necessary to have an interval timer in your sopc design for a microc/os-ii project to work? what would happen if you dont put an interval timer.. in my bsp it shows system clock timer as none. does that mean it will take the 50Mhz clock as the system timer?

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    No you absolutely need a system timer or the scheduler won't work. If it compiles, the OS will probably freeze before even starting.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    i tried running it without a system clock and it works! as long as you dont use any delay or time related functions. you have to trick the compiler by putting

    the number of ticks per second in the header file even though theres no real tick :)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I didn't look at the OS code in detail but I doubt the scheduler will work correctly without a timer. You may have a problem when you start running several threads simultaneously.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

     
    /*
    *********************************************************************************************************
    * PROCESS SYSTEM TICK
    *
    * Description: This function is used to signal to uC/OS-II the occurrence of a 'system tick' (also known
    * as a 'clock tick'). This function should be called by the ticker ISR but, can also be
    * called by a high priority task.
    *
    * Arguments : none
    *
    * Returns : none
    *********************************************************************************************************
    */
    void OSTimeTick (void)
    

    This is from os_core.c. uOS might work "without" a timer but then of course the timebase becomes "shaky" at best.

    The mentioned "high priority task" might also consume a lot of CPU to busy waits.

    I would recommend to use a real HW timer.

    karsten