Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


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.



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 :).



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

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

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists