-2

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

Bharav
  • 722
  • 2
  • 7
  • 21
  • 1
    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](http://electronics.stackexchange.com/questions/128875/using-internal-pull-ups-for-i2c-on-pic18f). That thread starts with a question about PICs, but it applies to microcontrollers in general.) – Nick Alexeev May 27 '16 at 15:53

3 Answers3

3

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.

Spehro Pefhany
  • 376,485
  • 21
  • 320
  • 842
1

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.

0

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.