BriComp
Well-known member
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).
instead of
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.
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.
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)
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
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);
}
}
}