i2c pull-ups current - Page 1
Forum section: electronics / beginners

author: rookie
author_rank: Contributor
timestamp: May 28, 2019, 05:37:52 pm
content: I am working on a low power circuit that has two i2c devices on the bus.I was using the internal pull-ups on the mcu to communicate and that seems to be working alright.However on adding external pull-ups to my i2c bus, I observe a constant current drain.The lines are always held high, even when the device sleeps which I think might be causing this current drain.When I remove these pull-ups, the lines are disabled and only used when required, i.e. correctly.I'm puzzled because if this was a pin configuration problem, I should have seen it even when the pull-ups were absent?Why did addition of the pull-ups make such a big difference? Is this a hardware problem or can be dealt with in software(I think this should be possible).Does the slave device have any role to play here?

author: wraper
author_rank: Unknown
timestamp: May 28, 2019, 05:47:13 pm
content: What voltage, what pull-up resistance, what current drain? Are you sure that you are not pulling up to voltage above of MCU or any other device connected to the bus?QuoteThey are not "held" high, they are just not held low. In which case current should not flow.

author: Nerull
author_rank: Frequent Contributor
timestamp: May 28, 2019, 05:50:37 pm
content: I2C is idle high. The entire purpose of the pullups is to keep the line high - I2C I/O is open drain and the devices are incapable of driving the line high, only pulling it low.If current is being drawn this would indicate that the line is being driven low by a device on the line.

author: 0xdeadbeef
author_rank: Super Contributor
timestamp: May 28, 2019, 05:59:08 pm
content: I2C uses open drain outputs, i.e. there is nothing that can drive the line high other than the pullup resistors. Hence using very high ohmic resistors makes the rising edge too slow for fast clocks.E.g.TI SLVA689 I2C Bus Pullup Resistor Calculation

author: mikerj
author_rank: Super Contributor
timestamp: May 28, 2019, 06:21:19 pm
content: Quote from: rookie on May 28, 2019, 05:37:52 pmAre you trying to power down the I2C slave device? If so you will have to remove power from the pull-up resistors as well since they will cause the ESD diodes on the slave pins to conduct and will draw current.

author: rookie
author_rank: Contributor
timestamp: May 28, 2019, 06:37:56 pm
content: The pullups are connected to vcc 3v with 4.7k resistors, about 500uA extra current is lost after this addition. After an i2c transaction, the i2c block is disabled, and device sleeps to save power. The behavior is normal by standards of i2c since the pull-ups job is to hold the line high, but because it is in low power mode, the block gets disabled and I assume the lines will need to be configured in a way that they don't draw current when idle?

author: bson
author_rank: Unknown
timestamp: May 29, 2019, 02:22:34 am
content: If there is a quiescent current on the I2C pins while the I2C block is disabled and the controller sleeping, then you might need to configure the pins as GPIO inputs while idle. Then reassign them to I2C before enabling the I2C block.

author: rookie
author_rank: Contributor
timestamp: May 29, 2019, 06:57:28 pm
content: I re-configure the pins back to input and then disable the i2c block. But the lines remain pulled high, which may be causing the excess current in idle mode. Is this expected behavior because of the pull ups(even when mcu disables i2c on those lines)? Without the pull-ups the line goes low when the i2c block is disabled, which means the internal pull ups are being disabled. How can I produce the same effect when the external pull-ups are in place. I tried putting the pins back in input mode but that didn't help. Only thing that helped so far is actually popping the external pull-ups.

author: ejeffrey
author_rank: Super Contributor
timestamp: May 29, 2019, 07:16:25 pm
content: The "high" state of the I2C lines should not cause appreciable current when idle. Current needs a circuit to flow, and without a connection to ground, no current should flow. There will be some leakage, but it should be very small -- usually nanoamps, maybe up to a few microamps in some cases especially at high temperature.So something is providing a path to ground. Its hard to help more without knowing exactly what your circuit looks like and what it is doing.

author: garethw
author_rank: Regular Contributor
timestamp: May 29, 2019, 07:57:18 pm
content: Quote from: rookie on May 29, 2019, 06:57:28 pmIf the lines are pulled high, to the same as VCC, there is no current flow.Check the voltage across the resistors, directly across them with the probes. There should be 0V. Any voltage reading can be divided by the resistance value to give you the current through that resistor. Ohms Law.

author: rstofer
author_rank: Super Contributor
timestamp: May 29, 2019, 08:31:35 pm
content: And we still don't know which MCU and which device... Datasheet links are helpful.In a perfect world, the I2C peripheral in the MCU will idle both lines high and, absent any load on the device, the external resistors will see no voltage drop and conduct no current. If you disable the I2C gadget in the uC, I would expect that you would need to define the pins as input with or without internal pull-up. You can get the anticipated pin currents from the datasheet. IIH(input current pin high) is important. There should be a similar spec for the pins when configured for I2C.As to the device? Who knows? I would expect it to have nearly zero input current when powered (I am expecting a CMOS device and they have essentially 0 input current) and I have no idea how much current it draws in sleep mode. But the idea is to keep the chip powered but in sleep mode so that the clk and data don't try to feed power to the device through the pull-up resistors to the ESD diodes. Again, the input current specs should be given in the datasheet for both operating and sleep mode.Without links to datasheets, everything is a guess!

