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

Thread: LC draws more current than 3.1 in Snooze modes, does not work on digital

  1. #1
    Senior Member
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    120

    LC draws more current than 3.1 in Snooze modes, does not work on digital

    Following on from my trials with the snooze library, I have just bought some LCs to see if they would of any use.
    Unfortunately I found that wakeup on digital pin (FALLING) does not work on the LC.

    I set up a test rig with a teensy feeding a "wakeup" pin on the teensy under test.
    The led pin was lit on the teensy under test when it came out of snooze.
    There are two snooze events set up to respond to, a 1 minute snooze or a pin input (FALLING) event.

    Teensy 4.0 took 7ms to wake up and Teensy 3.1 took 0.5ms. Teensy LC NEVER wakes from a pin input.

    As an aside I found that with my previous code I had been feeding Snooze with (LOW instead of FALLING).
    Code:
    snoozeDigital.pinMode(ipPin, INPUT_PULLUP, LOW)
    instead of
    Code:
    snoozeDigital.pinMode(ipPin, INPUT_PULLUP, FALLING)
    That might be why Snooze was occasionally waking up and reporting a -1 wakeup id.
    Peculiarly though it worked OK most of the time!!??

    I then proceeded to carry out some power consumption tests. The results are shown below.
    Code:
    	Hibernate       DeepSleep       Sleep
    LC	0.52ma		2.2ma		3.7ma
    3.1	0.33ma		0.64ma		3.2ma
    You can see that in all cases the LC consumes more power than a 3.1 in snooze mode.
    These results are from a new LC out of the package with no soldering
    having taken place.

    Below is the test code I have used for the tests above.

    Code:
    #include <Snooze.h>
    
    SnoozeDigital   snoozeDigital;
    SnoozeTimer     snoozeTimer;
    
    #if defined(__IMXRT1062__)
    SnoozeUSBSerial SerialUsb;
    #else
    #define SerialUsb Serial
    #endif
    
    #if defined(__IMXRT1062__)
    SnoozeBlock config_teensy40(SerialUsb, snoozeDigital, snoozeTimer ); //alarm);
    #elif defined(__MK64FX512__)
    #elif defined(__MK66FX1M0__)
    SnoozeBlock config_teensy36(snoozeDigital, snoozeTimer);
    SnoozeBlock config_teensy35(snoozeDigital, snoozeTimer);
    #elif defined(__MK20DX256__)
    SnoozeBlock config_teensy32(snoozeDigital, snoozeTimer);
    #elif defined(__MK20DX128__)
    SnoozeBlock config_teensy30(snoozeDigital, snoozeTimer);
    #elif defined(__MKL26Z64__)
    SnoozeBlock config_teensyLC(snoozeDigital, snoozeTimer);
    #endif
    
    
    int ipPin = 4;
    int opPin =13;
    int who = 0;
    
    void SetupSnooze(){
    #if defined(__IMXRT1062__)
        snoozeTimer.setTimer(60);// seconds
    #else
        snoozeTimer.setTimer(60000);// milliseconds
    #endif
        snoozeDigital.pinMode(ipPin, INPUT_PULLUP, FALLING);//pin, mode, type
    };   // SetupSnooze  
    
    void setup() {
    
      pinMode(ipPin,INPUT_PULLUP);
      pinMode(opPin,OUTPUT);
      
      SetupSnooze();
    
      BlinkLed(1);
      delay(5);
    }
    
    void BlinkLed( int numBlinks ){
        int n;
        for (n=0; n<numBlinks; n++){
            digitalWrite(opPin,HIGH);
            delay(200);
            digitalWrite(opPin,LOW);
            delay(200);
         }
        delay(2500);
    
    }
    
    void loop() {
         digitalWrite(opPin,LOW);
     
      // put your main code here, to run repeatedly:
    #if defined(__IMXRT1062__)
        who = Snooze.hibernate( config_teensy40 );// return module that woke processor
    #elif defined(__MK66FX1M0__)
        who = Snooze.hibernate( config_teensy36 );// return module that woke processor
    #elif defined(__MK64FX512__)
        who = Snooze.hibernate( config_teensy35 );// return module that woke processor
    #elif defined(__MK20DX256__)
        who = Snooze.hibernate( config_teensy32 );// return module that woke processor
    #elif defined(__MK20DX128__)
        who = Snooze.hibernate( config_teensy30 );// return module that woke processor
    #elif defined(__MKL26Z64__)
        who = Snooze.hibernate( config_teensyLC );// return module that woke processor
    #endif
        digitalWrite(opPin,HIGH);
        delay(5000);  
        while(1){
            if (who==-1) {
                BlinkLed(10);
            }
            else if (who==36) { //timer
                BlinkLed(1);
            }
            else if (who==4) {  // pin4
                BlinkLed(2);
            }
            else {
                BlinkLed(5);
            }
        }
    }

  2. #2
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    435
    Not sure why but I do get substantial lower current figures than you measured.
    LC DeepSleep: 0.191 mA,
    3.2 DeepSleep: 0.271 mA.
    See this thread.

    Paul

  3. #3
    Senior Member
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    120
    I was using pin 4 as a wake up, I see that that pin is not supported.
    I don't know if that affects the current draw. I will test it out.
    EDIT
    Now seeing 1.9ms and it sill does not wake up from a digital FALLING, now on pin 7.
    AAGH!!
    JUST REALISED MY CURRENT MEASURING ERROR.
    I have a battery holder which supplies the power to the Teensy. But this is after it has boosted
    the voltage from 4.??v up to 5v. So I am also recording the current drawn by the Boost circuit.

    This still does not account for the 3.1 taking less current. Perhaps the boost circuit is is more efficient
    for a higher supply current.

    I will have to isolate the BOOST circuit from the current measurement.
    I WILL BE BACK!!
    Last edited by BriComp; 11-12-2020 at 07:57 PM.

  4. #4
    Senior Member
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    120
    0.33ma in Hibernate from a 5v supply, 0.46ma when supplied with 3.1v.
    I don't understand it either!
    Last edited by BriComp; 11-12-2020 at 07:59 PM.

  5. #5
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    435
    Quote Originally Posted by BriComp View Post
    Now seeing 1.9ms and it sill does not wake up from a digital FALLING, now on pin 7.
    Pin 7 is not supported as wake-up pin on Teensy LC.

    0.33ma in Hibernate from a 5v supply, 0.46ma when supplied with 3.1v.
    That's indeed still high, forum member Manitou measured 4.1 uA when in hibernate.

    Could you try the exact same example code I used in message #18?

    Paul

  6. #6
    Senior Member
    Join Date
    Aug 2019
    Location
    southwest USA
    Posts
    124
    that hib current for tlc is way too high - should be a few ua

    there are several things that lower the hib current - most important is to set pin 17 or whichever is the
    "5v out" pin to be an output, then set it low.

  7. #7
    Senior Member
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    120
    Thanks PaulS pin 6 works fine waking it up. It's unfortunate Duffs documentation still incudes pin 7.
    Thanks analog&RFmodels: Setting pin 17 as you suggested reduced the current draw to 88ua with timer and digital included, about the same with just digital. may be 1ua lower.
    EDIT
    I had damaged the LC used for the first test just now. With a second new LC I just got 4.4ua with just digital and 4.5ua with timer and digital.

Posting Permissions

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