FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [May 2008 Threads] 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 :)
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|