On 1/28/2023 7:15 AM, Max Kriegleder wrote:
I am using the tickless OS setting with 1 USEC_PER_TICK and ultimately I want to control a stepper motor where I need to delay toggling of pins for very short and accurate amounts of time to achieve a certain movement profile of the motor - just for information, maybe I am thinking in the wrong direction

It has been some time since I have heard measurements of interrupt entry latency and context switch times for the OS, but I do remember some older measurements on an STM32 F4:  It required around 10 uS to do either.  Modern MCUs can probably do better but, in any case, you are working beyond the resolution of the interrupt/context switch capability.

If for example, you receive a timer interrupt then perform a context switch to run a task, that would be expected to require something like 20 uS on an STM32 F4.  Could that be the issue?

You can reduce that interrupt latency by using a separate interval timer with a high priority, zero latency interrupt; you can eliminate the context switch by performing the pin toggling in the interrupt handler.  That would still result in a significant, but smaller, delay


Reply via email to