FreeRTOS - Wrong parameters passed to function vTaskDelayUntil

mricha wrote on Monday, July 09, 2018:

Target: PIC18F452 (same one used for demos)
FreeRTOS version: V10.0.1

When calling the function:

void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement)

For ex:

vTaskDelayUntil( &xLastWakeTime, 1000); 

Parameter xTimeIncrement is always being ZERO, thus the delay is not happening and the task runs as fast as possible.

Any ideas?
Thank you

rtel wrote on Monday, July 09, 2018:

I’m not sure I fully understand your post. Are you saying that
xTimeIncrement is being passed into vTaskDelayUntil() correctly (in that
you can set a break point inside the function as see it is passed in as
a non-zero value) but the function is behaving as if the value was 0?
Or are you saying when you look at the value inside vTaskDelayUntil() it
genuinely is zero?

If the first case then it might be that more than xTimeIncrement ticks
have passed since pxPreviousWakeTime was updated, so you are effectively
asking to block until a time that is already in the past, so the
function doesn’t block at all.

If the second then it could be simple a stack overflow or other such
corruption.

mricha wrote on Tuesday, July 10, 2018:

mricha wrote on Tuesday, July 10, 2018:

In fact I have added a breakpoint inside the function. This is how I found out that xTimeIncrement param is always being ZERO no matter what’s the actual passed value - even at the very first call. There’s no overflow.

rtel wrote on Wednesday, July 11, 2018:

So the parameters is genuinely 0.

As this is a function call, which is generated by your C compiler, there
are very few ways that FreeRTOS can effect this. One way is for the
stack pointer to be misaligned within a task - but I think on that
hardware there are no specific stack alignment requirements.