This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Does I/O pin’s “pad logic” do debouncing?

Other Parts Discussed in Thread: MSP430F2274

Hi,

Between page 58 and 73 of MSP430F2274 datasheet SLAS504F, diagram for each pin module contains term “Pad logic” on the upper right, and it clearly refers to the part enclosed in the dashed lines.

Though not defined elsewhere, I think the meaning of “pad logic” is clear: direction control, interrupt detect, and so on. This is the same as GPIO pins on other devices does.

But I have one particular question on the Schmitt trigger. By definition Schmitt trigger has Hysteresis characteristics, but does it do any signal level debouncing? GPIO pins on other devices also have “Edge detection logic”, but on those devices no debouncing is done by the hardware and the interrupt is extremely sensitive to transient signal level changes, so that either software or external debouncing circuit is required to eliminate spurious short pulses and to preserve only true step signal (either rising or falling).

The “Pad logic” in the pin diagrams shows explicitly the Hysteresis (or Schmitt trigger) symbol which seems suggesting some type of delay feature. Does it mean the “Pad logic” actually does some debouncing so that external debouncing circuit is not needed?

The size of MSP430 chips as well as the final product are usually very small, and so is the total cost. I think it would be very advantageous if debouncing circuit can be omitted. Please confirm if MSP430’s “pad logic” actually does this or not.

And what frequency is “Pad logic”’s signal edge detection working at, or what is its clock source? If I use DCO to adjust MSP430F2274 MCLK to 1M, is edge detection clock proportional to this or not?

 

Matt

  • I think the term 'Pad Logic' is just a design element.
    The logic inside teh dashed lines is present on every other MSP too but not specifically grouped. There are no special elements inside this block that aren't on other MSPs.

    ABout debouncing, well, the schmitt triggers do some debouncing. However, this is limited to bounce frequencies above the specified input frequency. For interrupt timing, the minimum pulse width is 20nS, so my guess is that only frequencies above 25MHz are filtered (debounced).

    Anything below would limit the maximum input frequency - a debounce circuit doesn't know whether an incoming signal is a bounce or intended. Only your application code can know. There is no universal definition of what a bounce is, other than being an unwanted signal. What's wanted and what's unwanted depends on the application.
    Imagine the port logig would 'debounce' an incoming SPI datastream with 16MHz Baudrate. It would make the transfer impossible. But for a pushbutton, the bouncing is usually in the kHz range. So what to 'debounce' and what not? Only the code can know.

    However, the main purpose of a schmitt trigger is that it won't 'flutter' if the input signal is near the transition voltge and a bit noisy. It ensures that transisitons are clean unless the 'noise' during transition is larger than the hysteresis. E.g. when the input crosses the upper threshold of, say, 2V, the output goes high. But it won't go low when the input falls below 2V, it msu tfall below 1.5V to make the output fall back to low. So unless the signal is on 1.75V and you have more than +-0.25V noise, the output won't flutter. That's what Schmitt triggers are designed for.

    Matt Shira said:
    And what frequency is “Pad logic”’s signal edge detection working at, or what is its clock source

    Theport logic works independently of MCLK. It works as fast as it does. The interrupt timing lists a minimum 20ns pulse, so 25MHz seems to be the minimum frequency. (the datasheet note tells that it may even be faster). Well, on CMOS logic, it somewhat depends on voltages. So if the input voltage is just above the threshold, it will take a longer pulse to trigger an interurpt than when the voltage is on VCC (or maybe even higher). After all, it is about charging a FETs gate capacity.

  • Jens,

    Sorry for being late in reply.

    Thanks in particular for correcing my notion on hysteresis. This and filtering are indeed different things.

    We would try doing all the debouncing in software; actually our purpose is only for pushbuttons. BTW, are pushbutton on MSP430 boards typically debounced by software as you have described, or there is convenient and small-footrpint external circuit to do that?

  • As far as I know, debouncing is done in software. It is a task that doesn't need huge resources, nor need (relatively) fast response, so if you already have a microcontroller, I think the most sensible thing to do is to debounce in SW

  • Albert,

    Got it, thanks.

    Matt

  • Matt Shira said:
    are pushbutton on MSP430 boards typically debounced by software as you have described, or there is convenient and small-footrpint external circuit to do that

    Usually a software debounce is used, because it doesn't cost anything but (already paid for) flash space and some CPU cycles.
    However, a cheap external circuit is a 1k series resistor and a 100nF cap to GND. It works as a low-pass and filters all high-frequency bounces. The schmitt-trigger hysteresis does its part to suppress the remaining ripples on teh signal tha tarrives at the port pin. However, a low-pass also limits reaction time by the filter time constant, and therefore limits signal frequency.

    We used this compo for S0 pulses. an at least 20ms low pulse followed by at least 20ms of idle time before the next pusle. We had a lot relay contact bouncing on these lines and 1k/100nF suppressed them all.
    However, on later devices we too switched to software debounce (actually scanning the input pins every ms and counting the high and low times to detect valid pulses)

    If you already have a tiemr ISR that continuously counts ms or does other things, you may jus tcheck the port state in it and reset a counter if the pin is high or increment the counter (until your threshold limit) if it is low. This waay, when the shreshold is met, the button was pushed wihtout any bouncing for the appropriate time and you can trigger an action. No issues with port interrupts, debouncing timer etc. However, if you don't have a continuous tiemr ISR and want to sleep as much as possible in LPM, then this method is less effective.

  • Jens,

    Jens-Michael Gross said:

    If you already have a tiemr ISR that continuously counts ms or does other things, you may jus tcheck the port state in it and reset a counter if the pin is high or increment the counter (until your threshold limit) if it is low. This waay, when the shreshold is met, the button was pushed wihtout any bouncing for the appropriate time and you can trigger an action.

    I think this would work for us since the button just need to be pushed, not being striked repeated. It should be better than the first filtering method since it saves both cost and space.

    Thanks for the idea.

    Matt

**Attention** This is a public forum