author: 0xdeadbeef
author_rank: Super Contributor
timestamp: May 31, 2019, 10:10:27 am
content: Quote from: rookie on May 28, 2019, 06:37:56 pmA real I2C block won't have (fixed) internal pullups as this would contradict the idea of I2C (external pullup, open drain outputs -> 3.3V/5V tolerant). Actually true I2C peripherals don't have a push/pull stage configured to use only the lowside, but a true open drain output. So e.g. they can tolerate 5V on a 3.3V device even if no voltage is supplied. Indeed, for the same reason, true I2C pins typically also don't have configurable pull devices.Besides, pullup/down configuration is typically a port/pad/pin feature, not one of the peripheral block. Anyway, the behavior of pull devices during powerdown depends on the device and the powerdown mode. Typically, pull devices are deactivated (only) in deep powerdown but still active in sleep mode. Again, that depends on the actual device and its powerdown/sleep modes.In any case: if you're using normal port pins as I2C pins, make sure to configure them as open drain and to disable any internal pull device. Also check how the powerdown behavior is defined exactly and if you could also use dedicated I2C pins.

author: wraper
author_rank: Unknown
timestamp: May 31, 2019, 03:37:47 pm
content: Quote from: 0xdeadbeef on May 31, 2019, 10:10:27 amI2C has nothing to do with interfacing devices powered from different voltage and generally you cannot do so without taking special measures. Pull-ups and open drain outputs are for attaching multiple devices on a single bus, nothing to do with 3.3V/5V tolerance. So internal pull-ups don't contradict with any ideas of I2C.QuoteHigh side mosfet present on the multipurpose pin does not do any harm. Effectively it is non existent there when interface is configured as I2C. Does not make it any less "true" I2C interface. Not to say normally ICs have protection diodes connected from the pins to GND and Vdd anyway, so here goes your "tolerance". Only some chips specially built to be tolerant to higher voltage can accept higher voltage than Vdd.

author: wraper
author_rank: Unknown
timestamp: May 31, 2019, 04:21:46 pm
content: Quote from: rookie on May 28, 2019, 06:37:56 pmThe question is what voltage is used to power all ICs connected to this bus? Is power removed from any IC when the thing goes into sleep mode? BTW disabling pull-ups at sleep and leaving I2C bus without any pull-ups at all is not a good idea. I2C lines will become free floating and may cause ICs connected to the bus consume increased current (you should never leave CMOS inputs floating) and also can cause those ICs doing unknown operations caused by interference picked up by I2C lines.

author: 0xdeadbeef
author_rank: Super Contributor
timestamp: May 31, 2019, 04:51:18 pm
content: Quote from: wraper on May 31, 2019, 03:37:47 pmI2C is designed to be pulled up externally which allows using 3.3V and 5V devices on a common bus. Of course this only works if 3.3V devices use 5V tolerant pins. Using internal pullups contradicts this idea as different pullup voltages working against each other would obviously create issues.Quote from: wraper on May 31, 2019, 03:37:47 pmWell, of course the FET and the clamping diode are still there. There might be 3.3V push/pull outputs which are fully 5V tolerant (even if the device isn't supplied anymore), but at least there are quite a few devices where only the dedicated open drain pins are fully 5V tolerant.Quote from: wraper on May 31, 2019, 03:37:47 pmStill, dedicated I2C pins don't need either a highside transistor or a pull device. So on quite a lot of microcontrollers, the dedicated I2C pins have neither. And usually only these pins are fully 5V tolerant for 3.3V microcontrollers.

author: wraper
author_rank: Unknown
timestamp: May 31, 2019, 05:22:26 pm
content: Quote from: 0xdeadbeef on May 31, 2019, 04:51:18 pmI2C is not intrinsically designed for it and if it works, it's only a feature of particular IC and has nothing to do with I2C standard.QuoteI wonder how your idea suddenly became a part of I2C specification?Quote5V tolerant MCU open drain only outputs are a rarity rather than common thing. If you enable high side MOSFET when pin is pulled up to higher voltage than Vdd, means that you are dumb, not that pin is not 5V tolerant.

author: 0xdeadbeef
author_rank: Super Contributor
timestamp: May 31, 2019, 05:36:23 pm
content: Sadly, this forum starts to become like the rest of the internet. It's kinda impossible to post anything without running into someone who seems to be only interested in polishing his ego.This being said, I'd strongly advise to read up some datasheets instead of trying to share your superficial knowledge. Anyway, I'm out of here as there is obviously no way of agreeing with some people. Topic is on my ignore list, so don't bother.

author: wraper
author_rank: Unknown
timestamp: May 31, 2019, 05:36:53 pm
content: QuoteI advise you reading I2C specification.https://www.nxp.com/docs/en/user-guide/UM10204.pdfEDIT: "5V tolerant" is not a part of I2C specification. If going other way around and pulling-up to 3.3V with 5V devices used, then VIHwhich is VDD*0.7V will be out of spec for 5V devices.BTW initially I2C was 5V only interface, only afterwards support for other voltages was added to specification.

author: ejeffrey
author_rank: Super Contributor
timestamp: May 31, 2019, 06:23:20 pm
content: Quote from: 0xdeadbeef on May 31, 2019, 04:51:18 pmI2C uses open-drain to avoid contention on bidirectional pins. It doesn't actually specify the termination voltage which can be almost anything, and doesn't require devices to be tolerant of any specific voltage levels. Interoperation between 3.3V and 5V logic is one possibility but is not part of the specification and not required. Lower voltage devices like 1.8 V logic are extremely unlikely to be 5V tolerant.

author: wraper
author_rank: Unknown
timestamp: May 31, 2019, 06:36:44 pm
content: Quote from: ejeffrey on May 31, 2019, 06:23:20 pmAbout this I2C specification has to say:QuoteQuoteSo you can vary pull-up voltage in certain range as long as it does not fall out of input logic level voltage spec. But as you go above VDDfor particular IC, it's up to particular IC spec, not I2C specification as such.