Hi,
for a forum question: Please tell us what IDE, what language, what compiler you use.
Interrupts:
Generally the ISRs should be fast (in execution time).You need to avoid busy waits like your "for loop".
ISRs are meant to save processing power, but your ISR wastes processing. power. No other job can be done. Bot interrupts have identical priority (not wrong), thus the one interrupt will not interrupt the other ISR.
I did not go deep into your code. Just my recommendation:
Debugging:
It´s rather easy to detect whether the ISRs are executed:
Set two GPIOs when entering the ISR, clear one of them when leaving the ISR.
Check the one GPIO and you will see if the ISR is being called at all.
The other GPIO tells you how often it is called and how long it takes to process.
Do you have a scope to check the GPIOs?
***
Code recommendations:
* Use "defines" so your code becomes more readable. (1 << 10) has no meaning for us. (1 << GPIOB3) tells much more.
* use meaningful text indents. If you do the opening bracket in the same column as the closing bracket you get a clear view of which lines belog together and you don´t miss a closing bracket.
example:
C:
void EXTI3_IRQHandler(void)
{
if (EXTI->PR & EXTI_PR_PR3)
{
GPIOB->ODR |= 1<<2;
for(volatile int i=0; i<20000000; ++i)
{
__asm("nop");
}
EXTI->PR |= EXTI_PR_PR3;
}
}
void EXTI4_IRQHandler(void)
{
if (EXTI->PR & EXTI_PR_PR4)
{
GPIOB->ODR &= ~(1<<2);
for(volatile int i=0; i<20000000; ++i)
{
__asm("nop");
}
EXTI->PR |= EXTI_PR_PR4;
}
}
Klaus