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] [December 2011 Threads] vTaskDelay is to shortPosted by Patrick_ECR on December 9, 2011 Hello I'm new on FreeRTOS and started with a own simple project to test mukltitasking. Now i've got the first problem. In the code below i call vTaskDelay to wait 500ms before toggeling the output. But when I measure the frequency with scope, I can see, that the delay is arround 50us. It doesn't matter which time is entered, I always get the same delay. Any suggestions? static portTASK_FUNCTION(vMainTask2, pvParameters) { const portTickType xDelay = 500/portTICK_RATE_MS; for(;;){ vTaskDelay(xDelay); Bit3_NegVal(); } } The timertick works correct at 1ms. I've already changed the settings of portTICK_RATE_MS and it's parameters to the right value. I'm using the MCF52259 from Freescale, IDE: codewarrior 10.1 (Eclips version), FreeRTOS V7.0.2 Thanks for help! Best regards Patrick
RE: vTaskDelay is to shortPosted by Richard on December 9, 2011 “The timertick works correct at 1ms. I've already changed the settings of portTICK_RATE_MS and it's parameters to the right value.” That is not a user configurable value, please set it back to its default as it should be calculated automatically from the value of configTICK_RATE_HZ. Only the values in FreeRTOSConfig.h are user configurable. Note that portTICK_RATE_MS is only useful when configTICK_RATE_HZ is equal to or less than 1000. Regards.
RE: vTaskDelay is to shortPosted by Patrick_ECR on December 9, 2011 Thats right. I just wanted to say that i've configured configTICK_RATE_HZ in FreeRTOSConfig.h. portmacro.h is at default-state.
Do you know this problem or any reason for that?
RE: vTaskDelay is to shortPosted by Richard on December 9, 2011 Please take a copy of the tick count both before and after the delay call as:
ulTimeBefore = xTaskGetTickCount(); vTaskDelay(xDelay); ulTimeAfter = xTaskGetTickCount();
and then see what (ulTimeAfter - ulTimeBefore) is.
Regards.
RE: vTaskDelay is to shortPosted by Patrick_ECR on December 12, 2011 The difference is always zero/one. So there is no delay by calling the vTaskDelay().
I also tried to call the function with different xDelay's and watched the pin with scope. But there is no difference neither with 5 nor with 500. Togglefrequency of the pin is somewhere above 10kHz.
RE: vTaskDelay is to shortPosted by Dave on December 12, 2011 If an interrupt vector is used to yield a task (a yield is done inside vTaskDelay()), have you installed the interrupt handler correctly in the vector table? Maybe the handler is just using a default handler that does nothing but return right away. Have you tried stepping through the vTaskDelay() function to see what happens? It is not a long function.
RE: vTaskDelay is to shortPosted by Patrick_ECR on December 12, 2011 Yes i already debugged the vTaskDelay but didn't see anything unuasual (except it doesn't wait :) ).
I use the internal PIT0 (programable interrupt timer) to generate the 1ms tick. This one i checked with the function vApplicationTickHook which works well.
So i'm confused that i have to configure a second int-vector?
Is it right that during PIT-int an new interrupt is set to change task after PIT-Int? Which function should be called with the second interrupt?
Thank you for helping me!
RE: vTaskDelay is to shortPosted by Richard on December 12, 2011 Please read the "Resources Used by the Kernel" section on one of the ColdFire V2 documentation pages, for example: http://www.freertos.org/Free-RTOS-for-ColdFire-MCF5222x-using-CodeWarrior.html
Regards.
RE: vTaskDelay is to shortPosted by Patrick_ECR on December 14, 2011 I've got the problem.
To make the vTaskDelay work, I had to initiaize and enable another (software)interrupt which calls the vPortYieldISR. Without this it doesn't work.
Thank to everybody of you for help!
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|