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

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