I am using S32K312 + Microsar OS.
#define ResumeAllInterrupts() ASM_KEYWORD(" cpsie i")
#define SuspendAllInterrupts() ASM_KEYWORD(" cpsid i")
I think the execution time of ResumeAllInterrupts or SuspendAllInterrupts is too long.
The above function exists inside the RTD function.
ResumeAllInterrupts takes about 6us. (SuspendAllInterrupts is same)
(The time was measured using the GPIO toggle.)
I think it takes too long to simply do ASM_KEYWORD(" cpsie i").
Is there any way to shorten execution time?
Hi @kjy106906,
On CM4, the instruction should take 1 or 2 cycles.
It is not specified for CM7.
https://developer.arm.com/documentation/ddi0439/b/CHDDIGAC
Where to find the execution cycles of Cortex m7 instruction
What is your system clock configuration?
Do you use RTD to toggle the GPIO?
In general, the drivers cause a significant CPU overhead.
Regards,
Daniel
What is your system clock configuration?
-> Core clock 120Mhz
Do you use RTD to toggle the GPIO?
-> Yes I use RTD
But When I only toggled the GPIO it took about 1us
When ResumeAllInterrupts or SuspendAllInterrupts and GPIO toggle were used together, it took about 7us in total.
So I think the time taken of ResumeAllInterrupts or SuspendAllInterrupts is too long.
Hi @kjy106906,
As I said, the core should do it in 1-2 cycles.
But it depends on other factors, like the location of the code, whether the core reads it directly from the Flash or it is a Cache hit. There can be wait states on the crossbar switch. It can be delayed becasue of pending interrupts.
Regards,
Daniel