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] [June 2016 Threads]
Hi,
the code I use is based on the example code reduced to the minimum:
2 tasks that make 2 LEDs blink. The task using vTaskDelay(100) works as expected
but the task using vTaskDelayUntil( &xLastWakeTime, xDelayMyTaskms) shows
an unpredictable behaviour with 16bit ticks. With 32bit ticks also vTaskDelayUntil
works on my system.
The last time I used FreeRTOS on a similar uC before was with FreeRTOS7.x
and i believe that it worked that days. But FreeRTOS tasks.c changed a lot in between.
Did anyone else try the 16bit ticks with FreeRTOS9 on a 16bit uC?
Hardware:
Microchip dsPIC33EV128GM104
Software:
MPLAB X IDE v3.30
XC16 (v1.26) compiler
FreeRTOS 9.0
FreeRTOSConfig.h
~~~
define configUSE16BIT_TICKS 1
~~~
Bug description:
vTaskDelay(100); // works as expected
vTaskDelayUntil( &xLastWakeTime, xDelayMyTaskms); // unpredictable behaviour
FreeRTOSConfig.h
~~~
define configUSE16BIT_TICKS 0
~~~
-> Everything is ok.
Task:
~~~
static void ledTask( void pvParameters )
{
TickTypet xLastWakeTime;
const TickTypet xDelayMyTaskms = pdMSTOTICKS(100);
int ledStatus = 0;
/ Remove compiler warnings. */
( void ) pvParameters;
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
works correctly. */
xLastWakeTime = xTaskGetTickCount();
for( ;; ) {
vTaskDelayUntil( &xLastWakeTime, xDelayMyTaskms);
//vTaskDelay(pdMSTOTICKS(500) );
if (ledStatus) {
LED1 = 0;
ledStatus = 0;
}
else {
LED1 = 1;
ledStatus = 1;
}
}
}
~~~
Regards
Michael
For some reason my reply to your post created a new thread, rather than replying here. This was my reply:
Can you confirm that:
1) Your configTICKRATEHZ value is valid for using with pdMSTOTICKS
(it is 1000 or less).
2) The calculation pdMSTOTICKS( 100 ) gives the expected value in both
cases, and is not over/under flowing in one case.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.