Author Topic: Multiplexing a pin for i2c signals and normal output signals  (Read 857 times)

0 Members and 1 Guest are viewing this topic.

Offline polarKaungTopic starter

  • Contributor
  • Posts: 24
  • Country: mm
Hi, I am doing a project which needs to multiplex a pin for i2c sda and a normal output signal. How do i do that? really appreciate your time and wisdom. I have been researching this on the internet and haven't really come up with any solution. Thanks.
 

Offline TomS_

  • Frequent Contributor
  • **
  • Posts: 851
  • Country: gb
Re: Multiplexing a pin for i2c signals and normal output signals
« Reply #1 on: May 25, 2023, 10:46:06 am »
You can very likely manually control the SDA pin without interfering with the i2c devices, but to use the pin for some other purpose (output) you're going to want to latch/clock the state of it into a flip flop or something along those lines. For input you probably want to feed it through a tri-state buffer that you can enable when ever you need to read it's state.

That's going to require one more pin to control the latch/clock/enable function, at which point you haven't really saved yourself any pins, so you might as well use that pin for your IO.

Alternatively, add a GPIO expander to the i2c bus and get yourself a bunch more IO pins.
« Last Edit: May 25, 2023, 10:48:03 am by TomS_ »
 

Online DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6228
  • Country: es
Re: Multiplexing a pin for i2c signals and normal output signals
« Reply #2 on: May 25, 2023, 12:13:03 pm »
Not easy because you're going to mess the i2c bus.
You might get it working as long as you are careful, avoiding causing a start or stop condition.

That is, SCL can never change while SDA is low.



So you would need to always set SDA high before changing SCL, then you can whatever with SDA.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf