First Experiment in Teensy Audio Foiled By CPU Instruction Set

The original line of Arduino boards are know for a lot of very flexible features that made them the champion of entry into physical computing. “Large storage space” is not one of those features, as the ATmega328P has only 32KB of flash. Plenty for blinking little LEDs and a great many other projects, severely limiting for anything that requires nontrivial amount of data.

One such class of projects is playing back digital audio samples. Simple sounds like tones, beeps, and bloops take little data, but recorded digital audio consumes a great many bytes. I was introduced to the Mozzi Arduino sound synthesis library via exposure to Emily’s projects. While the emphasis is on synthesis, it does have provision to handle sampled audio. However, due to the small flash storage, even with compression it could only handle short sounds.

Looking around for an upgrade, I remembered I have a Teensy LC OSH Park edition I had purchased alongside an OSH Park order years ago and thought it was worth an audio playback experiment. The CPU is much faster and it has almost double the flash storage. Exploring the Arduino-compatibility layer called Teensyduino, I see it offers a full analog audio API, complete with a graphical tool to help compose the tree of audio input/processing/output nodes. I was very impressed!

I decided to start small with just two nodes: sound is to be generated by playing from sampled audio data in memory, and sent to built-in DAC. Pressing “Export” generated the following boilerplate code:

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioPlayMemory playMem1; //xy=262,658
AudioOutputAnalog dac1; //xy=436,657
AudioConnection patchCord1(playMem1, dac1);
// GUItool: end automatically generated code

void setup() {
// put your setup code here, to run once:


void loop() {
// put your main code here, to run repeatedly:


Sadly, this code did not compile. Instead, I encountered this error:

/tmp/ccLBGUGU.s: Assembler messages:
/tmp/ccLBGUGU.s:291: Error: selected processor does not support `smull r0,ip,r3,r5' in Thumb mode
/tmp/ccLBGUGU.s:292: Error: shifts in CMP/MOV instructions are only supported in unified syntax -- `mov ip,ip,asl r6'
/tmp/ccLBGUGU.s:293: Error: unshifted register required -- `orr r0,ip,r0,lsr r7'

A web search on this error message indicated this is because the chip on Teensy LC does not support the instructions described in the error message, I’d need a Teensy 3 or 4. To test this hypothesis, I changed the compiler to target Teensy 3 instead of LC and hit “Verify” again. This time, it was successful. But I don’t have a Teensy 3 on hand, so I can’t actually run that code.

Given this limitation I’ll have to find some other project for my Teensy LC. In the meantime, I’ll drop back to the tried and true Arduino for my Mozzi exercise.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s