Deletion of FreeRTOS timer fails

Hello, I have a question. I am creating 8 timers on certain events. These timers have the same callback function. The problem is that when I delete the 7 every thing works fine. But as soon as I delete the 8 it returns pdFAIL. What could be the reason. Please explain

Deletion of FreeRTOS timer fails

I have timer_handle value but I am nt able to delete the timer. what could be the possible reasons, why timer is not getting deleted.?

Deletion of FreeRTOS timer fails

Another strange thing that I have observed is that when I create three timers, sometimes it deletes all the timers and sometimes it deletes only two. Is this has to do something with timer command queue

Deletion of FreeRTOS timer fails

Can you please post an example of how you are creating the timers – the minimum amount of source code that exhibits this behaviour. Also, what is the priority of the timer service task relative to other tasks in your application – especially relative to the priority of the task that is creating and deleting the timers.

Deletion of FreeRTOS timer fails

The priority of the timer service task is 5. The priority of other tasks is less than the timer service task. Following is the code to create the timer. ~~~ void createinitialactivity_timer(int id) { const TickTypet xTicksToWait = pdMSTOTICKS(DOIPINITIALACTIVITYTIMERPERIOD); // Create a one-shot timer TimerHandlet oneshottimer; BaseTypet xTimer1Started; oneshottimer=xTimerCreate( /* Text name for the software timer – not used by FreeRTOS. */ “Initial”, /* The software timer’s period in ticks. */ xTicksToWait, /* Setting uxAutoRealod to pdFALSE creates a one-shot software timer. */ pdFALSE, /* This example does not use the timer id. */ (void*)id, /* The callback function to be used by the software timer being created. */ vTimerCallBackinitial); if(oneshottimer != NULL) { xTimer1Started=xTimerStart(oneshot_timer, 0 ); //Start the one shot timer if( ( xTimer1Started == pdPASS )) { printf(“Timer created for id %d”,id);
        }

    }
} ~~~ Following is the code, that represents a timer call back function. ~~~ static void vTimerCallBackinitial( TimerHandlet xTimer ) { int id; id=(int) pvTimerGetTimerID( xTimer ); timerinfo=xTimerDelete(strcuturethatsavestimer[id].timer,0); if(timerinfo==pdPASS) { //Timer Deleted successfully } } ~~~

Deletion of FreeRTOS timer fails

I changed the configTIMERQUEUELENGTH from 10 to 50, It started to work fine. Is it possible that configTIMERQUEUELENGTH didnt had the enough space to process xTimerDelete() function call?

Deletion of FreeRTOS timer fails

If some of your timer call back block (or spend a long time) and keep the timer service task from running and draining the queue this could happen, Remember that the timer call backs run under the timer task, so while they are doing their actions, there isn’t anyway to service requests in the queue.