Electrical – Microcontroller internal pull up


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

Best Answer

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.