1
\$\begingroup\$

What is the difference between debounce filter and glitch filter on a mcu?

I'm trying to implement a hardware debounce filtering on a ATSAM4S4C

(ATMEL SAM CORTEX-M4 - PAGE 575. http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-11100-32-bit%20Cortex-M4-Microcontroller-SAM4S_Datasheet.pdf).

But even though I selected slow clock and a cut-off frequency at 10 Hz I see false interrupts to be triggered at frequency higher than 10 Hz.

Also I notice that glitch filtering does not help me at all because it is clocked with the peripheral clock which is higher than slow clock.

Am I doing something wrong?

\$\endgroup\$

closed as unclear what you're asking by Scott Seidman, Sparky256, laptop2d, Andy aka, Dave Tweed Jan 16 '18 at 5:53

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ You have not told us what your are doing thus I don't know if you are doing anything wrong. \$\endgroup\$ – Oldfart Jan 4 '18 at 17:56
  • \$\begingroup\$ You need 3 registers to implement a digital filter. One count up if input is High and clears the other counter. One counts up if input is low and clears the other counter. At a specified count a bit is set or cleared in the third register. These can be byte sized registers. Shift registers will work as well. \$\endgroup\$ – Sparky256 Jan 8 '18 at 4:40
3
\$\begingroup\$

A bounce is a reversal of state that occurs immediately after a deliberate transition. A glitch is a spurious change not associated with a deliberate transition. Both are temporary and brief, but when filtering bounces you want to acknowledge the very first transition as early as possible and ignore subsequent changes until the end of a hold off period, and when filtering glitches you want to ignore the very first transition until the end of a timeout when you can be confident that it's deliberate.

Sadly far too many debouncers are implemented as glitch filters, resulting in buttons that are unnecessarily slow to respond.

That's what the difference is, but I doubt that that helps you with your problem.

\$\endgroup\$
  • \$\begingroup\$ Thanks a lot for your help! I have studied the registers in datasheet very carefully and I have checked their status in my code through serial port debugging and didn't find anything wrong. I did a test with a function generator (square pulses 3V 50% duty cycle), and I was seeing false triggers at frequencies higher than my selected frequency filter. Software debounce worked as expected though. \$\endgroup\$ – MrBit Jan 7 '18 at 12:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.