Go Down

Topic: I2C pullup resistors - 1 master with 6 Slave (Read 4772 times) previous topic - next topic

LLucas

Hallo,
I have a circuit (I2C) with one Master (Ardu Mega) and 6 Slaves (Ardu mini pro).
I found out that you normally use 4,7KOhm resistors.
Can I use 4,7KOhm for my circuit?
 

Best regards

Koepel

How long are the wires for SDA and SCL, and what kind of wires or cables are used ?
If they are very short then 4k7 is okay.

pwillard

Worst case, you need a slightly stronger pullup... so you grab a 3.9K instead.

But keep in mind that (to be helpful...) many suppliers of small boards add integrated pullups on the boards but you really only want the bus to be "pulled up" in one place.

If your slaves have integrated pullups, consider finding a way to disable them.  (de-solder)

LLucas

The cable (SDA and SCL) are 8 cm long between each devices. Total 40 cm long. Cross-section is 0.14mm²

Koepel

And the pieces of cable are not flat ribbon cable with SDA and SCL next to each other ? Because SDA and SCL next to each other in a ribbon cable is not good.
The 4k7 is okay. A little less is a little better, so 3k9 is also okay, or even 2k7 or 2k2 if you want to run the I2C bus at 400kHz.

LLucas

#5
Jan 14, 2016, 06:34 pm Last Edit: Jan 14, 2016, 06:41 pm by LLucas
It's not flat ribbon, its normal round cable

I found this:  http://www.edaboard.com/thread305988.html#post1309939



Koepel

A pullup resistor of 1k is outside the specifications for the I2C, don't use such a low value.

Here is a super awesome tutorial : http://gammon.com.au/forum/?id=10896&reply=5#reply5

Grumpy_Mike

What is important is the capacitance of the wires. You want a low capacitance.

With ribbon cables the wires are very close and so has a high stray capacitance. Ordinary wires just floating above the board are good.

LLucas

#8
Jan 15, 2016, 12:19 pm Last Edit: Jan 15, 2016, 12:24 pm by LLucas
Thank you for the answer.

My last question is, is this wiring ok?
Google says yes

http://www.pixhost.org/show/67/31081168_w1-kopie.jpg

Koepel

#9
Jan 15, 2016, 12:36 pm Last Edit: Jan 15, 2016, 12:38 pm by Koepel
Yes, that's okay. The Arduino Mega has the I2C at other pins.

The Arduino Mega has 10k pullup resistors on the board, and every Arduino has internal pullup resistors enabled for I2C. Your total pullup will be: 4k7 // 10k // 7 times 50k = 2k2
Calculation : http://www.google.com/search?q=1%2F(1%2F4.7+%2B+1%2F10+%2B+7%2F50)

Grumpy_Mike

Quote
and every Arduino has internal pullup resistors enabled for I2C.
Not quite right.
The standard I2C library distributed with the IDE does this. There are other libraries like:-
https://github.com/DSSCircuits/I2C-Master-Library
It has other advantages too, like being able to transfer much more data at a single call, and also change the bus speed. 

68tjs

Quote
and also change the bus speed.  
News : now TwoWire class has a function "setClock" regrettably undocumented.

file Wire.h
Quote
public:
    TwoWire();
    void begin();
    void begin(uint8_t);
    void begin(int);
   void setClock(uint32_t);
./././././
Wire is an auto instancied object of  TwoWire class
file Wire.h :

Quote
class TwoWire : public Stream
{
./././
}

extern TwoWire Wire;

Grumpy_Mike

Quote
News : now TwoWire class has a function "setClock" regrettably undocumented.
If it is undocumented then for all intents and purposes it isn't there.

Wawa

Standard I2C devices are 100khz/400pf/3mA.
AFAIK Arduinos are able to match FM+ I2C devices (400khz/4000pf,30mA).
Much lower value pullup resistors are allowed (<330ohm).
Google "Fast Mode Plus I2C". There is an NXP document explaining the limits.

40cm of wiring shouldn't be a problem with the Mega's 10k onboard pullup resistors and the other internal ones.
If your wiring is ok, no extra resistors should be needed.
Leo..

68tjs

@Grumpy
Quote
If it is undocumented then for all intents and purposes it isn't there.
If I translate correctly your words  in French (I can mistake) : this function is not documented so do not use it

I don't agree
Question: who is responsible for Wire -> I do not think it is  Arduino because Wire belongs to Wiring IDE.
IMHO Wire authors have improved Wire class, but  Arduino Web responsibles did not realize it and did not report.
It is an issue.

@Wawa
NXP UM10204
Quote
5. Bus speeds
Originally, the I2C-bus was limited to 100 kbit/s operation. Over time there have been
several additions to the specification so that there are now five operating speed
categories. Standard-mode, Fast-mode (Fm), Fast-mode Plus (Fm+), and High-speed
mode (Hs-mode) devices are downward-compatible -- any device may be operated at a
lower bus speed. Ultra Fast-mode devices are not compatible with previous versions
since the bus is unidirectional.

Bidirectional bus:
- Standard-mode (Sm), with a bit rate up to 100 kbit/s
- Fast-mode (Fm), with a bit rate up to 400 kbit/s
- Fast-mode Plus (Fm+), with a bit rate up to 1 Mbit/s
- High-speed mode (Hs-mode), with a bit rate up to 3.4 Mbit/s.

Unidirectional bus:
- Ultra Fast-mode (UFm), with a bit rate up to 5 Mbit/s
AVR microcontroler  supports data rates up to 400 kHz (Datasheet)
I use the Wire setClock function to test I2C ( two nano one master and one slave). I2C works fine until 533 kHz.

Go Up