Execution of piece of code with zero interruption

I need to test the speed of toggling some pins. So I need to block the entire code from doing absolutely anything else. i.e. including any RTOS tasks.

I was thinking taskENTER_CRITICAL followed by vTaskSuspendAll. But perhaps that’s not correct (because when I look at the scope traces there seems to be jitter)?

How can I do that? What functions and in what sequences do I use them?

Thank you

is sufficient since it disables all interrupts covered by FreeRTOS (i.e. with prio logically <= configMAX_SYSCALL_INTERRUPT_PRIORITY if used by the actual MCU port like Cortex-M).

TaskENTER_CRITICAL should be enough. Only interrupts that you have defined above the level to talk toFREERtos will run then.

If that isn’t good enough, use taskDISABLE_INERUPTS. You don’t need vTaskSuspendAll because if no interups can occur, nothing can trigger the scheduler.

Thank you Richard and Hartmut :slight_smile: