Xinyuan-LilyGO / TTGO-T-Display

MIT License
995 stars 332 forks source link

PWR EN functionality #6

Open paccerdk opened 4 years ago

paccerdk commented 4 years ago

I've been trying to figure out the functionality the PWR EN, but your schematics is difficult to figure out in this regard, and its not documented anywhere.

As far as i could figure out, the PWR EN "pin" is supposed to shut off the 3.3V regulator when powered by battery (and usb is disconected), but it does not seem to work (i've tried toggling it)

Joennuh commented 4 years ago

Just a guess: maybe it is read only? So you can read the value and let your sketch find out in this way whether it runs from battery or USB power?

paccerdk commented 4 years ago

@Joennuh its an output, there's a diode on the pin, restricting current flow to one direction.

gnunomad commented 4 years ago

I have the same problem. I've been analyzing the scheme but I can't figure out how that pin works. I think the scheme contains errors in the polarity of the mosfet.

lewisxhe commented 4 years ago

I get feedback: PWR_EN can continue to detect the power of the lithium battery when there is no USB power supply. V3V is to prevent leakage current. @paccerdk

paccerdk commented 4 years ago

@lewisxhe This isn't making much sense to me. Detect in which way? As mentioned earlier, it appears to be an output, there is a diode restricting the current flow to one direction. (out) Could you perhaps share the feedback that you got? Honestly, it seems to me like there is a mistake on the schematic, and the PWR_EN was supposed to be able to let the device turn itself off, when battery powered. that also explains the naming.

lewisxhe commented 4 years ago

@paccerdk In order to use VBA to turn on the power, because, when downloading 32, the single chip PWR_EN can not work, so V3V has no power, so 2104 can not be downloaded, so open V3V power through VBUS

The above is the original words, I am responsible for the transmission.

ricolk commented 4 years ago

I cannot understand BAT offsheet. It is just connected to Q4 and to the partition for battery conversion... Is it connected also to VBAT?

ticksp commented 4 years ago

ESP32-TFT(6-26).pdf For understand PWR_EN functionality you can have a look on comments, which I made in attached schematic. So you can set PWR_EN to "1" and read voltage in BAT_ADC, if this voltage more than 4.3 V device have powered from USB. If less then 4.3 V - device have power from battery. To save battery you can set PWR_EN to "0" and in this case USB converter will be power off and do not use your battery. When you need to measure battery voltage first set PWR_EN to "1", measure voltage and then set PWR_EN back to "0" for save battery. I hope my descrition will help somebody to better use this device! :)

pvonmoradi commented 3 years ago

@ticksp Thanks for the clarification. So the connection of GPIO14 to PWR_EN (as it is JTAG's TMS pin) does not hurt JTAG functionality right? The way I see it, while debugging via JTAG, some transistors would get stressed (because of PWR EN) and the "BAT_ADC (ADC_IN, VDET_1/GPIO34)" voltage is not to be trusted, but nevertheless, this wouldn't hurt debugging.

17 #26

Edit: Oh, I think the problem is GPIO14 is not actually broken out so it's inaccessible...

tadam777 commented 3 years ago

It's possible to solder a wire on the bottom of the T-Display module to access the GPIO14. I didn't test it myself but a user confirmed it to work ( https://github.com/Xinyuan-LilyGO/TTGO-T-Display/issues/6#issuecomment-899104385 ) :

Plan de travail 1@4x

posplayr commented 3 years ago

Can anyone confirm that you can access IO14 at D6 in order to support JTAG and have the JTAG work?

Also it seems as if from ticksp's comment above: _When you need to measure battery voltage first set PWR_EN to "1", measure voltage and then set PWREN back to "0" for save battery.

if not using a battery then D6 be removed and this makes it easier to solder a wire to the anode pad of D6?

kiromaisus commented 2 years ago

Yes, it's possible to solder a pin on one end of the diode that's connected to IO14 and use JTAG. I did it with ESP-prog and it worked. Not needed to remove the diode, but I'm not using it with battery, just to debug.

posplayr commented 2 years ago

Yes, it's possible to solder a pin on one end of the diode that's connected to IO14 and use JTAG. I did it with ESP-prog and it worked. Not needed to remove the diode, but I'm not using it with battery, just to debug.

Thank you for that confirmation.