0
\$\begingroup\$

I have some questions regarding the I2C protocol. Is it possible to use multiplexing/demultiplexing to combine the sda and scl lines into a single one? Is it possible to use multiplexing/demultiplexing to create an extended I2C protocol where two masters can speak on the same bus at the same time to two different slaves?

\$\endgroup\$
12
  • 3
    \$\begingroup\$ No, because slaves have no control over the clock. The clock only comes from the master. \$\endgroup\$
    – DKNguyen
    Sep 22, 2022 at 2:32
  • 1
    \$\begingroup\$ @DKNguyen Except for clock stretching, but that still doesn't get you what Andrealphus wants. \$\endgroup\$
    – Hearth
    Sep 22, 2022 at 2:50
  • 3
    \$\begingroup\$ @Andrealphus But that's not what you described in the your original post. In your original post you asked to combine the SDA and SCL lines into a single line. And this second thing you are now bringing up is not necessary: "two master's SDAs to a 2 to 1 multiplexer (one input for each master) that switches between the two masters at some clock rate." because I2C is already a multimaster bus. \$\endgroup\$
    – DKNguyen
    Sep 22, 2022 at 3:45
  • 1
    \$\begingroup\$ @Andrealphus Correct. That will be the case if you use multimaster I2C. \$\endgroup\$
    – DKNguyen
    Sep 22, 2022 at 3:51
  • 1
    \$\begingroup\$ I suggest you find another alternative. It's going to be a buttload of work to make an I2C cross switch since the cross switch will need to be able to arbitrate. It would basically be its own multi-channel I2C device that is capable of simultaneously passing I2C messages (which are bidirectional of course which complicates things) but also intercepting and middle-manning messages so that if a master tries to talk to a slave that is unavailable, it can block the message from getting to the slave while sending something back to the master to notify that the slave is busy and terminate the link. \$\endgroup\$
    – DKNguyen
    Sep 22, 2022 at 3:53

1 Answer 1

0
\$\begingroup\$

You can convert I2C transactions to any other protocol that runs on 1 wire, such as UART, and convert them back to I2C transations. So if you only ask if it is possible in any way, yes, but it depends what you mean by multiplexing, so it might be a no.

I2C won't allow two masters to communicate on a single bus simultaneously, as only one transaction may be going on the I2C bus at any given time, so if you only ask if it is possible, no it isn't.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.