Author Topic: i2c pull-ups current  (Read 4645 times)

0 Members and 1 Guest are viewing this topic.

Offline rookieTopic starter

  • Contributor
  • Posts: 33
  • Country: us
i2c pull-ups current
« on: May 28, 2019, 05:37:52 pm »
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?
 

Online wraper

  • Supporter
  • ****
  • Posts: 17952
  • Country: lv
Re: i2c pull-ups current
« Reply #1 on: May 28, 2019, 05:47:13 pm »
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?
Quote
the lines are always held high
They are not "held" high, they are just not held low. In which case current should not flow.
 

Offline Nerull

  • Frequent Contributor
  • **
  • Posts: 694
Re: i2c pull-ups current
« Reply #2 on: May 28, 2019, 05:50:37 pm »
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.
 
The following users thanked this post: KL27x

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1581
  • Country: de
Re: i2c pull-ups current
« Reply #3 on: May 28, 2019, 05:59:08 pm »
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
Trying is the first step towards failure - Homer J. Simpson
 

Online mikerj

  • Super Contributor
  • ***
  • Posts: 3382
  • Country: gb
Re: i2c pull-ups current
« Reply #4 on: May 28, 2019, 06:21:19 pm »
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.

Are 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.
 

Offline rookieTopic starter

  • Contributor
  • Posts: 33
  • Country: us
Re: i2c pull-ups current
« Reply #5 on: May 28, 2019, 06:37:56 pm »
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?
 

Offline bson

  • Supporter
  • ****
  • Posts: 2497
  • Country: us
Re: i2c pull-ups current
« Reply #6 on: May 29, 2019, 02:22:34 am »
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.
 

Offline rookieTopic starter

  • Contributor
  • Posts: 33
  • Country: us
Re: i2c pull-ups current
« Reply #7 on: May 29, 2019, 06:57:28 pm »
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.
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4034
  • Country: us
Re: i2c pull-ups current
« Reply #8 on: May 29, 2019, 07:16:25 pm »
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.
 

Offline garethw

  • Regular Contributor
  • *
  • Posts: 88
  • Country: gb
Re: i2c pull-ups current
« Reply #9 on: May 29, 2019, 07:57:18 pm »
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.

If 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.
Father
Husband
MENG Electronic Engineering student
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9964
  • Country: us
Re: i2c pull-ups current
« Reply #10 on: May 29, 2019, 08:31:35 pm »
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!
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1581
  • Country: de
Re: i2c pull-ups current
« Reply #11 on: May 31, 2019, 10:10:27 am »
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?
A 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.
Trying is the first step towards failure - Homer J. Simpson
 

Online wraper

  • Supporter
  • ****
  • Posts: 17952
  • Country: lv
Re: i2c pull-ups current
« Reply #12 on: May 31, 2019, 03:37:47 pm »
A 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.
I2C 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.
Quote
Actually true I2C peripherals don't have a push/pull stage configured to use only the lowside, but a true open drain output.
High 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.
« Last Edit: May 31, 2019, 03:49:46 pm by wraper »
 

Online wraper

  • Supporter
  • ****
  • Posts: 17952
  • Country: lv
Re: i2c pull-ups current
« Reply #13 on: May 31, 2019, 04:21:46 pm »
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?
The 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.
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1581
  • Country: de
Re: i2c pull-ups current
« Reply #14 on: May 31, 2019, 04:51:18 pm »
I2C 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.
I2C 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.

High side mosfet present on the multipurpose pin does not do any harm.
Effectively it is non existent there when interface is configured as I2C.
Well, 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.

Does not make it any less "true" I2C interface.
Still, 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.


Trying is the first step towards failure - Homer J. Simpson
 

Online wraper

  • Supporter
  • ****
  • Posts: 17952
  • Country: lv
Re: i2c pull-ups current
« Reply #15 on: May 31, 2019, 05:22:26 pm »
I2C 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.
I2C 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.
I2C 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.
Quote
Using internal pullups contradicts this idea as different pullup voltages working against each other would obviously create issues.
I wonder how your idea suddenly became a part of I2C specification?
Quote
And usually only these pins are fully 5V tolerant for 3.3V microcontrollers.
5V 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.
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1581
  • Country: de
Re: i2c pull-ups current
« Reply #16 on: May 31, 2019, 05:36:23 pm »
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.
Trying is the first step towards failure - Homer J. Simpson
 

Online wraper

  • Supporter
  • ****
  • Posts: 17952
  • Country: lv
Re: i2c pull-ups current
« Reply #17 on: May 31, 2019, 05:36:53 pm »
Quote
I'd strongly advise to read up some datasheets instead of trying to share your superficial knowledge.
I advise you reading I2C specification. https://www.nxp.com/docs/en/user-guide/UM10204.pdf

EDIT: "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 VIH which 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.
« Last Edit: May 31, 2019, 06:23:02 pm by wraper »
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4034
  • Country: us
Re: i2c pull-ups current
« Reply #18 on: May 31, 2019, 06:23:20 pm »
I2C 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.

I2C 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.
 

Online wraper

  • Supporter
  • ****
  • Posts: 17952
  • Country: lv
Re: i2c pull-ups current
« Reply #19 on: May 31, 2019, 06:36:44 pm »
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.
About this I2C specification has to say:
Quote
VIL LOW-level input voltage −0.5 - 0.3VDD[1] V
VIH HIGH-level input voltage 0.7VDD[1] - VDD + 0.5 V
Quote
[1] Devices that use non-standard supply voltages which do not conform to the intended I2C-bus system levels must relate their input levels
to the VDD voltage to which the pull-up resistors Rp are connected.
So 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 VDD for particular IC, it's up to particular IC spec, not I2C specification as such.
« Last Edit: May 31, 2019, 06:42:26 pm by wraper »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf