xTicksToWait within xQueueSendToBack

Hello, I would like to use xQueueSendToBack function with a block time, so I write the next program:
xQueueSendToBack(xQueue1,  ( void * )  &Data, ( portTickType ) 100 ); When I tried to debug this function, I go directly to xQueueGenericSend and the value of xTicksToWait is always 0 instead of the value I have set (100). Could you please help me to understand this behavior? For information, I work with:
- FreeRTOS V6.1.1
- EWARM  6.21.3
- Compiler optimisation for FreeRTOS set to High (Speed) Thanks for your help,
Best regards,
Fabien

xTicksToWait within xQueueSendToBack

xQueueSendToBack maps to xQueueGenericSend so that is expected.  At high optimisation you may see the variable as zero in the debugger because there is no direct relationship between the source code and the object code. Do you see the same thing when you compile with zero optimisation? Regards.

xTicksToWait within xQueueSendToBack

Hi Richard, Thanks a lot for your reply.
I tried to compile with zero optimisation and the result is the same. When I enter inside the function:
xQueueSendToBack(xQueue1, ( void * ) &Data, ( portTickType ) 100 );
The value of xTicksToWait is always 0 instead of 100. Do you have any idea? Thanks for your help,
Best regards
Fabien

xTicksToWait within xQueueSendToBack

Do you have any idea?
Sorry no – this is just C code.  If you pass a parameter into a C file I would expect the compiler to generate code that passed the parameter into the function.  All I can suggest is that you step through the assembly code to see the parameter getting placed into a register outside of the function call, and then see the value getting read out of the register inside the function call. If the parameter is passed on the stack rather than in a register ensure the stack pointer is correctly aligned at that point in the code. If you suspect a context switch is occurring in between calling the function and entering the function and that somehow that is corrupting the register value then try entering a critical section before calling the function (call taskENTER_CRITICAL()) just as an experiment . Regards.

xTicksToWait within xQueueSendToBack

Hi Richard I tried your suggestion to call taskENTER_CRITICAL() before to call xQueueSendToBack and it works fine.
I made some tests and found that it was a context swith done by one interrupts. Thanks a lot for your useful feedback.
Adding  taskENTER_CRITICAL() was just for debug purpose, so I removed it and I will look now to fix this issue in my software. Best Regards,
Fabien