Quality RTOS & Embedded Software

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


Loading

Only first created task runs - WinAVR port

Posted 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 port

Posted 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 port

Posted 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


[ 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.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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.


Careers

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

Renesas

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