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

Thread: T4.0 Sleep modes

  1. #1
    Junior Member
    Join Date
    Oct 2018
    Posts
    9

    T4.0 Sleep modes

    Hi,
    I have a strange issue with the Snooze lib. I use Teensy 4.0, Arduino 1.8.13 and Teensyduino 1.53.
    When I use sleep mode, everything works fine. But with deepSleep, the Teensy reboot itself every-time it gets to the "Snooze.sleep( config );" line.
    Doesn't anyone ran into such issue before?
    Thanks in advanced!
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    139
    That's the way Teensy 4.0 works in DeepSleep at the moment. I don't know if it will change in the future.

  3. #3
    Senior Member
    Join Date
    Sep 2015
    Location
    Taiwan, Asai. (Traditional Chinese)
    Posts
    173
    Code:
    SnoozeUSBSerial usb;
    ...
    ...
    #if defined(__IMXRT1062__)
    SnoozeBlock config_teensy40(usb, digital, compare, alarm);
    Hi, I'm still testing too so I cannot give a concrete answer, but looking into the examples code above, its always has the object "SnoozeUSBSerial", not sure why
    and without it, the "deepsleep" seems to reboot my program too.
    it stops the reboot of deepsleep, not sure if it works correctly :P I only programming tested, hasn't solder any buttons for waking yet.
    However it didn't wake up with the timer object,
    It did woke up with my timer set to "timer.setTimer(5);", the number inside seemed to be seconds/not millis,
    I judge that by the USB device plug-in/out sound,
    but it didn't give any serial feedback after waking for my sleep/deepsleep or hibernate, even if its rebooting it should?
    so I guess it's not working yet :P

    I will test will pin button interrupt later

  4. #4
    Senior Member
    Join Date
    Sep 2015
    Location
    Taiwan, Asai. (Traditional Chinese)
    Posts
    173
    Code:
    SnoozeTimer timer;
    SnoozeUSBSerial usb;
    SnoozeBlock config_teensy2(usb,timer);

    Code:
     
       Serial.println("ready to sleep");
      timer.setTimer(2);
      Snooze.deepSleep( config_teensy2 );
      Serial.begin(115200);
      Serial.println("waked, good1.");
      delay(2000);
      timer.setTimer(4);
      Serial.flush();
      Snooze.sleep( config_teensy2 );
      Serial.begin(115200);
      timer.setTimer(8);
      Serial.println("waked, good2.");
      delay(4000);
      Serial.flush();
      Snooze.hibernate( config_teensy2 );
      Serial.begin(115200);
      Serial.println("waked, good3.");
      delay(4000);
      Serial.flush();
      timer.setTimer(2);
      Snooze.deepSleep( config_teensy2 );
      //end of testing code
    okay,
    this is my code for test now, it gives sounds of USB plugging in correct timing and order before the hibernate waking( it gives wake/plug-in sound, but the next deepsleep is silent),
    so I assume it didn't reboot and did continued before hibernate
    the serial/USB is probably closed afterwards

    edit:
    also by my meter measurements, ( I compile at 150Hz)
    it draws 50mA, 20mA, 10mA, ~6mA at normal, sleep, deepsleep, hibernate, respectively.
    Last edited by Po Ting; 12-06-2020 at 11:06 PM. Reason: add edit;

  5. #5
    Senior Member
    Join Date
    Sep 2015
    Location
    Taiwan, Asai. (Traditional Chinese)
    Posts
    173
    tested with another example here using onboard LED for feed back
    Code:
    #include <Snooze.h>
    
    SnoozeBlock dummyConfig;
    SnoozeSPI sdCard;
    SnoozeDigital digital;
    SnoozeTimer timer;
    SnoozeUSBSerial usb;
    SnoozeBlock config_teensy2(usb, timer);
    SnoozeBlock config_teensy(usb, sdCard, digital);
    void setup() {
      // put your setup code here, to run once:
      pinMode(13, OUTPUT);
      flash(1);
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    
      timer.setTimer(2);
      delay(10);
      Snooze.sleep( config_teensy2 );
      flash(2);
      Snooze.deepSleep( config_teensy2 );
      flash(3);
      Snooze.hibernate( config_teensy2 );
      flash(4);
      timer.setTimer(2);
      Snooze.sleep( config_teensy2 );
      flash(5);
    }
    
    void flash(byte a) {
      for (byte b = 0; b < a; b++) {
        digitalWrite(13, HIGH);
        delay(500);
        digitalWrite(13, LOW);
        delay(500);
      }
    }
    compiled @600mhz
    now I see it'll flash 3 times and next wake will restart, not sure what prevent the teensy from reboot in my last example.
    also the current measures were near the same, but ~100mA when awaken

Posting Permissions

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