Quality RTOS & Embedded Software
About   Contact   Support   FAQ

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs Books & Kits Trace Tools Ecosystem FreeRTOS Labs Training




Last site update Oct 5 2014

Embedded TCP/IP stack for RTOS advert

Loading

FreeRTOS No Tasks Running - Only OS Timer

Posted by Stan Vreeland on May 31, 2012
Hello everyone,

We are using a Renesas RX631 MCU and after varying amounts of time our application codes stops running. When the application code stops running, we have verified that none of the tasks get serviced and it appears as though the software is “stuck somewhere” within the freeRTOS source.

Interestingly enough, we do have an OS Timer running as well which does get serviced even though the tasks are not. We have verified that the HW timer used for the OS Tick is still functioning properly when the code stops running. We are currently using freeRTOS version 7.0.1.

Has anyone experienced this issue or have any clues?

Thanks in advance! Stan

RE: FreeRTOS No Tasks Running - Only OS Timer

Posted by Richard on May 31, 2012
That is often a symptom of interrupt priorities being wrong. Are you calling any FreeRTOS API functions from interrupts that have a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY (defined in FreeRTOSConfig.h)? Are you calling any FreeRTOS API functions that don't end in "FromISR" from any interrupt?

Also check for the normal stack overflow issues using configCHECK_FOR_STACK_OVERFLOW.

See http://www.freertos.org/FAQHelp.html for more common sources of problems.

Software timers are themselves executed from the timer daemon task - so tasks are still being scheduled.

Regards.

RE: FreeRTOS No Tasks Running - Only OS Timer

Posted by Stan Vreeland on May 31, 2012
Thanks for your reply Richard,

Our code currently utilizes 24 interrupts. Of which, the only two that make calls into freeRTOS are the USBI0_INTERRUPT_HANDLER (which only gets called when a USB drive is inserted) and the vTickISR interrupt which is part of the sample source code provided in the freeRTOS package for the RX600. The code for vTickISR is as follows:

#pragma interrupt ( vTickISR( vect = _VECT( configTICK_VECTOR ), enable ) ) void vTickISR( void ) {
/* Increment the tick, and perform any processing the new tick value
necessitates. */
set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY );
{
vTaskIncrementTick();
}
set_ipl( configKERNEL_INTERRUPT_PRIORITY );

/* Only select a new task if the preemptive scheduler is being used. */
#if( configUSE_PREEMPTION == 1 )
taskYIELD();
#endif
}

Where the #define for configMAX_SYSCALL_INTERRUPT_PRIORITY is 4 and the #define for configKERNEL_INTERRUPT_PRIORITY is 1.

As for the stack checking - we have this feature enabled but are not receiving any stack overflow errors.

Thanks again, Stan

RE: FreeRTOS No Tasks Running - Only OS Timer

Posted by Richard on May 31, 2012
Which IDE are you using? If it is E2Studio or IAR then you can inspect the task states with the state viewer plug-in when they apparently stop running. That would provide some clues.

Regards.

RE: FreeRTOS No Tasks Running - Only OS Timer

Posted by Stan Vreeland on May 31, 2012
We are using HEW from Renesas

RE: FreeRTOS No Tasks Running - Only OS Timer

Posted by Richard on May 31, 2012
“When the application code stops running, we have verified that none of the tasks get serviced”


How have you verified that? Have you put break points in the tasks, or looked at which tasks are being selected by the scheduler, or something else?


“and it appears as though the software is “stuck somewhere” within the freeRTOS source.”


When it stops running, and you break the debugger, which line of code is being executed? Is it always the same line? Are interrupts enabled (look in the registers in the debugger)? Is the scheduler suspended (what is the value of uxSchedulerSuspended in tasks.c)?


“Interestingly enough, we do have an OS Timer running as well which does get serviced even though the tasks are not.”


I presume you mean a software timer? If so, that is actually running in a task. What is the priority of the timer service task (what value does configTIMER_TASK_PRIORITY have in FreeRTOSConfig.h) compared to the other tasks in the system?

Regards.

RE: FreeRTOS No Tasks Running - Only OS Timer

Posted by Stan Vreeland on May 31, 2012
1. Yes, we put breakpoints in all of the tasks.

2. We don't remember which line of code was being executed by the RTOS - I will let you know if I get this failure mode again. I will also check to see if the interrupts are enabled and if the scheduler is suspended.

2. The following software timer was still running:

uHeatTimerHandle = xTimerCreate( "uHeatTick",
(UHEAT_TIMER_DELAY_MS / portTICK_RATE_MS),
pdTRUE,
0,
(tmrTIMER_CALLBACK)UHeatTimerCallback
);

The priorities are as follows:

#define configMAX_PRIORITIES( ( unsigned portBASE_TYPE ) 40 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

/* Software timer definitions. */
#define configUSE_TIMERS1
#define configTIMER_TASK_PRIORITY( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH5
#define configTIMER_TASK_STACK_DEPTH( configMINIMAL_STACK_SIZE * 2 )

/* The interrupt priority used by the kernel itself for the tick interrupt and the pended interrupt. This would normally be the lowest priority. */
#define configKERNEL_INTERRUPT_PRIORITY 1

/* The maximum interrupt priority from which FreeRTOS API calls can be made.
Interrupts that use a priority above this will not be effected by anything the kernel is doing. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4

RE: FreeRTOS No Tasks Running - Only OS Timer

Posted by MEdwards on May 31, 2012
So your timer task priority is the highest possible priority. If the timer task is still running, as you say, then it could be that one of the lower priority tasks has got into a mode where it never blocks and is starving all tasks that have a lower priority than it from ever running but it itself is still preempted by higher priority tasks such as the timer task.

40 is a really big number for the number of priorities. Just commenting, maybe you need that, but most of my code has maybe 10 at most. Remember that tasks can share the same priority.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2013 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.