Issues using an E-paper display after waking Teensy 4.1 from sleep


New member
Hi there, I am working on a simple project that handles very basic event logging. We want this device to do the following:

  • Update an attached E-paper display with status (up or down) and the time stamp from the RTC. (Working when device is first programmed.)
  • Go to deep sleep after a set time period (I'm using 15 seconds in this code), and wake up on a button press (pin 2, active low). (Works reliably.)
  • Continue to print out status updates to E-paper after it has been woken up. (Does not work; crashes the program)

I've attached the source code I'm currently working with. Much of the fat has been trimmed since it's a fork of an implementation for a Mega 2560, and the goal is to reduce footprint and power consumption as much as possible. (I am kind of spamming the serial console for debugging purposes, so apologies in advance for that possible headache.) The display I'm using is a Waveshare 2.7" E-paper display that communicates via SPI0 (epdif.h contains the pin definitions). I am using pin 5 on the Teensy for the status pin, with a toggle switch to simulate a system "down" or "up" event (pull pin 5 to ground for a "down"); and pin 2 with a pushbutton (that pulls it to ground) to wake the CPU. When the device is first flashed, the loop code runs for 15 seconds, and using the mode switch to change status works normally, updates the E-paper, and prints the same message to the console. After the system sleeps and I wake it, however, toggling the pin 5 switch in either direction causes the program to crash. I have narrowed this down to any function call from the E-paper library, which is found in the attached ZIP file. The .ino file I'm calling these from is Display_E-paper.ino. If I comment these out in the code, it executes fine with no issues. I'm printing each function name in the console for debugging purposes as well.

It almost seems like the program is not re-allocating RAM properly after waking up, but I can't be too sure. Any advice or suggestions would be greatly helpful. I can provide a wiring diagram if needed. Thank you!


  • Dumb
    46.9 KB · Views: 30