Hy,
I would like to obtain delay in the order of 50us on a FreeRTOS having a tick of 1ms (1000Hz) on TMDX570LC43HDK, I’m almost sure that this is a non sense,
so the solution could be a tick for example of 10us, is it a realistic solution to this kind of problem?
Thanks
Antonio
No, leave tick at 1 to 100ms and use a timer on interrupts for your
delay. If it happen infrequently, you might be able to use a delay loop.
All depends on your system design.
Haveing a tick at 50 or 10us would use a lot of CPU resources in the
FreeRTOS scheduler doing nothing very useful.
Hy,
I would like to obtain delay in the order of 50us on a FreeRTOS having a
tick of 1ms (1000Hz) on TMDX570LC43HDK, I’m almost sure that this is a non
sense,
so the solution could be a tick for example of 10us, is it a realistic
solution to this kind of problem?
Thanks
Antonio
Antonio, in my opinion: when you need a delay of more that a ms, you could have the task sleep by calling e.g. vTaskDelay().
When you want to wait for 50 uS, you can go either of two ways:
Set-up a timer-counter that you can poll and wait 50 uS in a loop.
Write a loop that has a predictable speed of execution.
Take care with the latter, when you change the optimisation level of the compiler, a loop could be implemented differently, or even not be compiled at all.
One solution to this is to write the loop as assembler code.
Here is an example from Atmel:
void portable_delay_cycles(unsigned long n)
{
UNUSED(n);
/* n is passed in the register r0 */
asm volatile (
"loop: DMB \n"
"SUBS R0, R0, #1 \n"
"BNE.N loop "
);
}