Teensy LC not sleeping with SPI Flash

Status
Not open for further replies.

jacky4566

Well-known member
Ok I have lost about 6 hours of hair so i need to consult some outside help..

I am using a Teensy LC to do basic datalogging but i cant get the LC to sleep properly. The problem seems to be the inclusion of the SPI memory library.
If i comment out flash.begin(); and flash.powerDown(); I can get the proper uA sleep but otherwise it stays in high power.

Where should i start looking? Is it related to the SPI? Trying to trace the SPIMemory library hasnt really been fruitful yet.

I have ruled out the LIS3DH sensor so ignore that code. I am just setting it to full sleep mode.

Flash library:
https://github.com/Marzogh/SPIMemory

Code:
#include <Snooze.h>
#include <SPI.h>
#include <SPIMemory.h>
#include "LIS3DH.h"

static const int CSFLASHPIN = 23;
static const int CSMOTIONPIN = 9;

SnoozeTimer timer;
SnoozeUSBSerial usb;
SnoozeBlock config_teensyLC(usb, timer);

SPIFlash flash(CSFLASHPIN);
LIS3DH SensorLIS = LIS3DH(CSMOTIONPIN);

void setup() {
  SensorLIS.sampleRange = 4;
  SensorLIS.sampleMode = 10;
  SensorLIS.SampleRate = 0; //Sample rate 0 = sleep
  SensorLIS.begin();
  flash.begin();
  flash.powerDown();
}

void loop() {
  timer.setTimer(1000);// milliseconds
  Snooze.hibernate(config_teensyLC);
}
 
Status
Not open for further replies.
Back
Top