Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Pull up via GPIO

Rajinder1268

Advanced Member level 4
Joined
Mar 20, 2021
Messages
117
Helped
0
Reputation
0
Reaction score
2
Trophy points
18
Activity points
886
Hi,
I am interfacing a PIC micro to Esp32.
I need to control the EN (enable) in of the Esp32. It is disabled by a logic 0 and enabled by a logic 1. Powered from 3V3..
I have the EN line pulled low via a 100K resistor. What is the best way to toggle this high via the PIC GPIO pin?
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,571
Helped
5,036
Reputation
10,096
Reaction score
4,876
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
131,972
If the PIC runs on 3V3 just connect them together and drive the PIC IO pin high or low as required.

If the PIC runs on 5V, connect it like this:
[PIC IO Pin] --- 10K resistor --- 15K resistor --- GND
and connect the ESP32 EN pin to the junction of the two resistors. They will drop 5V down to 3.3V.

Brian.
 

Rajinder1268

Advanced Member level 4
Joined
Mar 20, 2021
Messages
117
Helped
0
Reputation
0
Reaction score
2
Trophy points
18
Activity points
886
If the PIC runs on 3V3 just connect them together and drive the PIC IO pin high or low as required.

If the PIC runs on 5V, connect it like this:
[PIC IO Pin] --- 10K resistor --- 15K resistor --- GND
and connect the ESP32 EN pin to the junction of the two resistors. They will drop 5V down to 3.3V.

Brian.
Thanks for your reply. The PIC is running from 3V3. I have done as you suggested in your first comment. When driving the PIC GPIO high (that will connect 3V3 to the GPIO). Do I need to enable any pull up too? If so would that cause a voltage divider to form with my 100K pull down?
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,571
Helped
5,036
Reputation
10,096
Reaction score
4,876
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
131,972
No, you do not need the pull-up enabled. Normally, the pull-up is only used when the pin is an input and disabled automatically when you use it as an output anyway. The PIC will typically be able to drive or sink about 20mA from an output pin so the tiny current through the 100K resistor would be irrelevant, you can safely remove it if the PIC is permanently wired to the EN pin.

Brian.
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
22,244
Helped
4,613
Reputation
9,242
Reaction score
4,878
Trophy points
1,393
Activity points
146,953
Hi,

first of all:
* are you using the bare ESP32 IC --> then use the ESP32 hardware design guide.
* or do you use any ESP module --> then refer to the manufacturer´s documentation.

Most reliable informations come from espressiv. Thus reading/referring the espressiv ESP32 documents is the safe way.

The EN pin often is driven from several sources, like: pull_up, RESET_ICs, programmer (connnector), RS232/UART IC ...
You need to comply with all of them.

In many cases: EN is pulled up by a resistor and there is a capacitor connected to GND to generate a delay.
All other sources are just open_collector / open_drain style and just pull the PIN down, but never actively drive them HIGH. Thus you have a "wired AND" and avoid short circuiting a signal.

Klaus
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,571
Helped
5,036
Reputation
10,096
Reaction score
4,876
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
131,972
To clarify what I stated in post #4, an ESP32 is a microprocessor but if you are using a development module that contains an ESP32 but has support circuitry around it (like the NodeMCU32) you need to be aware of conflicts if other things drive the EN pin. For example, on several development modules there is a 10K resistor pulling EN high and a capacitor to ground. The bare ESP32, ESP32-S or WROOM modules can safely be driven directly. If in doubt, add a resistor (about 470 Ohms) between the PIC and ESP EN pin to be sure nothing is overloaded.

Brian.
 

johnny78

Full Member level 3
Joined
Jun 28, 2017
Messages
152
Helped
0
Reputation
0
Reaction score
3
Trophy points
18
Activity points
1,033
i simply use PC817 optocoupler for this kind of situations
pull Up pull Dn Reset any external control of chip

regards
Johnny
 

Rajinder1268

