0
\$\begingroup\$

I am still new to the stm32f4 discovery board. I was looking at the board's schematic to see how the user button is implemented on the board:

User button

Since C38 is not fitted, does that mean I have to resort to software methods for deboucing? Just curious, if the answer is yes, what would I have to do to perform hardware debouncing?

\$\endgroup\$
  • \$\begingroup\$ I'd pop a 100nF in and see what effect it has. It is an eval board, so they may of left it off so PA0 could be used as an output. \$\endgroup\$ – StainlessSteelRat Oct 16 '17 at 18:53
2
\$\begingroup\$

I believe C38 is not fitted because this circuit does not debounce the way that ST intended, I did some spice simulations just to check (I would suggest that you could also do this for the exercise). I would move C38 in parallel with R39. Then tweak the values of R38 and R39 (I'm assuming you're familiar with time constants of RC circuits) to get the desired debounce.

\$\endgroup\$
  • \$\begingroup\$ IMO pointless as debouncing and button reading should be done in the timer interrupt. Easy and efficient. Some buttons and switches generate so long strong impulses that the RC debouncing does not work. \$\endgroup\$ – P__J__ Oct 16 '17 at 14:27
1
\$\begingroup\$

Actually IMO hardware denouncing in generally is not the very good choice. It should be done in the regularly called processes like timer interrupts.

How to do it here you have the example code: https://www.diymat.co.uk/arm-three-function-click-double-and-long-click-button-library-timer-interrupt-driven/

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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