1

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?

MrBit
  • 1,973
  • 4
  • 27
  • 54
  • 1
    You have not told us what your are doing thus I don't know if you are doing anything wrong. – Oldfart Jan 04 '18 at 17:56
  • 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. –  Jan 08 '18 at 04:40

1 Answers1

4

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.

sh1
  • 316
  • 1
  • 7
  • 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. – MrBit Jan 07 '18 at 12:10