Re:How many Devices can you Connect to the I2C Bus?
by magicsmoke on Tuesday April 13, 2021 @09:47AM
(#26792056)
The pull-up resistor allows I2C to have multiple masters on the same bus. A master take control of the bus by pulling either sck or sda low (can't remember which) and if other masters detect a low voltage when it expects a high it knows the bus is currently taken. SPI only has one active master on the bus at a time, so there's no need for pullup resistors to implement this arbitration mechanism. SPI masters just drive their bus lines using push-pull outputs.
[ Parent
| on HN ]
Re:How many Devices can you Connect to the I2C Bus?
by el_isma on Tuesday April 13, 2021 @11:31AM
(#26793634)
It's even cooler than that: it has collision avoidance.
To start a transfer you drive the clock low. If both masters drive the clock low at the same time. Then they start driving SDA with the address. If at any point in time, the address you are trying to put in the bus is not there, you stop. This could happen if you try to drive a 1 and the other master does a 0 (since it's open collector, the 0 will win), and you know you couldn't put your '1' in the bus, so you shut up and let the other master carry on.