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

OsTimerStart bug in RTOS2 5.8.0

A bug appears when trying to restart a periodic timer already running using osTimerStart, with a different period :

The new period is taken in account for one period and period go back to the previous value set by the first osTimerStart call. This is due to 'load' member of timer not re-initialized when timer is detected already running.

Here is the patch for this bug :

static osStatus_t svcRtxTimerStart (osTimerId_t timer_id, uint32_t ticks) {
os_timer_t *timer = osRtxTimerId(timer_id);

// Check parameters
if ((timer == NULL) || (timer->id != osRtxIdTimer) || (ticks == 0U)) {
EvrRtxTimerError(timer, (int32_t)osErrorParameter);
//lint -e{904} "Return statement before end of function" [MISRA Note 1]
return osErrorParameter;
}

if (timer->state == osRtxTimerRunning) {
TimerRemove(timer);
// 09/03/22 Bug fixed
timer->load = ticks;
} else {
if (osRtxInfo.timer.tick == NULL) {

...

Remark : if RTX source code is not integrated in the project, a call to osTimerStop must be done before calling osTimerStart with a new period value.