Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Current leakage on serial input pins when snoozing (hibernate)

  1. #1
    Junior Member
    Join Date
    Aug 2018
    Posts
    15

    Current leakage on serial input pins when snoozing (hibernate)

    I have a Teensy 3.2 application that reads a sensor for 5 seconds and then hibernates (snooze library) for 2 minutes, then repeats. Since it is battery powered current consumption during snooze is a key factor. The sensor is powered off during the hibernate period by use of a MOSFET switch (Fairchild FPF2124) driven by a Teensy digital I/O pin.

    The sensor is a simple serial devices that sends at 9600 baud on serial pin RX1 (it does not receive data).

    With the sensor serial line disconnected from the Teensy, the system consumes 50uA in hibernate. But when the serial RX line is attached to the (powered off) sensor, current consumption goes up to 260uA. My conclusion is that there is a leakage current from the RX pin to ground through the sensor. Seems like an input pin should be high impedance and not have this kind of leakage, but maybe something changes in hibernate mode? Eventually there will be multiple sensors, so this leakage will significantly affect battery life.

    I notice that digital input pins have a INPUT_DISABLE state, but not sure that can be used on pins used for serial I/O.

    Any ideas how to eliminate this leakage current?

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,454
    I presume the serial pin has pullups enabled as high is the idle state for TTL serial lines. Try turning off the pull up
    for hibernation. The powered down sensor will pull the pin low while its powered down.

  3. #3
    Junior Member
    Join Date
    Aug 2018
    Posts
    15
    OK, with some experimentation I was able to go from 800uA during sleep for a full system of sensors, to only 59uA. A huge improvement.

    A few things I learned along the way...

    1. Pins used as serial ports need to be disabled before sleep, but cannot just be re-enabled as INPUT_PULLUP after wakeup. I think pinMode() steals the pin from the UART. The serial port must be re-initialized after wakeup.
    2. Digital inputs AND outputs should be put to INPUT_DISABLED mode before entering sleep. Both INPUT and OUTPUT mode pins can leak current.

    Something like this:

    Code:
        // Make all io high impedance
        pinMode(9, INPUT_DISABLE); // RX2
        pinMode(0, INPUT_DISABLE); // RX1
        pinMode(1, INPUT_DISABLE); // TX1
        pinMode(10, INPUT_DISABLE); // TX1
        pinMode(DOUT_SENSOR_STOP, INPUT_DISABLE);
        pinMode(DOUT_RADIO_SET, INPUT_DISABLE);
    
        Snooze.hibernate(config); // Low power sleep
    
        // Reconfigure io for normal operation, including serial port pins
        pinMode(DOUT_SENSOR_STOP, OUTPUT);
        pinMode(DOUT_RADIO_SET, OUTPUT);
        Serial.begin(9600...); 
        Serial1.begin(9600...);

  4. #4
    Quote Originally Posted by ct1 View Post
    1. Pins used as serial ports need to be disabled before sleep, but cannot just be re-enabled as INPUT_PULLUP after wakeup. I think pinMode() steals the pin from the UART. The serial port must be re-initialized after wakeup.
    2. Digital inputs AND outputs should be put to INPUT_DISABLED mode before entering sleep. Both INPUT and OUTPUT mode pins can leak current.
    Very useful info. Thanks for documenting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •