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.
Not sure it is allowed/possible (need to check the manual !), you may be able to manually switch modes back to user mode, call the RTX function, and then call a SWI just before returning from the ISR. Another approach is to use "isr_set_evt" to trigger an signal at a task, whose handling will restart the timer (this seems much more robust!).
Calling os_tmr_create from within os_tmr_call does not work reliably. I tried it. To my mind user timers are not usable in this way. The supposed way for repeatedly scheduled action with a specific frequency is to use an os_itv_set/os_itv_wait construct. Regards
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.