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!
