Skip to main content
Senior
Nov 19, 2026 1:54 AM UTC
Question

STM32 GPIO Schmitt trigger & switch debouncing

Howdy do;

 

I am having a disagreement with Claude tool about something I want to believe is relatively straightforward: hardware debouncing a switch connected to an STM32 GPIO. 

 

Specifically, I have an STM32U595, the VDD of which is running at 1.8V. The datasheet for this device says:

  • V_IL = 0.3*VDD, (maximum)
  • V_IH = 0.7*VDD, (maximum)
  • V_hys = 250mv (typical) 

 

Claude’s interpretation of the above is:

  • Any voltage below V_IL (0.54 V) will definitely read as low.
  • Any voltage above V_IH (1.26 V) will definitely read as high.
  • The point(s) that the pin actually switches between high and low is somewhere between these points
  • Hysteresis is not given at a minimum, only a typical. It could be as low as 0mV, theoretically. 

 

The ramification of this is that a GPIO could flip from low to high at just above 0.54V, or from high to low at just below 1.26V.

 

My own assumption reading these numbers is that I should design with the idea that a GPIO’s switch from low to high happens at 1.26V, and from high to low happens at 0.54V. My calculations for debounce filtering is predicated on this assumption. 

 

Claude’s recommendation for this discrepancy is to furnish my own Schmitt trigger + known pullup value, which offers a firmer guarantee about these high/low transition points. Not doing this, it says, makes difficult/infeasible to design a RC debounce circuit that can adequately filter 10ms of anticipated switch chatter. 

 

Basically, I am wondering if Claude’s predilection to overcomplicating things (as has been my experience) holds water in this case, or if - practically - my own assumptions about the datasheet figures are typically how others think of them as well. I can’t tell if it’s being overly pedantic here.

 

Have you implemented some simple pushbutton hardware debounce filtering? If so, did you use the datasheet figures as target high/low voltages, or did you use an external Schmitt trigger in addition to the filter circuitry?

 

Thanks so much for any insights!

 

3 replies

Visitor II
Nov 19, 2026 2:23 AM UTC

On the first point, I’d take the guaranteed numbers in the datasheet as the design limits and treat the typical hysteresis as a bonus, not something to rely on. The V_IH max of 1.26V and V_IL min of 0.54V are the levels the chip is specified to, so if your RC filter is sized so the signal passes cleanly through those points, chatter around the middle won’t flip the input back and forth. I wouldn’t add an external Schmitt trigger just for a pushbutton, that feels like overkill for a 10ms bounce. An RC in front of the pin plus a short software debounce, re-reading the pin after 10 or 20ms, has worked fine for me on switch jobs.

sb_stAuthor
Senior
Nov 19, 2026 2:52 AM UTC

I guess I am wondering if I can avoid the software debounce entirely, and solve this exclusively with hardware. My (perhaps naive, oversimplified) read of V_IL and V_IH led me to an RC debounce filter that I thought was adequate, but Claude’s added nuance indicates it isn’t. Ideally I can avoid having to “double up” on hardware + firmware debounce...

TDK
Nov 19, 2026 5:12 AM UTC

My own assumption reading these numbers is that I should design with the idea that a GPIO’s switch from low to high happens at 1.26V, and from high to low happens at 0.54V. My calculations for debounce filtering is predicated on this assumption. 

That’s not a good assumption, as that would mean the hysteresis is 720 mV. It is certainly lower.

It is true that the “typical” value is not guaranteed, but it’s based on the internal hardware design and will be similar on all chips. A 0 mV hysteresis would not be a Schmitt trigger.

 

If all you’re looking to do is debounce a switch, add an RC filter with a reasonable time constant and call it a day. The chip already has a Schmitt trigger. There is no need to recreate one, especially for such a simple task.

"If you feel a post has answered your question, please click ""Accept as Solution""."