Hi to all, I have a question: I'm using a LPIT for a timer and I used the SDK routine(S32 Design Studio for ARM Version 2.2. with micro S32K142)
When I clear the interrupt flag, the timer to do this instruction is very high (30us); I verify this duration using an output pin (See code below) so if I used a 100us timer, the microcontroller works 30% of the time to clear the interrupt flag.
static inline void LPIT_ClearInterruptFlagTimerChannels(LPIT_Type * const base,
uint32_t mask)
{
/* Write 1 to clear the interrupt flag. */
PINS_DRV_WritePin(PTC,9,1); // wood
base->MSR = mask;
PINS_DRV_WritePin(PTC,9,0); // wood
the instruction base->MSR = mask is convert in assembler code as:
284 base->MSR = mask;
00004464: ldr r4, [pc, #20] ; (0x447c <LPIT_DRV_ClearInterruptFlagTimerChannels+40>)
00004466: str r6, [r4, #12]
could you help me?
thanks
Hi Juve75,
The method of flipping IO to measure code execution time is inaccurate.
Please refer: Measure the running time of one function on S32K
These two assembly codes will not take such a long time.
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Been looking for this: Measure the running time of one function on S32K.
Thanks for sharing. Is there a more detailed article on this topic available here?
Regards
I know that this kind of IO test is not accurate, but if I simply raise up and down the port, the duration time is 0,5us, not 30us. I also use this test to estimate the duration of other code but without this delay time.
Anyhow I have a look to Measure the running time of one function on S32K that you suggest.