2021-12-06 12:34 AM
Hi everyone, I am confuse about I2C pull-up resistors. I use 4 I2C sensors. I am not sure is it true that pull-up resistors count. I use every sensors for pull-up resistors. If I use just one I2C port (I mean one port for all sensors) is it enough?
2021-12-06 12:45 AM
The internal pullup resistors are nominally 40kOhm, see datasheet to your STM32.
These may or may not be sufficient for I2C, depending on the exact parasitic capacitances on SDA/SCL (which depends on connected devices and the PCB layout) and your expected communication speed.
In most cases, external pullups with lower values are installed to ensure high enough communication speed. In cases with high electromagnetic noise and/or crosstalk from parasitically coupled signals, external pullups may also help mitigate errors resulting from these effects.
JW
2021-12-06 01:10 AM
No, the internal pull-ups are too weak to serve as the only I2C pull-ups in most circumstances, they serve other purposes. For a good PCB design, the pull-up resistance shall be estimated from the capacitance of the I2C lines and the I2C bus speed.. The I2C specification provides info on that and there is plenty of 3rd party material. For a bread board prototype etc.. when the capacitance is unknown, you might simply check the signal edges with a (simple USB?) scope. If the pull-ups are too weak, the signal will not recover (go high) fast enough. If the pull-ups are too strong, the drivers in the sensors may not pull the signal down fast enough or overload.
Looking at you schematics, I would say "should work", but don't take my word for it.
hth
KnarfB
2021-12-06 06:25 AM
In addition to what others have said, you also need external resistors to put the SDA/SCL lines in a known state (high) during startup, between the time power is applied and when you initialize the pin with a pullup.
You only need one pullup resistor per line, not one per line per slave.
You can use a single I2C port if all slaves have unique addresses.
2021-12-09 06:07 AM
Thanks for your return guys. :)
2021-12-09 07:23 AM
Yes, you do seem confused about relatively basic things, do you have any formal education in this field, or is this a student project?
10K at every node is not necessary, Typically the topology would have them at the end of the bus, with 2K7 being quite typical, along with 1K5. Although the latter can be a bit aggressive for some low power devices. The open-collector transistors in the slaves have to clamp the signal to ground. And when released the pull-ups need to be aggressive enough to get the signal to a high state, overcoming the capacitance in the bus, and sufficiently quickly to support the data rate being used.
Might I suggest reviewing course materials on MCU bus interfacing, or consulting with supervisors or colleagues with more experience.