cancel
Showing results for 
Search instead for 
Did you mean: 

Ecternal interupt occurs 2 times?

Arman Ilmak
Senior
Posted on February 19, 2018 at 22:58

Hello guys.

I've started working with stm32f217zg series and i have a problem with external interupt.

I have programmed the mcu and after i push the button the interupt occurs two times instead of one.

I use cube mx to generate the code.

I attached the code so you can see it.

12 REPLIES 12
Posted on February 21, 2018 at 12:45

There are much better ways to debouncing than to put a big fat delay routine in the isr, of all places.

Posted on February 21, 2018 at 13:36

Agree, delays inside of interrupt handlers, especially of this magnitude, tend to be deadly for serious applications.

There are other, better ways to prevent EXTI from generating switch transition events.

Posted on February 21, 2018 at 13:55

I wouldn't be too quick to declare a success. Your earlier posts suggested that the readings are always two times of what it should be . Switch bounces are fairly random and it is hard to imagine them being so consistent.

As to debouncing strategies, the best way to debounce is not having to debounce. I have done my fair share of software debounces and I can tell you from experience that no software debounces beats out a small capacitor for simplicity and effectiveness and robustness.