Advanced Member level 4
Joined
Mar 20, 2021
Messages
117
Helped
0
Reputation
0
Reaction score
2
Trophy points
18
Activity points
886
To clarify what I stated in post #4, an ESP32 is a microprocessor but if you are using a development module that contains an ESP32 but has support circuitry around it (like the NodeMCU32) you need to be aware of conflicts if other things drive the EN pin. For example, on several development modules there is a 10K resistor pulling EN high and a capacitor to ground. The bare ESP32, ESP32-S or WROOM modules can safely be driven directly. If in doubt, add a resistor (about 470 Ohms) between the PIC and ESP EN pin to be sure nothing is overloaded.

Brian.
If I add a 470ohm and I have a 10K pulldown will this not make a voltage divider at around 3.15V powered by 3V3?

How can I then disable the device? Yes you are correct I have seen many configurations with esp32 wroom.where they have only a pull down or RC arrangement. What is the best for my issue?
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,571
Helped
5,036
Reputation
10,096
Reaction score
4,876
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
131,972
Driving 3V3 through 470 Ohms to a 10K pull-down will produce 3.152V as you stated. Driving 0V through 470 Ohms to a 10K pull-down will produce 0V.

Anything greater than 0.75 * VDD ( = 2.475V) is guaranteed to be seen as a high and anything less than 0.25 * VDD (= 0.825V) is guaranteed to be seen as logic low so the conditions are easily met.

Brian.
 

Rajinder1268

Advanced Member level 4
Joined
Mar 20, 2021
Messages
117
Helped
0
Reputation
0
Reaction score
2
Trophy points
18
Activity points
886
Driving 3V3 through 470 Ohms to a 10K pull-down will produce 3.152V as you stated. Driving 0V through 470 Ohms to a 10K pull-down will produce 0V.

Anything greater than 0.75 * VDD ( = 2.475V) is guaranteed to be seen as a high and anything less than 0.25 * VDD (= 0.825V) is guaranteed to be seen as logic low so the conditions are easily met.

Brian.
Thanks for the explanation. I wanted to learn what happens internally inside the GPIO of the PiC when driven high, low and as an input etc. Is there any resource?
 

Rajinder1268

Advanced Member level 4
Joined
Mar 20, 2021
Messages
117
Helped
0
Reputation
0
Reaction score
2
Trophy points
18
Activity points
886
Thanks for the explanation. I wanted to learn what happens internally inside the GPIO of the PiC when driven high, low and as an input etc. Is there any resource?
Sorry, does the GPIO of the micro need to connect to the 470/10K junction or the top of the voltage divider ie. Top of 470R. I think top of 470R?
Also if I did not have the 470R and just a 100K pull down, when I set the pin to an output high, then this connects 3V3 to the EN pin, is there any danger of damaging the GPIO as there is no pull up?

Sorry I am a novice... Still learning.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,571
Helped
5,036
Reputation
10,096
Reaction score
4,876
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
131,972
The PIC data sheet shows the data flow at the pins in a diagram. Basically the output has two switches, one from the pin to VDD and one from the pin to GND. To drive the pin high, the VDD side switch is closed and the GND side one is open, to drive it low, the opposite is true, the VDD switch is open and the GND one closed. Internal circuits ensure it is impossible to close both switches at the same time as they would short out VDD and GND. When used as an input, both those switches are turned off so the pin isn't driven at all, this allows outside circuits to drive the pin and it's logic sense is read into the PORTx register.

Please understand that on an input pin, a pull up or pull down resistor is there for only one purpose, to ensure the logic level on the pin is at a known state. Input pins draw almost zero current so high value resistors can be used which makes it easy to drive them from outside circuits without the resistor causing much loading. If an input doesn't have a pull-up or pull-down and isn't driven from outside, it will 'float' at an indeterminate level, influenced by static charges and interference nearby and that would make operation unpredictable.

Brian.
 

LaTeX Commands Quick-Menu:

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top