Timer callback function is not executing

I am testing softwareTimer APIs . i copies example code from the freeRTOS manuel 10.0.0 where Timer is creating and starting after which callback fuction is not executing
I am not creating other tasks in the project. this is just to test the timer APIs.
The platform i am using SYNOPSYS MetaWare IDE ARCem9D processor.

  • The code is as follows

static void vTimerCallback( TimerHandle_t xTimer )
printf(“timer callback is created\n”);
int main(void)
TimerHandle_t xTimers = NULL;

 xTimers = xTimerCreate( /* Just a text name, not used by the RTOS kernel. */
						 /* The timer period in ticks, must be greater than 0. */
						 /* The timers will auto-reload themselves when they expire. */
						 /* The ID is used to store a count of the number of times the timer has expired, which is initialized to 0. */
						 ( void * ) 0,
						 /* Each timer calls the same callback when it expires. */
						 vTimerCallback );

 if( xTimers == NULL )
	 printf("/* The timer was not created. */\n ");
	 printf("timer is created\n");

	 /* Start the timer.No block time is specified, and even if one was it would be ignored because the RTOS scheduler has not yet been started. */
	 if( xTimerStart( xTimers, 1 ) == pdPASS)
		 printf("timer is  started\n");


timer is created
timer is started

if timer is starting, after timer expires the callback functions should execute may i know what is the problem and why it is not executing.
I think if timer is creating it means that the configurations are correct?

I see two possible issues that might be at work.

First, your printf implementation may not be compatible with FreeRTOS, especially if it is based on ‘semi-hosting’.

Second, it is possible that you project is setup wrong and the tick interrupt isn’t being installed right, or the system is halting on an assertion.

The first test would be to after starting the program and letting it run a bit, stop it with the debugger and see where the program is running, to make sure is IS still running. Also check the tick counter to see that it has been incrementing.

Hi sir,
Thanks for the Reply

Sir printf implementation may not be compatible with FreeRTOS means, we are not suppose to use printf inside the call Back function?

I have tested the program and attached the screenshot in step-by-step debugging process xtimerStart is entering to TickType_t xTaskGetTickCount( void ) after which, coming out of this function xtimerStart enters into xTimerGenericCommand() function after coming out of this vTaskStartScheduler(); will execute and terminates.

xTickCount is not incrementing.

“tick interrupt isn’t being installed right”??
how will we get to know this and how to install this and tick counter is not incrementing means how to make tick interrupt work??

in my previous query related to message buffer functionality with vTaskDelay() it is not working, without which it is working fine for this also i got a reply that tick interrupt is not working.

please kindly let me know how to work on tick interrupt.

For the attachment of the project Zip file new user not allowed for this process.

Thanks and Regards
Mansoor Basha

Since xTickCount is 0, either the system crashed (or hasn’t started) before the first tick or the tick interrupt isn’t enabled. Since this call is from main, you probably haven’t started FreeRTOS yet.

As for printf, the issue is that for many systems, the inbuilt printf function may use features that give FreeRTOS issues, like using a ‘semi-hosting’ driver that ‘takes over’ the machine to send characters to the debugger.

You say that vTaskStartScheduler() termintates? Is it getting an out of memory error, if so that would explain nothing starting. It will need to create the Idle and TImer tasks, and if it can’t get the memory for those it will just stop and die.