Low Power Debugging

A project log for The Pi Watch

A watch with a Teensy 3.1 at it's heart. It's a Open Source development system that you can wear!

ipaq3115ipaq3115 12/29/2014 at 22:080 Comments

Fun fact: Because of the capacitive touch hardware in the chip that the Teensy 3.1 uses, all of the Pi touch pads go directly to pins on the microcontroller. This means their functions can be reconfigured on the fly!

In case you didn't know, the Teensy 3.1 has some great low power capabilities. Unfortunately USB is no longer an option under 24MHz. That means that if we wanted to put out debug info while running at 2MHz (and if you are switching between two clock speeds, and plan to remain sane, you are definitely going to want to put out debug) the only option is a UART. Thankfully there happens to be a UART brought out on two of the touch pads! There's also 4 PWM capable pins, an i2c port, 5 ADC pins and of course they are all GPIO pins that you could use for bitbanging SPI or the like. Here's the pinout.

Of course the whole reason for this is getting the low power stuff working. My first attempt was just a timeout before it goes into 2MHz mode and dims the backlight. This worked fine until I tried adding in clock updates so that it could keep writing the screen even in low power mode. In the end I found a few places (mostly in the Time library) relying on millis() which in turn relies on the CPU clock. Once I fixed those and few other bugs in my code it's running beautifully at 2Mhz on the clock screen. All of that should be up on my GitHub now for anyone who is curious.