This question already has an answer here:

I was reading microntroller datasheet, they mention any I/O pins can be configrued as Open drain , or as Special pheripheral ( like SPI , I2C etc..) or push pull.

Q) Can we enabled microcontroller internal pull up when pin is configured as output only.

Q) when open drain selection need to choose wheather pin is input or output.

Q) Can we use both internal and external pull on some IO line , then it can be nay problem


marked as duplicate by PeterJ, Bence Kaulics, tcrosley, Daniel Grillo, Chris Stratton May 27 '16 at 21:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    \$\begingroup\$ Don't rely on internal pull-ups for I2C (and for communication buses in general). The internal pull-ups are too weak, and the resistance varies in too broad of a range. (I wrote about that in this earlier thread. That thread starts with a question about PICs, but it applies to microcontrollers in general.) \$\endgroup\$ – Nick Alexeev May 27 '16 at 15:53

The first two questions can be answered by the datasheet. In some cases you can enable pull-up with the pin an output. If push-pull that does nothing but waste power when the output is low, but if it's open-drain it can be useful.

When the pin is open drain it is acting as an output, so that's what you want to enable. In processors without open-drain option it is sometimes simulated by switching between input (output high) and output (output low) with the port latch bit always low.

If you use an external pull-up you generally want to disable the internal pull-up since the tolerance is usually pretty poor on the internal pull-up, also it sets a upper limit for the total parallel resistance. In special situations, like where there are connectors that could remove the external pull-up you can enable the internal one if you like, there is no problem.


1)When the IO is configured as push pull.If you add pull-up doesn't make any changes.

2) First see the registers there you know the configuration details.An open drain is the output configuration you can read the state of the Open drain IO pin.

3) No problem but pull up resistor you using external Should be selected as per the IO sink up current.And consider the IO voltage tolerance also.


you can't use all the I/O's as special peripherals. There will be specific I/O's which is defined in datasheet. Refer datasheet.


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