View previous topic :: View next topic |
Author |
Message |
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
Max number of s/w I2C |
Posted: Tue Apr 27, 2021 10:55 am |
|
|
Is there a maximum number of software I2C channels with the compiler?
I'm thinking of using a single master with a bunch of I2C slave sensors but they don't have separate addresses. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Tue Apr 27, 2021 1:40 pm |
|
|
What do you mean?
I think you might be confusing I2C with SPI haha
But I think that multiplexer is along the lines of what I want. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9220 Location: Greensville,Ontario
|
|
Posted: Tue Apr 27, 2021 2:05 pm |
|
|
Compiler shouldn't care about # of SW I2C
That mux is what I'd use, as it saves 14 I/O pins !!! but then there's a wee bit of PCB space you'll need.....and $ for the MUX.
Maybe write down the 'pros and cons'(cost,space, time,pins, codespace,??)
Jay |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Tue Apr 27, 2021 2:07 pm |
|
|
Thanks for the heads-up
However, this is going to be a one-off thing. Might even be just plugged into a solderless breadboard and put into a box. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19487
|
|
Posted: Wed Apr 28, 2021 3:07 am |
|
|
Yes, the multiplexer is a definite solution for this. It also means you don't
get the problem of increasing capacitance on the bus as the number of
sensors goes up.
The Adafruit board is based on the 9548. There are actually a number of
these multiplexers:
https://www.nxp.com/products/interfaces/ic-spi-serial-interface-devices/ic-multiplexers-switches:MC_41851
The devices have their own I2C address (3 pins set this), so you can have
a single I2C bus talking to (say) two of these, which then address up to 16
devices all using the same address. All you have to be careful of it that
you make sure that the I2C address these are using are different from each
other, and from the final target device. These use 0b1110xxxR for their
address. You send the multiplexor address byte, followed by a control
byte to say what bus to talk to. Be careful, the control bytes just has bits
to select which bus is enabled. So you can send a command to all eight
busses by turning all the bits on. This can be useful for configuration for
example, but you need to make sure you are only selecting a single bus
when you are expecting a reply!... |
|
|
|