Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Help with tasks

Posted by DownyTif on March 12, 2009

I'm quite new to the FreeRTOS world and I'm trying to build a application using it.

Platform: AVR32 (using AVR32 Studio)
Framework: AT32UC3A-1.4.0
Language: GNUC++

At the moment, I'm just trying to make the tasks work. I double checked eveything with the Atmel EVK1100 ControlPanel application that uses FreeRTOS and everything seems fine, but I always end up having the same problem...

My application is quite simple. Here is a code sample:
Note that:
configCPU_CLOCK_HZ == CP_CPU_SPEED == 48000000
configPBA_CLOCK_HZ == CP_PBA_SPEED == 12000000

--------------------------------- Main.cpp File ----------------------------------------

// Main
// Main function. Starts the different tasks and wait forever.
int main(void)
int bRet = FALSE;
CBDR29010 obj;

/* Primary Initialization.
-------------------------- */
// Switch the main clock to OSC0.
pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

// Initialize the delay driver.

// Init Clocks.

// Start the tasks.

// Start the OS. It should never return from there.

return 0;

--------------------------------- BDR29010.cpp File ----------------------------------------

// Constants

// Prototypes
portTASK_FUNCTION_PROTO(CommManagerTask, pParams);

// CBDR29010::Activate
bool CBDR29010::Activate()
bool bRet = false;
int taskCreateRet = pdFAIL;
xTaskHandle createdTaskHdl = NULL;

taskCreateRet = xTaskCreate(CommManagerTask, (const signed portCHAR*) "COMM_MGR",

if(taskCreateRet == pdPASS)
bRet = true;
bRet = false;

return bRet;

// TASK: ManagerCommTask
portTASK_FUNCTION_PROTO(CommManagerTask, pParams)
int allo = 1;

} while (1);

I trace the execution of the task. It enters correctly, calls the vTaskDelay(...) function but never returns from there. If I pause the execution, I get this
"No source available for "_handle_Supervisor_Call() " "

Checking the stack, it looks like it hangs just after the "portEXIT_CRITICAL();" call of the xTaskResumeAll() function in task.c.

Here is a copy of my FreeRTOSConfig.h file:

#define configUSE_MUTEXES 1
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( CP_CPU_SPEED ) /* Hz clk gen */
#define configPBA_CLOCK_HZ ( CP_PBA_SPEED )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 8 )
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 256 )
/* configTOTAL_HEAP_SIZE is not used when heap_3.c is used. */
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1024*25 ) )
#define configMAX_TASK_NAME_LEN ( 20 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1

#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 0 )

#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_xTaskGetSchedulerState 0

#define configTICK_USE_TC 0
#define configTICK_TC_CHANNEL 2

#define configHEAP_INIT 1

I have no idea if those settings are ok, but I presume they are since I based myself on a working application of the Atmel framework. But I suspect that I am missing some configuration to make this work...

Please, if you have any insight or suggestions, let me know.
Best regards,

RE: Help with tasks

Posted by Dave on March 13, 2009
Can you confirm that the tick interrupt is working? If the tick is not incrementing time then your block time will never time out after calling vTaskDelay() and the task will remain blocked.

RE: Help with tasks

Posted by DownyTif on March 13, 2009
I'm not sure where to look to confirm this... I'll search, but in the meantime, if you have any indications, please let me know.

Thanks again,

RE: Help with tasks

Posted by DownyTif on March 13, 2009
I traced in VTaskDelay() and xTickCount is 0... which I presume is the problem... I will try to find why, but again, any advice is welcome in the meantime.

Best regards.

RE: Help with tasks

Posted by DownyTif on March 13, 2009
ok, sorry, my vTickCount is incrementing... I traced in the "vTaskIncrementTick" function and the ticks are coming.

For some reason, my task that called vTaskDelay() looks to be never awoken...

RE: Help with tasks

Posted by MEdwards on March 13, 2009
Look at prvSetupTimerInterrupt() in port.c. This is where the tick interrupt is configured.

RE: Help with tasks

Posted by DownyTif on March 13, 2009
looks like my last post didn't proceed... I wrote that I was wrong. The xTickCount is indeed incrementing... I traced in the vTaskIncrementTick function.

Looks like my task is never awoken...

RE: Help with tasks

Posted by DownyTif on March 13, 2009
I found that it is a call to taskYIELD() that provokes the hanging... In the vTaskDelay function :

xAlreadyYielded = xTaskResumeAll();

returns false which provoke this:

/* Force a reschedule if xTaskResumeAll has not already done so, we may
have put ourselves to sleep. */
if( !xAlreadyYielded )

When called, those are the current values of the different variables:
xTicksToDelay = 10
xTickCount = 0
xTimeToWake = 10

I'm continuing my search... please feel free to give me advices, that will be much appreciated!

Best regards,

RE: Help with tasks

Posted by DownyTif on March 13, 2009
Problem solved!

Actually, it was a stupid problem (as I though).

In the AVR32 framework, there is a driver called INTC that has a "exception.x" file. So, in the project settings, I must exclude this file in order to use the "exception.x" file from FreeRTOS. I have examples in the AVR32 framework that work.

My error was to inconsciously exclude the "exception.x" file of FreeRTOS instead..........
Anyway, I hope this thread can help someone in the future!

Thanks to all,

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

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner