Reputation: 1
so i'm using an STM32F4 based bare bone board (Black Pill) to run a program for my project i m using the STM32CubeIDE for code generating
Current Overtime cases explanatory
the figure you just saw, is a graph i made simply on paint to explain the post my project revolve around inductance load protection against short circuits, (doesn't matter but just clarification) i m using interrupts, where the first interrupt triggers once the current reaches a reference 1 value second interrupt triggers once the if reaches Value Reference 1 since current noises can't be filtered in my case, I have to avoid the triggering of instruction of int 2 there for I put a delay that is a bit bigger then the noise period (about 100ns) if delay ended and int trigger is still on (high) , shut down the system (change the output) if delay ended and int trigger is off (low), keep the system running (keep initial output)
this is the code i came up with so far
enter code here
Upvotes: 0
Views: 805
Reputation: 1525
I believe what you're looking for is a "Timer" and some interrupt handling magic. I will expand a little.
If your interrupt is OFF (in NVIC only, the rest is configured), but an interrupt triggering event occurred, the interrupt will NOT fire (obviously). But if you enable the interrupt in NVIC after that, it will fire immediately.
Example:
My idea is the following.
In the interrupt 1 handler, you do 2 things.
When interrupt 1 fires, it immediately disables interrupt 2 and enables timer. The timer eventually fires its own interrupt, where it enables interrupt 2 in NVIC. If interrupt 2 event happened, the interrupt 2 handler will be called immediately. If not, interrupt 2 will not fire.
During all this waiting your MCU is free to do whatever it wants, full interrupt implementation.
Upvotes: 1