TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How many Devices can you Connect to the I2C Bus?

187 点作者 drmacak大约 4 年前

17 条评论

jpm_sd大约 4 年前
I2C is not a wired network standard! It&#x27;s designed to be used between chips on the same PCB, typically with the same power supply rail (although level shifters are available) and the same ground reference plane. Yes, ground planes matter for best performance.<p>Breakout boards are meant for a quick test. Then you&#x27;re supposed to design a PCB with the devices you need all in one place. SparkFun spaghetti will only end in tears.<p>The other thing that sucks about I2C is that you never know what hard-coded addresses you will be limited to, until you&#x27;ve selected all your parts, dug into the datasheets and then discovered the inevitable collisions.<p>In 20 years of PCB design I think the largest number of I2C devices I&#x27;ve had on one bus is maybe 30? And that was pushing it.
评论 #26795191 未加载
评论 #26795819 未加载
评论 #26794241 未加载
评论 #26810959 未加载
评论 #26800022 未加载
评论 #26805384 未加载
jeff_ciesielski大约 4 年前
This is a nice breakdown, however it is leaving out one interesting piece: Active slew rate controllers.<p>In some cases where you need to exceed the typically allowed bus capacitance either due to a high number of attached devices, or over a long cable run (it happens...it sucks, but it happens), you can use a part like the LTC4311 which, rather than using resistors to passively pull the bus lines to a resting high state, detects the direction changes and actively assists in pulling the lines to their intended states.<p><a href="https:&#x2F;&#x2F;www.analog.com&#x2F;media&#x2F;en&#x2F;technical-documentation&#x2F;data-sheets&#x2F;4311fa.pdf" rel="nofollow">https:&#x2F;&#x2F;www.analog.com&#x2F;media&#x2F;en&#x2F;technical-documentation&#x2F;data...</a>
评论 #26793967 未加载
评论 #26797718 未加载
评论 #26802186 未加载
评论 #26792492 未加载
barbegal大约 4 年前
It&#x27;s very easy to remove the pull up resistors from most break out boards.<p>The most likely issue you will encounter with trying to connect many I2C devices is address collisions where devices have fixed addresses or at least some fixed bits in the address. This will probably limit you to about twenty or thirty useful devices on a bus.
评论 #26791950 未加载
评论 #26791967 未加载
squarefoot大约 4 年前
(about the number of slaves)<p>&gt; &quot; ...and I&#x27;m sorry to say, the answer is way lower than 127&quot;<p>127 is a really high number that nobody should encounter in real design situations. I2c was conceived for communications between chips on the same board; it is extremely unlikely that one could fit that many chips on a board, all talking i2c with each other on the same bus. I2c switch chips also can be used to split the bus in multiple parts so that only a few chips at a time are physically connected to the bus. Example: the PCA9548 from TI, NXP and possibly others.<p><a href="https:&#x2F;&#x2F;www.nxp.com&#x2F;products&#x2F;interfaces&#x2F;ic-spi-serial-interface-devices&#x2F;ic-multiplexers-switches&#x2F;8-channel-ic-bus-switch-with-reset:PCA9548A" rel="nofollow">https:&#x2F;&#x2F;www.nxp.com&#x2F;products&#x2F;interfaces&#x2F;ic-spi-serial-interf...</a>
评论 #26794493 未加载
评论 #26797832 未加载
MrBuddyCasino大约 4 年前
This seems to only get into the electrical issues associated with connecting lots of devices to an I2C bus. Due to deficiencies in the protocol specifications and real-world implementation issues, there are logical problems as well. As a consequence, it is near impossible to make it 100% reliable.<p>If you&#x27;re interested in the unpleasant details, whitequark has posted about this at length on Twitter.
评论 #26800522 未加载
aulin大约 4 年前
Always hated breakout board producers for this pull-up resistor thing, especially since they are often targeted at the educational market. Why would you solder fixed pull-ups guaranteed to work only when it&#x27;s just you in the bus (and not even that as it&#x27;s pretty common for uCs and SoCs to include their own pull ups)? Teach your users the simple calculation needed to add pull-ups themselves!
评论 #26799428 未加载
评论 #26803969 未加载
airhead969大约 4 年前
I have an &quot;I2C&quot; (no clock wire necessary, but it&#x27;s present) bus with 512 WS2811 devices split evenly across a 1:4 fan-out power and signal integrity multiplexer. This is because I couldn&#x27;t get 384 devices to maintain signal integrity (only about 340), likely due to too much load on the bus or reflections. 256 devices worked fine.<p>Clocked buses, especially large parallel clocked buses, are generally a bad idea due to clock skew (clock and data signals getting farther out-of-sync with different wire length and loads.)
评论 #26797367 未加载
mcshicks大约 4 年前
I think the thing I&#x27;ve seen that&#x27;s the hardest to detect is reflections on the falling edge of scl double clocking. It&#x27;s been a long time since I&#x27;ve seen it maybe more modern controllers slew rate limit the falling edge. But definitely the i2c device at the end of a long cable is not a great idea.
评论 #26796108 未加载
bambax大约 4 年前
Wow! Thank you HN!<p>I have been trying to work with more than one time of flight sensor and an Arduino recently, and I fried them all (the sensors, not the Arduino).<p>Will study this in detail now.
评论 #26792432 未加载
评论 #26792299 未加载
评论 #26792672 未加载
ramary大约 4 年前
Oof, yeah. Have spent so much time trying to get multiple devices to work reliably on the same bus. As more devices are added rise and fall time of the data line also becomes a thing. It can be really hard to get things working reliably and handle edge cases. Have also found different host MCUs are able to handle signal errors varyingly well. On some chips I’ve worked with the I2C peripheral won’t recover from an error on the line until the MCU is completely powered down and back up. This poses its challenges for overall system reliability.<p>All this is to say I’m always impressed that SparkFun has managed to build a product line around plug and play I2C with their QWIIC stuff. I’ve never used it though, so not sure how well it holds up with multiple devices.
评论 #26793408 未加载
SonOfKyuss大约 4 年前
Good article and explanation on the real-world issues that can be encountered with I2C devices. I wish the author had gone into more detail on how to solve those issues by using discrete sensors instead of breakout boards.
评论 #26791538 未加载
kirbypineapple大约 4 年前
I took my first stab at designing and having my own PCB manufactured for a mechanical clock I&#x27;m trying to build. At the moment I&#x27;m currently stuck trying to debug the 7 x MCP23017 devices on my I2C bus. I picked up an oscilliscope and added a level converted between the RPi and my PCB, but I feel pretty lost as I&#x27;m a complete novice and have no formal background in electronics. This article provides a lot of useful information for someone like me! Online all you usually get are single MCP23017 implementations, nothing too complex.
评论 #26796179 未加载
m463大约 4 年前
I think dallas 1-wire is a pretty interesting bus too. you can have many devices on it. I have lots of ds18b20 temperature sensors using pi + 1-wire.<p>Most people splurge and use three wires though...
xyzzy21大约 4 年前
This is similar to the very similar HPIB&#x2F;GPIB&#x2F;IEEE488.<p>In theory you can have 32 addresses but in reality because of electrical limitations (even defined in the IEEE488 spec) you can only have about 24 devices.
syntaxing大约 4 年前
Interesting, is the pullup resistor common for other protocols like SPI?
评论 #26792056 未加载
评论 #26792029 未加载
评论 #26792398 未加载
stavros大约 4 年前
Has anyone used both I2C and other protocols like PJON or CAN and can compare?
评论 #26791555 未加载
评论 #26792359 未加载
评论 #26797636 未加载
评论 #26795183 未加载
评论 #26791522 未加载
willis936大约 4 年前
Even when cookies are generously handled they’re still a nuisance. At what point are they just banned outright?