How to configure pull-up resistors for i2c? #5181
Replies: 1 comment
-
Posted at 2015-12-14 by DrAzzy The MCU internal pullups are not nearly as strong as is specified by the I2C spec. (The same is true on Arduino - it's not as far off, but it's still out of spec). You might be able to get the desired behavior by setting the appropriate registers with poke - but as I said above, I don't expect it would work. I always use external pullups when working with I2C. Posted at 2015-12-15 by @yerpj If you accept to set up a reduced I2C speed, such as <10kHz, the internal pull-ups should work well. Anyway, as @drazzy said, the best solution is by far, connecting external pull-ups, as you don't want to encounter I2C errors, they are rather boring to handle. Posted at 2015-12-15 by @gfwilliams I remember having some trouble with the internal pullups for I2C, and not being able to get it to work (but that could have been on the F1-based original Espruino, not the Pico). If you wanted to try it, you'd have to use poke itself isn't desperately dangerous - you can crash Espruino so it needs a reboot, but it would be quite hard to cause physical damage. ... but in short, I'd say external pullups are easier - especially if it's just a solder jumper! Posted at 2015-12-15 by luwar Thank you for the hints. First I thought it would be an Espruino/JavaScript API question and totally forgot to think about the electrical part. The I²C specification says that the minimal pull-up is a little less than 1k with Vdd=3.3V and the maximum value depends on bus capacitance. Many breakouts have 4.7k so it's possible to use four devices (with pullups) in parallel without breaking the spec. There is detailed application note from TI: http://www.ti.com/lit/an/slva689/slva689.pdf On the other side I have to use a much lower value than the typical 40k MCU-internal resistors for 400kHz - I understand now. So I found my stability problem with the MCP9808 http://www.espruino.com/MCP9808. My sentence
can be removed from the documentation. BTW: Why are there "°"s instead of ° on the website? Again, thanks for the Tips. Posted at 2015-12-15 by @MaBecker take a look at this test results with different pull up resistors http://dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors Posted at 2015-12-16 by @gfwilliams Glad you got it sorted! I've just filed a bug for the strange degree symbol - I think it's a UTF-8 issue on the website. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-12-14 by luwar
Hi,
I'm using the temperature and humidity I²C sensor HTU21D in my current experiments. The bought Sparkfun HTU21D breakout had no prewired pull-up resistors on SCL or SDA. They are on the board but initial not connected. To enable I could bridge a solder jumper. Ok, long background...
I would prefer to use the MCU-internal pull-ups and tried the following code which does not work:
Is this possible to use the MCU-internal pull-ups with i2c or can they only be used for simple input pins?
Beta Was this translation helpful? Give feedback.
All reactions