I'm trying to get a keypad to work, writing my own library (just because I want to learn it, and later use the keypad).

For the columns I need pullup resistors, and I initially selected the internal pull-up of the GPIOs of the STM32F103C86.

After quite some time debugging I found out it worked much better with 1K resistors, instead of the 50K internal pull-up resistors.

So since it matters much what the pull-up value is (at least for the keypad), I was wondering, why MCUs are just having one resistor value for pull up (or pull down) ?

Is it because the keypad is an exception (i.e. for most components a 'generic single value' pull-up is enough?

I think a resistor is one of the most simple components to add in a complicated MCU, so why not have more of them?

Just wondering, what the generic reason is (this question is similar for Arduino's and probably more MCUs).

  • \$\begingroup\$ Ok clear, I was thinking a resistor would be 'easier' than a transistor (where millions can be put in a small space), but if the area of a resistor is bigger, than it indeed is a valid design decision not to add 'too many'. \$\endgroup\$ Feb 22, 2020 at 23:33
  • \$\begingroup\$ I think the weak pullups on typical micrcontrollers are actually implemented with a transistor. Some analog IC's have actual on-die resistors and they do take up a lot of room. \$\endgroup\$
    – user57037
    Feb 22, 2020 at 23:53

1 Answer 1


You not only need a resistor but also a device to enable/disable it, a register to hold its configuration as well as circuitry to write/read that register.

Also although resistors are simple they actually can take up a lot of die area and so usually a very small transistor is used instead - the actual value will vary greatly from device to device and over temperature (maybe +/-35% from nominal).

The pull-up/pull downs in a GPIO port are not normally used as part of an active circuit where the value is critical but as a way to set the default value when the pin is not driven. I would not recommend using them as I2C pull-ups for example.

Overall the additional functionality by adding a choice of pull-up resistor values is almost certainly not worth the die cost, especially compared to other I/O features such as a pull-down, or selectable drive strength.

  • \$\begingroup\$ Thanks, and clear. \$\endgroup\$ Feb 23, 2020 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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