vTaskDelayUntil

nobody wrote on Wednesday, February 22, 2006:

I’m trying to use the vTaskDelayUntil :
I have 3 tasks 
- task 1 : priority 1 and it is resuming task 2
- task 2 : priority 2 and it is itself suspending
- task 3 : using vTaskDelayUntil like in FreeRTOS example

and it is scheduling like this
task 3 wake up + sleeping
task 2
task 1
task 2
task 1
task 2
task 3 wake up by timer + sleeping
task 1
task 1

task 3 wake up by timer + sleeping
task IDLE …

I don’t understand why it is 'killing" the other task : the value of uxNumberOfItems for the 
pxReadyTasksLists[2] & [3] became 0 ???

task 3 is priority 3 and task 1 is my low priority task in which there is always something to do
static void task1( void *pvParameters )
{
( void ) pvParameters;
for( ;; )
{
//there is always something : polling + TaskResume(Task2) so pxReadyTasksLists[1].uxNumberOfItems must be always 1 

}
}

static void task2( void *pvParameters )
{
( void ) pvParameters;
for( ;; )
{
//code + TaskSuspend(NULL) 

}
}

static void task3( void *pvParameters )
{
portTickType xDelayPeriod = 100;
portTickType xLastWakeTime;

( void ) pvParameters;

xLastWakeTime = xTaskGetTickCount();

for( ;; )
{
vTaskDelayUntil( &xLastWakeTime, xDelayPeriod );
//code
}
}

I understand pxReadyTasksLists[2].uxNumberOfItems can be 0 because I’m suspending it but for the task1 it must be always 1 but in my case this task is not working anymore as I wrote before.

nobody wrote on Wednesday, February 22, 2006:

Nothing obviously wrong.  This is your only code?  Have you changed the os code at all?

nobody wrote on Thursday, February 23, 2006:

Hello,

We have a RAISONNANCE evaluation board which is using RIDE development. I must have done the “portage” to RIDE and I did this from the IAR one of the STR for the port part and I use the GCC LPC2106 for the gcc part and I’m turning in arm mode for the task.
I think I must have done something wrong because when I’m changing the compile option (for example -finline-functions or no) the os is working differently for the vTaskDelayUntil.
Once it is doing :
task 3 wake up + sleeping 
task 2 
task 1 
task 2 
task 1 
task 2 
task 3 wake up by timer + sleeping 
task 1 
task 1 
… 
task 3 wake up by timer + sleeping 
task IDLE … 

and the other it’s doing :
task 3 wake up + sleeping 
task 2 
task 1 
task 2 
task 1 
task 2 
task 3 wake up by timer + sleeping 
task IDLE … 

in GCC LPC2106 makefile there is no -finline-functions : I must use it? What are the options in IAR : I can’t read them because we don’t have IAR and there is no makefile.
Is there -ansi? -mapcs-frame? -fvolatile? o1? -g (debug)? -L? etc …

I hope I was clear
Thanks

nobody wrote on Thursday, February 23, 2006:

I am confused.  You have created a GCC STR71X port from combining the STR71X IAR port and the LPC2000 GCC port.  Correct?

Have you tried it with optimisation turned off?  Sometimes the optimisation can be very aggressive in GCC.

Also, GCC is likely to use more stack than IAR.  Perhaps try increasing the stack sizes.

nobody wrote on Friday, February 24, 2006:

that’s it, we have created a GCC STR71X port from combining the STR71X IAR port and the LPC2000 GCC port.
optimization : -o1 + debug -g

I just notice after several executions that :
- the tasksuspend & taskresume is working well
- fifo is working well
- semaphore is working well
- vTaskDelayUntil is not working well
and I’m wondering that what is working is when there is taskYield : switch context with software interrupt and vTaskDelayUntil is working good when we are stopping the task because it’s switching context with taskYield  and when we are reputting the task when the tick is good (in wdg interrupt) something wrong is happening. So I have pb with switching context with the wdg timer and I don’t understand why? : thumb code, not possible normally because we are in ARM in IT? I’m trying to find solutions but now I’m still searching.
Thanks

nobody wrote on Friday, February 24, 2006:

Have you tried giving more stack to each task.  Maybe the time value is getting whacked.

nobody wrote on Friday, February 24, 2006:

I increase configMinimalStackSize in Freertosconfig.h but it’s changing nothing. I don’t understand the ink between the stack size and the tick?

nobody wrote on Friday, February 24, 2006:

I increase configMinimalStackSize in Freertosconfig.h but it’s changing nothing. I don’t understand the ink between the stack size and the tick?

nobody wrote on Friday, February 24, 2006:

I just found an idea and it is working well now :
the taskyield is calling SWI interrupt which is in supervisor mode and in this case everything is working well and the timerWDG is in IRQ mode and not in supervisor mode so in vPortPreemptiveTick (function called in WDG), I’m doing a SWI interrupt and I added in vPortYiledProcessor the vTAskIncrement just to try if it will work and in this case the vTaskDelayUntil is working and the tasks are switching normally.

So I don’t understand for the port for IAR/STR710 : is it good or no for the WDG Timer because we are not in supervisor mode in this case?
Which changes must I do for the WDG timer to be in supervisor mode.

Thanks