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

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