This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Reloading RTX User Timer

What is the supposed way to re-start a user timer if it has expired and the os_tmr_call has been called, since calling os_tmr_create is not allowed from within os_tmr_call?
Thanks in advance.

Parents Reply Children
  • In the past I have successfully used a periodic user timer built upon the RTX single-shot timers
    using the second approach suggested by Tamir.

    In more details ...

    I built a layer of sw which called s_tmr_create() the first time, and made the os_tmr_call() send an event to a high priority task (using with isr_evt_set() !!): the timer-manager-task.
    The timer-manager-task was then responsible to retrigger the timer (only if a flag in a related data structure was set to periodic mode) and then to execute the action (or rather to ask some other lower priority callback-manager-task to execute it).

    That works very reliably and with respect of times if the timer-manager-task executes at high priority and reloads the timer in the very same time tick of its expiry. If instead it is preempted for some ticks by some other task, then you lose the perfect periodicity and introduce a drift.

    The approach of using os_itv_set()/os_itv_wait() allows you to avoid any drift, but on the other hand you also need to use one dedicated task for periodic timer.

    Another much better approach could be to modify the RTX source code so that the reload of a periodic timer is done internally. Upon my experience on RTX that is not much difficult.

    You have however to purchase the license of RTX source code and CAREFULLY VERIFY WHAT THE LICENSE ALLOWS YOU TO DO.

    Regards, Marco.