Quality RTOS & Embedded Software

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


Loading

vTaskDelay stuck??

Posted by Martijn Leidelmeijer on May 26, 2008
hi all,

i am trying to use vTaskDelay();
used the readme.

const portTickType xDelay = 500 / portTICK_RATE_MS;

also tried:

const portTickType xDelay = (portTickType)(500 / portTICK_RATE_MS);

then in a task i use it like:

vTaskDelay(xDelay);
then turn led on;



the led doesn't ever turn on.

when i do

turn led on;
vTaskDelay(xDelay);
turn led of;

then the led turns on but never turns off.

in freeRTOSConfig.h

#define configCPU_CLOCK_HZ( ( unsigned portLONG ) 8000000 ) // 8Mhz crystal
#define INCLUDE_vTaskDelay 1

i tried vTaskDelatUntil to same result.

grts

Martje

RE: vTaskDelay stuck??

Posted by Richard on May 26, 2008
Please check that the tick interrupt is actually running. You can do this by placing a break point in the tick interrupt handler, defined within port.c.

If the tick interrupt is not running then time will be standing still, so the time at which the task should unblock will never be reached.

Regards.

RE: vTaskDelay stuck??

Posted by Martijn Leidelmeijer on May 26, 2008
We dont have a debugger, so we cant test breakpoints. If the tick interrupt is not running how can we enable it?

regards,

Martje

RE: vTaskDelay stuck??

Posted by Richard on May 26, 2008
I think you will struggle without a debugger. Maybe you could toggle a digital output from the tick interrupt.

How you enable the interrupt depends on the port you are using. It should be automatically enabled when the scheduler is started. Look at the demo application for the port you are using.

Regards.

RE: vTaskDelay stuck??

Posted by Martijn Leidelmeijer on May 26, 2008
If we use:
const portTickType xDelay = 10 / portTICK_RATE_MS;

It goes further to the next code line.

But if we set the xDelay to an higher value, like 20 the program hangs at the delay..

We have tried a lot of different aproches on the delay, but they all seem to mailfunction with our processor (AT90USB1287). Even basic while/for loops are not working, if we use small loops like 1000 it doest seem to have any effect on the on / off rate of our test LED, if we make it longer the program hangs.

In your last reply you mention which port we are using. Do you mean the port our LED is on which is our output for the delay test function?

Thanks for your help so far,

Martijn

RE: vTaskDelay stuck??

Posted by Richard on May 26, 2008
Ref port - I was referring to which RTOS port you were using. That is, which CPU and compiler. From your previous reply though I see that it is an AVR.

Regards.

RE: vTaskDelay stuck??

Posted by Martijn Leidelmeijer on May 26, 2008
WinAVR GCC compiler
AT90USB1287 Processor.

we loaded the .elf file in the AVR studio to debug, but stil don't know how to check if the tick interrupt is working. in the debug it goes trew al the source like it has to but when we load the hex in the STK525 (at90usb1287) it gets stick @ the vTaskDelay.

we tried it like this now to but also that does't work.

const portTickType xDelay = 1 / portTICK_RATE_MS;

for(int i =0; i <= 500; i++)
{
vTaskDelay(xDelay);
LEDON():
}

for(long int i =0; i <= 50000; i++)
{
vTaskDelay(xDelay);
LEDOFF():
}

led turns on but never turns off again.

regards

Martje


RE: vTaskDelay stuck??

Posted by Dragie on May 26, 2008
i had the same problems make sure the timer registers are set oke that wil fix it :)


[ 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