9 years, 11 months ago.

Using I2C open drain pins as DigitalOutputs

Hi, Couple days before I started playing with mbed LPC1114FN28 and found one issue. I'm not able to use dp5 and dp27 (I2C open drain pins) as DigitalOutputs. Code is compiling, but direct measure of voltage gives always GND voltage there. Any reason for that?

Thanks in advance, Fosfor

Question relating to:

The LPC1114FN28 is an ARM Cortex-M0 based, low-cost 32-bit MCU, designed for 8/16-bit microcontroller applications, offering performance, low power, simple instruction set and memory addressing together with reduced code size …

1 Answer

9 years, 11 months ago.

Did you add external pullups?

By definition an open drain output can only drive to GND, it can never drive the line high. If you want an open drain output to go high you need to add an external pullup.

Accepted Answer

Thanks for quick reply, what should be value of such pullup resistor?

Regards, TH

posted by Tomasz Hołodniak 15 Dec 2014

Depends on the speed of the signals involved and what's connected.

A low value will give sharper rising edges but will use more power and raise the low level slightly above 0V. A high value will result in rounded rising edges and depending on the signal loading lower high voltages.

As a general rule, a couple of kOhms for a high speed signal, 10-47k for a low speed or effectively DC signal.

posted by Andy A 15 Dec 2014