Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

FreeRTOS software timer not working

Posted by spoorthymb on April 4, 2017

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


FreeRTOS software timer not working

Posted by dibosco on April 4, 2017

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

Posted by spoorthymb on April 5, 2017

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

Posted by heinbali01 on April 5, 2017

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

Posted by spoorthymb on April 5, 2017

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

Posted by spoorthymb on April 5, 2017

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


FreeRTOS software timer not working

Posted by heinbali01 on April 5, 2017

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

Posted by rtel on April 5, 2017

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


FreeRTOS software timer not working

Posted by spoorthymb on April 6, 2017

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

Posted by heinbali01 on April 6, 2017

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

Posted by spoorthymb on April 6, 2017

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

Attachments

RtosSemaphore.zip (1182 bytes)

FreeRTOS software timer not working

Posted by rtimenoob on April 6, 2017

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

Posted by spoorthymb on April 6, 2017

hi, this is my configTIMERTASKPRIORITY

define configTIMERTASKPRIORITY ( ( UBaseType_t ) 3 )

**


FreeRTOS software timer not working

Posted by rtimenoob on April 6, 2017

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

Posted by spoorthymb on April 6, 2017

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


FreeRTOS software timer not working

Posted by heinbali01 on April 6, 2017

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

Posted by spoorthymb on April 10, 2017

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


FreeRTOS software timer not working

Posted by heinbali01 on April 10, 2017

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

Posted by spoorthymb on April 11, 2017

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


FreeRTOS software timer not working

Posted by heinbali01 on April 11, 2017

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

Posted by spoorthymb on April 11, 2017

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


FreeRTOS software timer not working

Posted by heinbali01 on April 11, 2017

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

Posted by spoorthymb on April 11, 2017

okay


FreeRTOS software timer not working

Posted by spoorthymb on April 11, 2017

I have mailed you the code


FreeRTOS software timer not working

Posted by rtel on April 11, 2017

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


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists