Quality RTOS & Embedded Software

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


Loading

vTaskDelay doesn´t delay a regular time

Posted by Fernando Gatto on March 7, 2008
Hi Everybody:
I have a trouble vTaskDelay that I can´t understand. Surely It´s easy but I can´t find it.

If I execute the following code in a Task of the second highest priority, it doesn´t block 20 ticks everytime. Sometimes remains blocked until the following post on the queue and sometimes it last 20 ticks. I checked that the upper task, wich post on this queue, doesn´t stay freezing the system.

for(;;)
{
if( xQueuePeek( xQueue_Tx_Rf_local, bBuffer , portMAX_DELAY) )
{
vTaskDelay(20);
.
.
}
}

I have another task with a lower priority that executes vTaskDelay correctly. If I use a for{} delay instead of vTaskDelay() everything works ok. What could be the cause that block vtaskDelay a different time of 20 ticks

I am using a MSP430 port.

Thanks Reny09

RE: vTaskDelay doesn´t delay a regular time

Posted by Dave on March 7, 2008

> for(;;)
> {
> if( xQueuePeek( xQueue_Tx_Rf_local, bBuffer , portMAX_DELAY) )
> {
> vTaskDelay(20);
> .
> .
> }
> }

What comes after the vTaskDelay(20)? Are you guaranteed to know if it goes around the loop again.

The first thing to check is stack issues. This is the most usual cause of problems. You could try the new uxTaskGetStackHighWatermark() function, or you could simply try allocating more stack to this task.

RE: vTaskDelay doesn´t delay a regular time

Posted by Fernando Gatto on March 9, 2008
Thanks davedoors for your suggestion. I have checked the stack, and there is enough room. So I´dont know what I could be doing wrong.

After the delay I check a pin and then I enter in a Critical Section writing on a SPI bus. I don´t know if going through a critical section could affect. When I´ve checked the work of delay I toggled a Led before and after of vTaskDelay() and watching it with the oscillocope is when I saw that makes the erratic work.


Bye Reny09

RE: vTaskDelay doesn´t delay a regular time

Posted by woops_ on March 9, 2008
I presume you are not waiting in the critical section for the SPI transfer to complete?

RE: vTaskDelay doesn´t delay a regular time

Posted by Fernando Gatto on March 11, 2008
Hi woops_.
I will check your suggestion. Also I will test disabling other tasks in order to test which one is blocking vTaskDelay. Now I am using a for based delay and everything works fine.

Bye


[ 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