Changing OS Tick from 1ms to 0.2ms

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Changing OS Tick from 1ms to 0.2ms

    Hi All,

    I would like to change the OS Tick (timer interrupt) from 1ms to 0.2ms without changing the behaviour of the OS_Delay() or any other time functions. I did the following until now:

    changing timer reload:
    #define TIMER_RELOAD (OS_PCLK_TIMER/5000 - 1)

    new tick handler:
    OS_HandleTick_Ex();

    What additional setting does i have to do now, to guarantee that a OS_Delay(10) call remains a delay of 10ms (I tried to modify with the OS_CONFIG macro, but this didn't work as expected)?

    I'm using embOS version 3.60a with IAR Embedded Workbench.

    Thanks for your help!
  • Hello,

    you cannot use OS_CONFIG() with a higher timer interrupt frequency, you can use it only with lower timer interrupt frequency.
    Why do you want to change the timer interrupt period to 0.2 msec?
    I suggest to use another hardware timer for the embOS system tick interrupt if you need this 0.2 msec period.

    Regards,
    Til
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi

    In my design i have a time-critical task which has to be activated once per millisecond. If I use an OS_Delay(1) in the task, the task is not called every millisecond, because there is the additional execution time of the code in the task.
    So i decided to use a hardware timer which sends an event every millisecond to the task and the task waits for this event. To avoid the task running in the timer's interrupt context, I used the OS_LeaveInterruptNoSwitch() at the end of the ISR. The problem now is, that the task becomes active after the next OS tick. A tick time of 1ms is in this case to slow, so i need a context switch every 0.2ms...

    I saw the following documentation for OS version 3.82: OS_TICK_Config(1, 10); // 10 kHz interrupts (0.1ms), 1ms tick
    Is it possible to modify the newer OS version 3.82 in a way that a context switch is done every 0.2ms but the OS tick for the delays remains at 1ms?

    Best Regards
    Stefan
  • swe wrote:

    I used the OS_LeaveInterruptNoSwitch() at the end of the ISR.
    From your description, it sounds like you should use OS_LeaveInterrupt() so that your task that's waiting on this event will be scheduled immediately (if there's no higher priority ready task).

    I believe that the use-case for OS_LeaveInterruptNoSwitch() is pretty rare.

    The post was edited 2 times, last by mwb1100 ().