Hi
I do some CPU execution time measurements of my motor control application. I do have 2 interrupts, the ADC EOC and the RTI0 1ms timer interrupt. For time measurement I do use the PMU.
The ADC EOC is fired periodically in sync with my PWM (say 30kHz) and does interrupt the 1ms interrupt.
Caching is enabled. MPU settings taken from default LC4357 (with FreeRTOS) HALCoGen 4.01.
What I do observe:
The first ISR calculation in my ADCEOC lasts longer than the following ones. The second ISR execution time is a bit faster, the third and 4th even more fast. Then it reaches a minimum. Lets say the longest was 26us and the minimum is 21us (for the same calculations).
Then after 1ms my timer interrupt occurs. After this 1ms execution the ADCEOC calculations do last longer again. So the pattern described above restarts after every 1ms. If I change the 1ms to 2ms I see the pattern repeating with 2ms. So it has something to do with this other task.
The very first calculations (say about 4 ISR calls on PWM enbale) do even last longer (start at 31us not 26us).
All code is executed from RAM.
For my app I have to calculate with the worst case (longest duration). So the very first calc will define my max PWM frequency.
Compared on other targets:
- 28335: This code executes absolutely deterministic (every ISR needs same amount of time)
- LS1227: The code execution time is a bit more la la
- LC4357: The code execution time varies extremely.
Questions:
What can cause this effect? A wrong configuration or a is this the normal effect because of the cache?
How can I get rid of this?
What is the best configuration for best CPU performance?
Thank you for clarification!
Roger