Deep Sleep changes GPIO State
Deep Sleep changes GPIO State
I have a few sensors connected to my device, in order to conserve power I am using a low resistance p channel FET which enables power to the sensors, the gate is connected to GPIO13, being a P-channel, it is on when the gate is low and off when the gate is high.
Right before I goto sleep, I pull GPIO13 high, this disables power to the sensors, but then, when the device enters deepsleep() it appears to pull GPIO13 low switching power to the sensors back on again.
I have tried pulling the gate high with a 10K resistor and even switching GPIO13 to an input right before sleep, neither appear to make any difference.
According to this http://espressif.com/sites/default/file ... ons_en.pdf the GPIO state should remain unchanged during deepsleep() but this is not what I am seeing.
Any suggestions on how to solve this ??
Right before I goto sleep, I pull GPIO13 high, this disables power to the sensors, but then, when the device enters deepsleep() it appears to pull GPIO13 low switching power to the sensors back on again.
I have tried pulling the gate high with a 10K resistor and even switching GPIO13 to an input right before sleep, neither appear to make any difference.
According to this http://espressif.com/sites/default/file ... ons_en.pdf the GPIO state should remain unchanged during deepsleep() but this is not what I am seeing.
Any suggestions on how to solve this ??
Last edited by devnull on Wed Apr 05, 2017 12:03 pm, edited 2 times in total.
Re: Deep Sleep and GPIO State
Try a different GPIO?
Re: Deep Sleep and GPIO State
Thanks, that's not so simple as I have already created the PCB and it is all assembled and ready to be deployed and I will need to cut tracks and hack the PCB to be able to do that.
That will need to be a last resort
That will need to be a last resort
Re: Deep Sleep and GPIO State
Perhaps you should try it on a breadboard first, to see if it actually helps.
Re: Deep Sleep and GPIO State
OK, I have completely isolated the ESP12S from all other components and only connected TX, RX, VIN and GND.
Then I connected a DMM between GPIO13 and ground and executed the following code:
The DMM reads 3.3 Volts as expected.
The DMM now reads 0 volts (or a few millivolts) so I can confirm that putting the device into deepsleep does change the state of the GPIO.
I also tried this on GPIO12 and the result is the same.
Could somebody else verify this finding for me ?
Then I connected a DMM between GPIO13 and ground and executed the following code:
Code: Select all
import machine as mc
p13 = mc.Pin(13, mode=mc.Pin.OUT)
p13.high()
Code: Select all
mc.deepsleep()
I also tried this on GPIO12 and the result is the same.
Could somebody else verify this finding for me ?
Re: Deep Sleep changes GPIO State
Thanks Robert, but that will require me to redesign, remake and re-assmble my PCB which is already mounted in the box and ready to go.
According to the espressif documentation, the state of the GPIOs should not change during deepsleep and what I am trying to establish is whether or not this is a bug, which is why I am hoping that someone can verify my findings.
A firmware fix is going to be a whole lot easier than redesigning and remaking my PCB
According to the espressif documentation, the state of the GPIOs should not change during deepsleep and what I am trying to establish is whether or not this is a bug, which is why I am hoping that someone can verify my findings.
A firmware fix is going to be a whole lot easier than redesigning and remaking my PCB
Re: Deep Sleep changes GPIO State
Hello @devnull, what I did on a project with Pyboard is to switch the GPIO Ports to Input, before going to sleep. Maybe even a PUlLL_UP setting stays active. If not, you weuld need an external Pull-up.
Re: Deep Sleep changes GPIO State
Hi @Roberthh;
Yes, I did that even before I posted the problem, see my original post:
"I have tried pulling the gate high with a 10K resistor and even switching GPIO13 to an input right before sleep, neither appear to make any difference."
Yes, I did that even before I posted the problem, see my original post:
"I have tried pulling the gate high with a 10K resistor and even switching GPIO13 to an input right before sleep, neither appear to make any difference."
Re: Deep Sleep changes GPIO State
Hello @devnull, from what I can read in the specs and see in the code, deepsleep() powers off the digital section of the device. That means, the ports are in a kind of undefined state. Typically you have then some conductivity thourgh the ESD circuitry to VCC and GND. Using an Multimeter, it tells 330 kOhm to GND, but that reading depends highly on the properties of the measurement.
But checking a current from 3.3v into P13 through a 10 k resistor, I cannot see any current (reading below 0.1 µA), and if I pull P13 high to 3.3 V, I have a reading of 3.3 V at P13. So if you add a resistor between source and gate of your external transistor, that should keep the transistor switched off. You said you did that already, but that differs to my results. I used a Wemos D1 mini for the test.
But checking a current from 3.3v into P13 through a 10 k resistor, I cannot see any current (reading below 0.1 µA), and if I pull P13 high to 3.3 V, I have a reading of 3.3 V at P13. So if you add a resistor between source and gate of your external transistor, that should keep the transistor switched off. You said you did that already, but that differs to my results. I used a Wemos D1 mini for the test.
Re: Deep Sleep changes GPIO State
Thanks for taking the time to test this and follow up, I appreciate that.
I concur with your findings, it appears that the espressif low-power document is incorrect, even though it does state quite specifically in a few different sections that the GPIO state is unchanged during deepsleep.
I would not think this is a translation issue, but more like a blatant error, of which I believe there are many more !
I concur with your findings, it appears that the espressif low-power document is incorrect, even though it does state quite specifically in a few different sections that the GPIO state is unchanged during deepsleep.
I would not think this is a translation issue, but more like a blatant error, of which I believe there are many more !