Teensy 4.0 freezes using Snooze and EEPROM.put

Status
Not open for further replies.

clovehitch

New member
I'm trying to use Snooze to drop the Teensy power usage. I only need the device to "turn on" every 10 minutes to log it's current GPS location. I'm not seeing much drop in mA when in sleep mode. It's hanging around 100mA. It will bounce up when it wakes up to get the GPS data (150mA). I was hoping to get it lower than 100mA. Anyway, that's not the main issue. Once it wakes up and gets the GPS data, it will right it to the eeprom. I'm using the built in LED to track this and once it writes to the eeprom the LED should turn off, but it doesn't.

Here is what I'm working with:

Code:
#include <TinyGPS.h>
#include <EEPROM.h>
#include <Snooze.h>

TinyGPS gps;

int eeAddress = 0;
struct GPScord {
  float flat;
  float flon;
};

SnoozeDigital digital;
SnoozeTimer timer;
SnoozeUSBSerial usb;
SnoozeAlarm  alarm;

#if defined(__MKL26Z64__)
Snoozelc5vBuffer  lc5vBuffer;
#endif

#if defined(__IMXRT1062__)
SnoozeBlock config_teensy40(usb, digital, alarm);
#endif


void setup(){
  Serial.end();
  pinMode(LED_BUILTIN, OUTPUT);
  #if !defined(__MKL26Z64__)
  alarm.setRtcTimer(0, 0, 10);// hour, min, sec
  #endif

  while (eeAddress < 1060) {
    int who;
    
    #if defined(__IMXRT1062__)
    who = Snooze.sleep( config_teensy40 );
    #endif
    
    if (who == 35) { // rtc wakeup value 
      float flat, flon;
      delay(5000);
      gps.f_get_position(&flat, &flon);
      GPScord GPSvar = {flat, flon};
      eeAddress += sizeof(GPSvar);
  
      digitalWrite(LED_BUILTIN, HIGH);
      EEPROM.put(eeAddress, GPSvar);
      delay(500);                  
      digitalWrite(LED_BUILTIN, LOW);
      delay(500); 
      }
    }
}
void loop() {
}

I mostly just work with python so maybe I'm missing something simple? Any help would be appreciated.
 
I'm kind of stuck on this and I'm not sure where else to post this question. If I can provide some more details to help someone help me, please let me know.
 
Hi,

I don't claim to re any sort of expert but I see a number of possible problems.

You have setup snooze to use digital and alarm - you have not used any digital input to wake up, so take the digital out from the snoozeblock setup. You are using alarm, which uses the rtc, but have not setup rtc anywhere.

You seem to want to wake up every 10 seconds, so why not use timer to do that?

timer.setTimer(10);// milliseconds - Seconds in Teensy4
SnoozeBlock config_teensy40(usb, timer);

I have used that and it worked fine. It may be that the GPS library is killing it.
Try your code without the GPS and see if it works. Then put GPS in and see if it still works. If not GPS library is somehow killing the snooze library.
 
I have confirmed that the Snooze Library Kills the EEProm library.
Have raised the issue in "Suggestions and Bug Reports"
 
Does it fail with deepSleep or hibernate too? Low power in the Teensy 4.0 is much more complicated than T3.x's, so getting Snooze to be solid for the 4.0 is going to take some more work on my end. As far as why the EEPROM is failing I have know idea at the moment but I'll figure something out.
 
Both sleep and deepSleep fail. Have not tried hibernate as it does a reset each time which is not useful.
 
Hi Duff, hope you and your family are well.
I have posted a sample prog which demonstrates the problem under "suggestions and .....".
 
Status
Not open for further replies.
Back
Top