Quality RTOS & Embedded Software

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


Problems with vTaskDelete(NULL)

Posted by the-moog on April 12, 2007

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.


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)


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.


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

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.


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


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