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




Loading

Problems with vTaskDelete(NULL)

Posted by the-moog on April 12, 2007
Hi,

I have two tasks that are mutually exclusive front ends for a piece of embedded software.

One of the tasks is initially created by another task.

When this new task receives a given command, it creates the other task and deletes itself.

When I do this the code seems to restart at the function being run at the time that the first task was deleted.

E.g.

Task 1 creats task 2, then idles
Task 2 later receives a command which starts task 3, task 2 then kills itself with vTaskDelete(NULL).
Task 3 later receives a command which starts task 2, task 3 then kills itself with vTaskDelete(NULL). But it seems that task 2 then immediately suspends or yields to the now dead task 3.
The same function is called by task 1, 2 and 3 for creating and deleting tasks, 2 and 3 are created with the same priority.
I can't trace what exactly happens as it happens inside the RTOS kernel which the debugger (insight/gdb) has problems with tracing.
I thought perhaps task 2, when being re-created is resuming at the last function it was running when it was killed, which is the single task change function.

What other mechanisms can I use to trace the problem?

Using FreeRTOS v4.0.4 on an LPC/ARM7, is this a known problem? Will updating to a newer FreeRTOS solve it? (so far avoided this as it may cause a lot more work)

cheers,
Jason.

RE: Problems with vTaskDelete(NULL)

Posted by Richard on April 12, 2007
Sounds very odd, and not a known problem. I don't think anything in later versions will change anything in this area.

A couple of things to check:

1) Is the idle task being starved out (not getting any processing time)? The idle task performs some clean up of tasks that have been deleted.

2) Are you checking the return value of xTaskCreate()? It might be that the function is failing because of memory allocation problems.

Regards.


[ 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