FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2007 Threads] Problems with xTaskDelay()Posted by Nobody/Anonymous on March 1, 2007 Hello,
I've some mysterious problems with the xTaskDelay function. I start a task an everything runs until the xTaskDelay()-function is called and never returns. But if I create a "do-only-i++"-task with a priority set to tskIDLE_PRIORITY+1 and set the other task to tskIDLE_PRIORITY+2, everything runs normal.
I don't know, that isn't the way it should work, is it? By the way, I use a LPC2106 Board, GCC4.1.1 and FreeRTOS V3.2.3.
So, if someone have a good guess, what might be wrong, all answers are welcome. Thanks.
RE: Problems with xTaskDelay()Posted by Nobody/Anonymous on March 1, 2007 I don't understand your explanation. Can you try rewording or giving an example simple bit of code.
If xTaskDelay() does not return are you sure the tick interrupt is running correctly?
Are you using an idle hook that calls a blocking function?
RE: Problems with xTaskDelay()Posted by Nobody/Anonymous on March 1, 2007 I hope this time it is more understandable:
I create a task: -> xTaskCreate(v_task_Heartbeat,(const signed portCHAR * const) "heartbeat", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, &x_task_Heartbeat_Handle); which should do: ->void v_task_Heartbeat(void *pvParameters) { pvParameters = 0;
HEARTBEAT_LED_PORT = HEARTBEAT_LED;// set to output // endless loop for(;;) { vTaskDelay(HEARTBEAT_LED_DELAY);// wait for 500 ticks (0.5s) HEARTBEAT_LED_PORT_CLR = HEARTBEAT_LED; // turn on LED vTaskDelay(HEARTBEAT_LED_DELAY);// wait for 500 ticks (0.5s) HEARTBEAT_LED_PORT_SET = HEARTBEAT_LED; // turn off LED } }
I use openocd to debug the program and when i reach the line: vTaskDelay(....), the programm jumps into the function. My task get delayed, but never wake up. When i step further the programm calls the Idle-Task an check if there are other task ready to run. Then i let the programm continue and after a short time i hold it. The programm now has reached an abort-error-loop. Now i increase the Task-Priority to 2 and create a new task: ->void v_task_idle_2(void *pvParameters) { pvParameters = 0; u32 i;
// endless loop for(;;) { i++; } } with a Priotity of tskIDLE_PRIRITY+1. If i run this programm, everything seems to run normal an my LED is blinking. I don't use an idle hook.
Some more settings: -> #define configUSE_PREEMPTION1 #define configUSE_IDLE_HOOK0 #define configCPU_CLOCK_HZ( ( unsigned portLONG ) 58982400 )/* =12Mhz xtal multiplied by 4 using the PLL. */ #define configTICK_RATE_HZ( ( portTickType ) 1000 ) #define configMAX_PRIORITIES( ( unsigned portBASE_TYPE ) 8 ) #define configMINIMAL_STACK_SIZE( ( unsigned portSHORT ) 150 ) #define configTOTAL_HEAP_SIZE( ( size_t ) ( 10 * 1024 ) ) #define configMAX_TASK_NAME_LEN( 16 ) #define configUSE_TRACE_FACILITY0 #define configUSE_16_BIT_TICKS0 #define configIDLE_SHOULD_YIELD1
/* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */
#define INCLUDE_vTaskPrioritySet1 #define INCLUDE_uxTaskPriorityGet1 #define INCLUDE_vTaskDelete0 #define INCLUDE_vTaskCleanUpResources0 #define INCLUDE_vTaskSuspend1 #define INCLUDE_vTaskDelayUntil1 #define INCLUDE_vTaskDelay1
RE: Problems with xTaskDelay()Posted by Nobody/Anonymous on March 1, 2007 By creating a second idle task that never blocks, you are soaking up all the available CPU so prvIdleTask is never executed. That seems to make it work. So I would then guess that the problem lies in prvIdleTask.
But in your configuration the prvIdleTask in tasks.c will do nothing at all if you create no tasks at tskIDLE_PRIORITY - are you sure you don't have such tasks also defined?
It all sounds like either an interrupt going astray or perhaps your SWI handler not being setup properly and thus you're getting aborts when trying to execute garbage?
Robin
RE: Problems with xTaskDelay()Posted by Nobody/Anonymous on March 1, 2007 Hello Robin, thanks for your answer. I checked the tasks.c, the interrupt routines and a few other functions, and there was nothing. While searching the code, i found a bug in my own code. (Actually i searched my own code a few times but didn't saw it before). Now everything seems to work fine. (until the next bug :-) )
Again, thanks to all for helping me out.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|