Author Topic: 2 ESP32's GPIOs to same header pins isolation  (Read 980 times)

0 Members and 1 Guest are viewing this topic.

Offline StealthrtTopic starter

  • Regular Contributor
  • *
  • Posts: 82
2 ESP32's GPIOs to same header pins isolation
« on: March 23, 2023, 02:49:49 am »
Hey all I am wondering if my idea below would work.

What I am wanting to do is connect 2 (really 3 ESP32's and 4 ATmega32u4's) micro controllers (in the example there are just 2 ESP32's for simplicity) and they both connect to the same header pins.



I know that this would not work if both ESP32's were powered on but would this work if only 1 of the ESP32 were to be powered while the other has no power?

I was unsure if this type of setup would cause an issue with one another? Or if this setup is fine as long as one is turned off?

If this would not work what could you suggest I can use in order to isolate the 2 ESP32's from each other? I was thinking a multiplexer but that would just allow 1 GPIO pin to then have 16 more GPIO pins for it.

I was also thinking about some type of reply but that would be a lot of relays to since the ESP32 has 25+ GPIO pins that I would connect to the headers.

There was another thought of using some type of optocoupler but like the suggestion above, this would also have many of them for the 25+ GPIOs.

Suggestions or confirmation would be great! Perhaps a IC that I have not heard of before that would be a good fit for this? Don't want to blow either up :)

Disclaimer: Also posted on
electronics.stackexchange.com
electro-tech-online.com
allaboutcircuits.com
« Last Edit: March 23, 2023, 02:55:05 am by Stealthrt »
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #1 on: March 23, 2023, 02:54:47 am »
Why do you want to connect them in this way?

I don't know what the ESP32 IO pins do when the device is not powered, it might work, or you could power them both up and set the pins on the inactive device as inputs and then they won't interfere.
 

Offline StealthrtTopic starter

  • Regular Contributor
  • *
  • Posts: 82
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #2 on: March 23, 2023, 02:59:48 am »
Why do you want to connect them in this way?

I don't know what the ESP32 IO pins do when the device is not powered, it might work, or you could power them both up and set the pins on the inactive device as inputs and then they won't interfere.

Just a project I'm thinking about doing just to see if something like this would work.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #3 on: March 23, 2023, 03:01:04 am »
Well you can certainly share IO pins, it's done all the time and is called a bus. You just have to make sure that only one thing is driving the bus at a time, everything else on it must be either tristated or inputs.
 
The following users thanked this post: Stealthrt

Offline StealthrtTopic starter

  • Regular Contributor
  • *
  • Posts: 82
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #4 on: March 23, 2023, 04:48:31 pm »
Well you can certainly share IO pins, it's done all the time and is called a bus. You just have to make sure that only one thing is driving the bus at a time, everything else on it must be either tristated or inputs.
Do you have any suggestions on what kind of IC to use for that?
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #5 on: March 23, 2023, 04:51:17 pm »
The 74LS245 is a common one, but you can use any IC that has tristate outputs, any modern microcontroller.
 

Offline StealthrtTopic starter

  • Regular Contributor
  • *
  • Posts: 82
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #6 on: March 23, 2023, 04:56:00 pm »
The 74LS245 is a common one, but you can use any IC that has tristate outputs, any modern microcontroller.
And the 74LS245 would work with both Analog and Digital in/out from/to the ESP2?
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3233
  • Country: gb
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #7 on: March 23, 2023, 05:33:36 pm »
I know that this would not work if both ESP32's were powered on but would this work if only 1 of the ESP32 were to be powered while the other has no power?

No, a high level input to an IO pin on an unpowered device would cause the input diodes on the unpowered device to be forwards biased, dumping current into it's supply rails and seriously loading down your signal.  Using something like a bus transceiver with tristate capability to isolate the powered down device will prevent this.
 

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2582
  • Country: us
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #8 on: March 23, 2023, 07:58:03 pm »
You don't necessarily need an IC, depending on what you need to do with the IO pins.  If you connect each MCU to the bus line through a diode with the cathode towards the bus, then each device can drive the bus high but not low.  You might want a pulldown resistor to hold the bus line low when none of the devices are driving it.  Flip the diodes around, and swap the pulldown for a pullup, and each device can drive the bus low but not high.  Or you could have each node drive the bus high or low with a transistor rather than directly connecting the MCU's IO pin, which could provide improved current handling or possibly better ability to withstand faults on the bus (or at least have a transistor take the hit rather than the MCU directly) if those factors are important to you.

The 74LS245 is a common one, but you can use any IC that has tristate outputs, any modern microcontroller.
And the 74LS245 would work with both Analog and Digital in/out from/to the ESP2?

No, the '245 is a digital buffer, it will buffer a digital signal in either direction depending on the state of the direction control line.  If you need to be able to pass an analog signal you need an analog switch instead.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #9 on: March 23, 2023, 08:13:11 pm »
*MOST* MCUs tristate (hi-Z) *MOST* of their I/O pins if held in reset.  Check their specific datasheets for details, and any pins that don't get tristated.   If that works for the pins you need, you simply need a reliable method of holding all their Reset pins except one MCU in the Reset active state (IIRC low for both ESP32 and ATmega).
 

Offline StealthrtTopic starter

  • Regular Contributor
  • *
  • Posts: 82
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #10 on: March 23, 2023, 11:26:47 pm »
Would something like the 74HC157 be a good choice? I’m reading the data sheet on it and it seems to allow 4 gpio + 4 gpio and outputs one of them. But I’m not seeing anywhere about if it can do digital and analog since the gpio would be one or the other. Aside from that I’m also not seeing anywhere where the company makes a larger version that would have do more than 8 inputs.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #11 on: March 24, 2023, 01:10:54 am »
If you need to switch analog you need an analog switch, not a digital logic IC. I'm still confused as to what the actual goal here is though, are you trying to accomplish anything or just wire stuff up for fun to see if it works?
 

Offline Infraviolet

  • Super Contributor
  • ***
  • Posts: 1012
  • Country: gb
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #12 on: March 24, 2023, 02:36:51 am »
It will depend on what the header pins are used for, but you can put some series resistors of a few K to 10K between the each microcontroller's pin and the common point where wires from multiple microcontrollers come together. These resistors protect against the over-current hazards which could destroy microcontrollers if one of them is trying to drive high in to another driving low, as with the resistors such a situation just looks to each mcu like it is driving a small load low or high.

If the header pin is an input to all the microcontrollers you'd make sure all of them had the relevant pins floating and then read them.

If the header pin is an output them you'd use a situation where the pin is pulled up (or down) normally, and when a microcontroller wants to output on it this single one can drive down (or up) strongly by becoming a low impedance output pin in the low (or high) state. The same way multiple devices sare the data line of an I2C bus.

In other scenarios you'd have to use other connections between the microcontrollers to negotiate between them for who has control of the shared line right now, and those series resistors would serve as protection (for mcu survival if not signal integrity) if this negotiation is ever messed up.

The main thing to ask here though is what the purpose, in your situation, of multiple mcus sharing a header pin is.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5835
  • Country: es
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #13 on: March 26, 2023, 02:35:57 am »
The pin ESD diode will dump the pin voltage into VDD.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline StealthrtTopic starter

  • Regular Contributor
  • *
  • Posts: 82
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #14 on: March 26, 2023, 10:28:56 pm »
Thanks for all the replies! I'm going back to my drawing board to figure some things out with the knowledge I now have. Thanks! :)
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: 2 ESP32's GPIOs to same header pins isolation
« Reply #15 on: March 27, 2023, 02:14:40 am »
The pin ESD diode will dump the pin voltage into VDD.

If both parts are on the same supply voltage? How is that going to happen?

Technical details aside, I'm still struggling to figure out why someone would *want* to connect something in this manner. It frustrates me a little when someone wants help with a project but then won't share details about it.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf