FreeRTOS software timer not working

Hi, FreeRTOS software timer is not calling the callback function and the timer is not running.

FreeRTOS software timer not working

You’re going to have to give a lot more information than that. Along the lines of (but not limited to): Which version of FreeRTOS, which processor, which IDE, is this something you built yourself, is it stock FreeRTOS, what have you already tried?

FreeRTOS software timer not working

Hi, Version is FreeRTOS – 9.0.0-1, Atmega 32U4 processor, Arduino IDE, I have used FreeRTOS manual as a reference to build the timer. I have tried giving xTimerPeriod as 100/ portTICKPERIODMS or just the delay in this case 100 and pdMSTOTICKS(100) I tried using xTimerStart( xTimer,0 ) as shown below apart from the standard method given in freertos manual. xTimer = xTimerCreate( “Timer1Min”,pdMSTOTICKS(5000),pdTRUE, (void*) 0,prvTimerCallback); if( xTimer != NULL ) { xTimerStart( xTimer,0 ); }

FreeRTOS software timer not working

Is the scheduler started? Can you confirm that your own tasks are running? And is the timer-task (“Tmr Svc”) running? Are all of your tasks blocking (sleeping) from time to time? If some task consumes all CPU time, the timer-task won’t get a chance to do its work. Regards.

FreeRTOS software timer not working

yeah scheduler is started. ihave given vTashScheduler() after the timer creation. All of my tasks are working according to their functionality. How to check whether all of my tasks are blocking time to time??

FreeRTOS software timer not working

what is “Tmt Svc”?? i have not created any task with that name

FreeRTOS software timer not working

If you would do a grep on the string “Tmr Svc”, you would see this line in timers.c : ~~~ xReturn = xTaskCreate( prvTimerTask, “Tmr Svc”, configTIMERTASKSTACKDEPTH, NULL, ( ( UBaseTypet ) configTIMERTASKPRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle ); ~~~ This task will be created automatically if configUSE_TIMERS = 1 This is an example of a non-blocking task: ~~~ void vMyTask( void pvParameters ) { / This task will not allow any other task to become active, except for tasks that have a higher priority than this one. */ volatile int counter = 0; for( ;; ) { counter++; } } ~~~ A task can block (sleep) in many different ways, while waiting for a notification, an event group, a queue, a semaphore, and also while calling vTaskDelay() :
const TickType_t xTimeTicks = pdMS_TO_TICKS( 1000 );
for( ;; )
{
    /* Sleep for 1000 ms. */
    vTaskDelay( xTimeTicks );
    counter++;
}
Regards.

FreeRTOS software timer not working

http://www.freertos.org/RTOS-software-timer.html

FreeRTOS software timer not working

Hi, My configUSE_TIMERS = 1, then my timer task will be created. still the callback function is not executed. with reference to ur explaination my tasks are not held up in blocked state. PS: I am using Semaphore scheduling technique in my task. will it hinder the timer creation process.

FreeRTOS software timer not working

Would you mind sharing some of your code? It is difficult to assess from a distance why your timer-function wouldn’t be called. The easiest is to attach a ZIP file with the project you’re working on.

FreeRTOS software timer not working

I have attaached some part of my code becoz of confidentiality issue with the company. Hope u can help me out with the timers

FreeRTOS software timer not working

Hello, I did not watch your zip file but have you checked your configTIMERTASKPRIORITY? Maybe it is set too low.

FreeRTOS software timer not working

hi, this is my configTIMERTASKPRIORITY
define configTIMERTASKPRIORITY ( ( UBaseType_t ) 3 )
**

FreeRTOS software timer not working

Maybe your timer is just starving because its priority is too low. Maybe you could try it with this:

define configTIMERTASKPRIORITY ( configMAX_PRIORITIES – 1 )

FreeRTOS software timer not working

okay.. i will replace this and let you know about the updates

FreeRTOS software timer not working

Your project will start 4 tasks: Prio-1 : The task TaskScanSwitch() is never blocking. Prio-1 : The task TaskSerial() is not blocking, unless Serial::available() blocks, which I don’t think. Prio-3 : The task TaskProcessSwitch() blocks in a call to xSemaphoreTake(). Prio-1 : The task TaskSerialConsole() blocks in a call to xSemaphoreTake(). With ‘blocking’ I mean ‘sleeping’, or refrain from using the CPU so that other tasks get a chance to run. In some embedded RTOS projects, you will find a task that never blocks. It is given the lowest priority, often the “idle priority” ( tskIDLE_PRIORITY ), in order to give priority to all other tasks. But it is more usual to let each task sleep ( block ) on a semaphore or any other blocking API. Especially when low power consumption becomes important. I’m not sure if it is OK to call xTimerCreate() and xTimerStart() before the scheduler is started. Try to call these from within any of the running tasks. There is a lot of excellent documentation about FreeRTOS, e.g. have a look here. The following items might be interesting to read about: ● Tasks and priorities ● Pre-emption ● Queues, Semaphores, and (recursive) Mutexes ● Task notification ● Event groups I’m not sure what platform you’re using, but the easiest platform is probably the Windows simulation. You don’t need any special hardware for that. Regards

FreeRTOS software timer not working

Hi, I made the changes as said by you, it didnt work

FreeRTOS software timer not working

I made the changes as said by you, it didnt work
Does it work already? Did you find the problem?

FreeRTOS software timer not working

no it didnt, platform i am using is windows platform for simulation

FreeRTOS software timer not working

If you’re able to pack (ZIP) your complete project, and attach it to a message, I could look at it and try it out. Regards.

FreeRTOS software timer not working

I had attached zip file before.. complete project firmware i cannot send coz of confidential issues with the company..

FreeRTOS software timer not working

If you want, send it by email ( h [point] tibosch [at] freertos [point] org ). You can leave out confidential code, as long as I get a runnable project in which the Timer problem occurs.

FreeRTOS software timer not working

okay

FreeRTOS software timer not working

I have mailed you the code

FreeRTOS software timer not working

Try the Win32 examples in the main FreeRTOS download – they use software timers.