We have an external interrupt triggered by a mechanical relay which is exhibiting contact bounce. This would be OK provided the PXA270 detected every rising and falling edge, however we are occasionally getting two falling edge triggers without a rising edge in between. This is presumably because the rising edge occurs while the previous falling edge is still being processed. What is the best way to overcome this?
Dear @steve274
I see two possible options:
-
Implement a hardware debounce circuit
I assume you already designed your board, so this is not the way you want to go. -
Implement a software debounce algorith. For example simply use a global variable to store whether your previous interrupt was a falling or rising edge - this way you could easily ignore an interrupt, if the previous processed edge was the same as the current one.
Regards, Andy