Hello,
when I call Delay_mS() function in main(), its going fine:
void maind(){
Delay_mS(100);
i++
}
But when I doing this same in interupt, the Delay_mS() function doesnt comes back it takes infinity time
void maind(){
enable_irq(INT_TPM0 - 16);
while(1) {}
}
void handle_interrupt(){
Delay_mS(100); //This function takes infinity time
i++
}
Can anybody help me?
This is on FRDM-KL25Z board.
No way to give a good answer without know how delay is written. If it is using an interrupt itself the result you see makes sense. Doing delays in interrupts is never a good idea and should be avoided at all costs.
Thank you for the answer. Yes the delay is using interrupts, the function is definied in ARM_SysTick.c (attached file).
1.Previously I used FRDM - K20, on this processor I run this same code, and there is running fine. Is it a difference with interrupt handling on these two processors KL25Z (M0+) and K20 (M4)?
2. I developing quadcopter control software, I have two interrupts:
The first is for PID control, motor power controlling, etc... this is should go on 400 Hz. - pid_interrupt()
The second is going in lower speed 50 Hz, its for logging data (speed, altitude, motor powers, etc) to SDcard. - log_interrupt()
On K20 when log_interrupt is executed and and there is interrupt request for pid_interrupt(), the program from the log_interrupt() immediately jumps to the pid_interrupt() function.
But on KL25Z first all lines in log_interrupt() is handled and only after this the program jumps to the pid_interrupt. Why? Is it any way to solve this?
The pid_interrupt() has higher priority than log_interrupt().
Thank you!
Norbert
The interrupt controller in the K20 has 16 levels of interrupt priority (0..15). The one in the KL25 has 4 levels of priority (0..3)
Therefore if you were using, for example, levels 6 and 7 to allow the interrupt with level 6 priority to interrupt the level 7 priority one before and keep these values they are now equal (both equate to level 1 on the KL25) and so the pre-emption will no longer take place.
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
KL25: http://www.utasker.com/kinetis/FRDM-KL25Z.html / http://www.utasker.com/kinetis/TWR-KL25Z48M.html
K20: http://www.utasker.com/kinetis/TWR-K20D72M.html / http://www.utasker.com/kinetis/FRDM-K20D50M.html / http://www.utasker.com/kinetis/TWR-K20D50M.html / http://www.utasker.com/kinetis/TEENSY_3.1.html / http://www.utasker.com/kinetis/tinyK20.html
For the complete "out-of-the-box" Kinetis experience and faster time to market