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] [April 2010 Threads] Only first created task runs - WinAVR portPosted by Gerardo Rosiles on April 28, 2010 Based on the examples from the book, I created a program with three tasks and a queue. The fist task receives numbers from the queue and does printf to the terminal. The second receives numbers from the terminal and places them on the queue. The third just flashes some LEDs.
The priorities are 3, 2 and 1 respectively.
The program only executes one task, which is that task that is created first in main(). I figured this out after commenting xTaskCreate(...) calls and seeing that the next task took over the execution. I hav tried taskYIELD() and vTaskDelay() to see if I can force a switch and nothing happens.
For instance, I know first task should block waiting for the second task to post something on the queue. It does block (tried portDELAY_MAX, and other values. However there is no context switch to the second task.
On the second task I have used vTaskDelay() to let the third task run and it does switch.
If I shuffle the xTaskCreate(...) statements in main, only the fist task created gets executed even if it has the lowest priority!
I feel I am not configuring something correctly. However I do have the following on FreeRTOSConfig.h
#define INCLUDE_vTaskSuspend1 #define INCLUDE_vTaskDelayUntil1 #define INCLUDE_vTaskDelay1
Any help would be appreciated.
Thanks,
Gerardo
RE: Only first created task runs - WinAVR portPosted by Gerardo Rosiles on April 28, 2010 I just checked the value returned by xTaskCreate on all three instances I get pdTRUE. So no memory problems(?).
RE: Only first created task runs - WinAVR portPosted by Gerardo Rosiles on April 28, 2010 Well, I think writing your frustations in the forum works! It ocurred that a stack depth size of 10000 could be quite large for an Atmega32 so I cut it to 200, and now my program is working.
The minimal stack size for the ATmega port is set at 85.
Now I would like to understand what was going on? According to xTaskCreate the tasks were created, however it seems that the stack space was depleted after the first task creation (???).
Could this be a bug in FreeRTOS? or please illiustrate my ignorance :).
Regards,
Gerardo
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|