Pull-up/down during deep-sleep

  • Does internal pull-up/down set by pin.init() pull parameter stay effective during deep-sleep?

  • @bnjroos I'm definitely not an EE, but you may want to have a circuit where you use both VDD or 3V3 and a GPIO pin as inputs.

    When VDD/3V3 are off, just ignore completely the GPIO pin (open circuit) and set the output to whatever state you need. When they're on, they you can use the GPIO pin (directly or indirectly) to control the output.

  • @jcaron the thing is that I need to change the logical state of my pin while running for communication. That pin is used for the full-duplex mechanism and the shutdown mechanism. That's why I intended to use a transistor because I do not see any better option.

  • @robert-hh As mentioned above, this may work for the ESP32 deep sleep (machine.deepsleep), but definitely won't for the Deep Sleep Shield/Pytrack/Pysense-controlled deep sleep, which powers down the ESP32 and results in really funky stuff.

  • @danielm What I was asking me all the time was the effectiveness of the pin.hold() method, which tells to keep the value of a GPIO pin during deepsleep.

  • @bnjroos Note that it may be easier to use either the VDD input to the module or the 3V3 output from the module as an indication of the module being powered up or not rather than a GPIO pin.

    My experience with GPIO pins during sleep was pretty bad, but I'm definitely no EE and just seeing a transistor gives me headache, so I may have missing something easy and obvious.

  • @bnjroos If you need that inverting function and you cannot control the GPIO otherwise, then it's OK. Otherwise, RE is an active low input, DE is active high. It looks like the intention is to tie them together and switch the direction with as single signal only.

  • I put the transistor because I need to be able to put RE low to receive through MAX3485 which is half duplex. Is that correct, then with the LoPy GPIO is at 1, RE is at 0 and with the GPIO is at 0, RE is at 1 ?

  • @bnjroos According to the datasheet, the max logic input current is 2 µA. To maintain a high level of 2V, you need a resistor of less than 650k ((3.3-2)V/2µA).
    But: you do not need the transistor (which acts a inverter) for that purpose, if you do not need that anyhow, since it does not solve the problem of the floating GPIO. At least, I would add a large resistor (> 220k ) between the transistors Base and GND to ensure it is off when GPIO is unkown.

  • Well, I would need to use a pullup resistor and NPN transistor with a resistor to the LoPy GPIO like the following diagram isn't it ?

    Any idea of the value to use for the pullup resistor (rule of thumbs is at least 10 times smaller than the input pin impedance but I have no idea of the input pin impedance)?

  • Did you try external pull resistors?

  • I have the same kind of question, my LoPy with deep sleep shield/expansion board is wired to a MAX3485 module and iIwould like to put it in shutdown mode during deep sleep.
    This can be achieved by putting one of the module pin high and another down however from what I read from this post this cannot be done as the ESP32 is totally shutdown.

    Someone has a solution for this ? TIA

  • If you're using the OEM modules, then you should be able to use the ESP32's deep sleep, not the Deep Sleep Shield/Pysense/Pytrack deep sleep.

    The latter powers down completely the ESP32, the former keeps some bits awake (RTC, ULP...).

    I believe some pins can keep their pull-ups/pull-downs in that state while others can't. You'll probably have to check the ESP32 data sheet for details.

  • @jcaron I am interested mainly in OEM modules and custom "carrier" board, but as your are saying the ESP32 is completely powered down during deep sleep. The pins may be left floating as well. I will use external pull resistor just to be sure.

  • @danielm If you mean the deep sleep as controlled by the Deep Sleep Shield, Pysense or Pytrack, as far as I know, no. During deep sleep the ESP32 is completely powered down, and most pins look more like they're connected to ground (not directly, but close) than anything else.

    I only tested with pin P9 (as it's the only one going to the external I/O header and the PIC on the Pysense usable for wake-on-pin) and it was really a nightmare (but I'm no EE). I ended up cutting the pin so that it's only connected from the I/O header to the PIC to avoid interference from the ESP32 during sleep (and even more importantly, during the shutdown and wake up phases).

Log in to reply

Pycom on Twitter