Hardware timer interrupt priority - how to change

How to change interrupt priority for hardware timer interrupt?
I started timer0 from group0 with alarm interrupt enabled and placed port toggle routine inside ISR, that can see it on oscilloscope. I see now that interrupt comes with 20us period that i want, but sometimes there are lags (longer periods). I think that some other interrupt have the same or higher priority but i can’t find where is that parameter to configure. I see c.a 200us lags for each 45ms. I don’t know what it is as i don’t use any other interrupts :confused:
I observe also some small lags (a few us) but it doesn’t matter.

FreeRTOS doesn’t have a function to set the interrupt priority, so it is not clear if this is a FreeRTOS question or a question about the Espressif drivers.

Also there are some critical sections in FreeRTOS code where interrupts are and have to be disabled. Although these sections are kept as short as possible they can cause a small jitter of interrupt response time.
Note that depending on the MCU port used only the interrupts covered by FreeRTOS (see configMAX_SYSCALL_INTERRUPT_PRIORITY) are disabled. This applies e.g. for Cortex-M MCUs.

It’s about Espressif driver. It’s not software timer but TIMER_0 from group0.

I see some jitter but it is not problem. The problem is 200us lags.

If that port implements the configMAX_SYSCALL_INTERRUPT_PRIORITY constant then you can set the priority of the interrupt above that value - then critical sections on the kernel will have no impact on the lags.

I didn’t find configMAX_SYSCALL_INTERRUPT_PRIORITY implementation in documments.
But I suppose that You think about this small lags (just some us) that are not a problem for me.

configMAX_SYSCALL_INTERRUPT_PRIORITY is contained in FreeRTOSConfig.h if your MCU port supports it. If it’s defined it has to be taken into account when setting up interrupt priorities.
But considering your other post I think the unexpected long lags are or were not caused by FreeRTOS critical sections. They might be caused by other problems like (internal) log output in the ISR.

You right, it is defined there.
/* The maximum interrupt priority from which FreeRTOS.org API functions can
be called. Only API functions that end in …FromISR() can be used within
interrupts. */

But i can’t find “XCHAL_EXCM_LEVEL”

Maybe it’s all done appropriately by your Espressif SDK/IDE. XCHAL_EXCM_LEVEL is not part of FreeRTOS and is probably specific to Espressif.