EXTI interruption flags
Hi.
I am having some issues trying to use the EXTI module, to implement interruption routines associated to ports.
The problem is related to the behavior of STM32 microcontrollers with ports interruptions. In most microcontrollers (i.e. Texas Instruments MSP430), when it comes to port interruption handling, we have interruption flags (IFG) and interruption enables (IE) for each port. Then, when an event occurs on a port, for example, a pulse transition from low to high, the IFG goes to high even if the interrupt is disabled. In case the interrupt is enabled, the IFG goes to high too and the interruption service routine (ISR) is executed. In that way, when you have an interruption disabled (IE = 0) and an event happens on the port, the IFG is set to high. If in any part of your code you enable the interruption (IE = 1), the ISR is immediately called because the IFG = 1. This is a good way to store the occurrence of an event, even in the case the interrupt is disabled in the moment when the event occurs.
But STM32 looks to work in a different way. For example, when you have a port interruption disabled (EXTI IMRx disabled) if the event occurs in any moment, the corresponding flag (EXTI PRx) is not set because the IMRx was disabled. Then, the occurrence of the event is not stored if occurred when the interruption was disabled, as you can do with other microcontrollers, as in the exampled I wrote above.
Maybe, someone could say "Why don't you enable the interrupt if you don't want to lose the event?". There could be different reasons why, one of them is the following: Let's suppose that I have two different port interruptions, one for an external signal in port A1, and other coming from a button in port A2. Let's suppose that in some portions of my code, I need to wait only for the signal in port A1 and respond as soon as possible for a timing constraint that I have in my project. Let's suppose I cannot have any other interruption enabled (neither timers nor my button in port A2) in order to respond as quick as possible when the event related to the signal in port A1 occurs. But, when I go out from that portion of the code, I will go to a main loop, in where I will enable and attend the other interruptions (timers, the button in port A2, etc.). What would happen if any of those events arrived when I was in the signal wait routine described above? With timers I won't have problems because timers rise the flag event even if the interruption were disabled. But with EXTI port interruptions I will lose the event because there is not flag which "store" the occurrence of the event when the interruption was disabled.
Then, if someone have some idea about how to solve this problem, please, give me some suggestions. Maybe there are another flag or something that I am not aware of.
Thank you in advance for your help.
