Jitter in ISR execution with TMS570LC4357

Hi, We are facing issue with the execution of PWM ISR timing. The PWM timing on HW pin is fine. Isuue observed the entry time of ISR have a timing distrubance periodic. The project is built with freeRTOS. without RTOS there is no jitter.

To reduce the complexity, created a simple freeRTOS project with etPWM1 configured with center aligned up-down counter of 40 uSec period. RTOS configured with ony one task, which will update 50% dutycycle of PWM. The PWM ISR is configured with ZERO count event. Measurement of ISR period is done with 1. toggle gio and use the oscilloscope 2. Use RTI 1 counter to capture the period.

Attahed the scope result and analysis of memory capture of the RTI counter.

We have tried to modify the interrupt priorities of RTI 0 and etPWM 1, still have the jitter. We have observed the jitter is periodic with 60 mSec.

Tried by removing the etPWM1 and use only RTI 1 interrupt and measure the RTI 1 ISR period. This measurement also show the jitter with 60mSec period.

I have attached captures of the scope and spreadsheet capture.
I am unable to upload my project as a new user prompt.

Please help me what could be the issue here.

Additianl info… scope capture.

Hi @sekhar.india,

Is it possible for you to share additional implementation details like, FreeRTOSConfig.h, how PWM ISR is handled, are there any FreeRTOS APIs being called in the ISR and priority of the other tasks running?

Hi Tony,
The post not allowing me to share the project files or the share link, and it says resticted for new users. Any other way to share my project with you.

@sekhar.india The FreeRTOS kernel does mask interrupts sometimes, by necessity, for critical sections. It seems that you are periodically seeing ISRs delayed by ~12 microseconds when using FreeRTOS. That could be a fairly typical delay for periodic FreeRTOS operations in a critical section. Is the delay a problem for you? Or are you just looking for an explanation?

If it’s a problem, you can likely reduce the delay by increasing the CPU clock rate.

Also note that the Cortex R5 port allows you to configure FreeRTOS’s interrupt masking to leave the highest interrupt priorities unmasked, even in critical sections. Those ISRs will not be delayed by the kernel’s occasional interrupt masking. (Not noticeably delayed anyway.) However, those ISR’s are not allowed to make calls to the FreeRTOS API functions. See configMAX_API_CALL_INTERRUPT_PRIORITY.

Hi Jeff,
Thanks. That means, this is a known periodic delay in the RTOS execution.
I am executing time critical function in the ISR. I do not expect any delay during entry of the ISR.
I have tried to search the configuration in the project to see for configMAX_API_CALL_INTERRUPT_PRIORITY. Did not found any instance. Can you please provide more insight how this can be configured to unmask RTOS interrupts? I am not using any RTOS APIs in my ISR.

Which port are you using? For example, portable/GCC/ARM_CR5/.

In that port you should get a build error if configMAX_API_CALL_INTERRUPT_PRIORITY is not defined. See this line. It would typically be defined in FreeRTOSConfig.h.

See here for more information about interrupt config. The page says Cortex A but it applies to Cortex R5 too. RTOS for ARM Cortex-A

I am using portable/GCC/ARM_Cortex-R4, as I am using TI controller and CCS development.
Looks like in the port, it is not implemented. I have searched both kernel include and source folders.
Do u see any other options?

Assuming you meant portable/CCS/ARM_Cortex-R4.

Your options depend on the interrupt controller TI provided in your device. Unfortunately I’m not familiar with your device. If it has the GIC then the R5 port code would work directly. If it’s a different interrupt controller, then you could potentially modify the port to mask interrupts only up to a certain level.

Looking at the code - the CCS port for TMS570/RM48 parts does globally disable interrupts. Do these parts have a proprietary interrupt controller?

Yes it appears so. I looked at the Reference Manual, and the interrupt controller seems to be proprietary. It doesn’t provide any way for the port to mask interrupts up to a certain level, which explains why the port is written as it is.