cancel
Showing results for 
Search instead for 
Did you mean: 

I2C pcb and pull-up

federico.massimi
Associate III

Good morning, I wanted to ask a question about the I2C interface.

In particular on the routing of the pcb, I have a micro STM32 that is the master for i2c bus, then there are 2 slaves on the board and a connector to allow the connect of a third.

The question is: the SDA and SCL tracks must all start from the STM32 and go to each slave or from the STM32 I have to go to the first slave, then from this to the second slave and so on.

and in both cases, pull-up resistances where they must be positioned? can I use the STM32 internal pull-ups?

thansk in advance

4 REPLIES 4
S.Ma
Principal

I2c bus is slow, put the pull ups anywhere and close to each other. Most important is to limit noise injection, coupling and capacitance. Tracks should cross 90 degrees noisy lanes, length of total tracks no too large over ground. If the lanes are long, pull ups around mcu and weaker pullups near other end of the bus. Mostly useful if the i2c bus goes througb detacheable connector such as vga for display monitors.

AvaTar
Lead

> and in both cases, pull-up resistances where they must be positioned?

With the I2C bus frequencies, this issue is not critical.

> can I use the STM32 internal pull-ups?

Definitely not.

Most slaves need a bus with 1k ..10k Ohm pull-ups, 2,4 kOhm would be a good starting point.

The internal pull-ups are an order of magnitude too high in value.

Danish1
Lead II

I2C is a slow protocol (by modern terms). As such, you don't need to be as careful with layout as you would for e.g. USB. (I suppose technically these resistors terminate the transmission-lines that are each of your SCL and SDA, so you'd want to distribute them at all the ends of these transmission-lines. But I2C is so slow that it shouldn't matter).

Where I only have less than 10 cm of total track length all on one pcb, I find I can use the internal pull-up resistors and whatever routing is convenient and get reliable I2C at the standard rate of 100 kbps. (It works when I test it at 400 kbps so dropping down to 100 kbps is my safety-margin).

But if you have a connector to another board, perhaps with wires as well, the stray capacitance is going to be so large that the pull-up resistors should probably be in the 1k to 4.7k range, so you will need external pull-ups.

For a prototype, it costs nothing to make space on your pcb for the resistors. And only bother to populate them if the rise-time starts getting to be a visible fraction of the bit-time when viewed on an oscilloscope.

Hope this helps,

Danish

federico.massimi
Associate III

ok, thank you very much for the answers. I think that at this point I will start the SDA and SCL lines directly from the MCU to the slaves (star configuration with central master) and place no fitted pads for 3K3 pull-up resistors near MCU.

thank you so much