Quality RTOS & Embedded Software

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


Loading

using vTaskDelayUntil in more then one task

Posted by daniel on September 7, 2010
I use FreeRTOS V6.0.5 on ARM1176JZF-S
I created two small tasks to test freeRtos:

1st task - toggle LEDs using the vTaskDelayUntil function
2nd task - just toggle LEDs

//the prototypes
static portTASK_FUNCTION_PROTO( vLEDFlashTask2, pvParameters );
static portTASK_FUNCTION_PROTO( vLEDFlashTask1, pvParameters );


void vStartLEDFlashTasks( unsigned portBASE_TYPE uxPriority )
{

xTaskCreate( vLEDFlashTask1, "LED1", configMINIMAL_STACK_SIZE, ( void * ) NULL, uxPriority, ( xTaskHandle * ) NULL );
xTaskCreate( vLEDFlashTask2, "LED2", configMINIMAL_STACK_SIZE, ( void * ) NULL, uxPriority, ( xTaskHandle * ) NULL );
}

//task 1
portTickType xLastWakeTime1;
static portTASK_FUNCTION( vLEDFlashTask1, pvParameters )
{
xLastWakeTime1 = xTaskGetTickCount ();

for( ;; )
{
vTaskDelayUntil( &xLastWakeTime1, 1000 );
vParTestSetLED(1, 1);

vTaskDelayUntil( &xLastWakeTime1, 3000 );
vParTestSetLED(1, 0);
}
}

//task 2
static portTASK_FUNCTION( vLEDFlashTask2, pvParameters )
{
for( ;; )
{
vParTestSetLED(0, 0);
taskYIELD();
}
}

These tasks work fine (LED1 toggles with 1000, 3000 and LED 0 toggles all the time)

The problem occurs when i did the following:
I changed the vLEDFlashTask2 to use vTaskDelayUntil (same as the vLEDFlashTask1 task)
Now it looks like:

portTickType xLastWakeTime2;
static portTASK_FUNCTION( vLEDFlashTask2, pvParameters )
{
xLastWakeTime2 = xTaskGetTickCount ();

for( ;; )
{
vTaskDelayUntil( &xLastWakeTime2, 500 );
vParTestSetLED(0, 1);

vTaskDelayUntil( &xLastWakeTime2, 250 );
vParTestSetLED(0, 0);
}
}

The problem is, when I run the first vTaskDelayUntil (no matter on which task) I get "stuck" inside the idle task forever and nothing else happens.
The tick timer works fine.


RE: using vTaskDelayUntil in more then one task

Posted by Richard on September 7, 2010
> I use FreeRTOS V6.0.5 on ARM1176JZF-S I created two small tasks to
> test freeRtos:

There is no official ARM11 port so I would be appreciate it if you could upload the code to the FreeRTOS interactive site:
http://interactive.freertos.org


I think the modified code you describe that does not work has the exact same structure as the simple flashing led example that comes in the FreeRTOS download, so should work. Take a look at FreeRTOS/Demo/common/minimal/flash.c.

Regards.

RE: using vTaskDelayUntil in more then one task

Posted by daniel on September 7, 2010
The code in the FreeRTOS/Demo/common/minimal/flash.c it acts as I described before.

RE: using vTaskDelayUntil in more then one task

Posted by Richard on September 7, 2010
You mean it fails? That is about as simple a test as possible and runs without fault on countless architectures. Sorry to say, but I would suggest there is a problem in your port.

Regards.


[ 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