Setup Teensy SDK on Ubuntu

Teensy is a powerful and fast prototyping family of boards that follows the Arduino philosophy “Easy to mount, cheap to produce”. Developed and sold by PJRC, these devices are particularly used in audio applications thanks to their computing capabilities. The most powerful board is Teensy 3.6 that is equipped with an ARM Cortex-M4F CPU with Floating Point Unit (FPU). These boards are programmed using the Arduino environment. I will explain, step by step, how to configure all the development toolkit. We need just an Internet connection (that you should have since you are reading this web page) and a Teensy Board. I will use a Teensy 3.6 but everything should be adaptable to other devices. So, let’s start!

  1. First, we have to download the Arduino IDE from the official repository, go to and download the version 1.8.5 of the Arduino IDE. You should download this specific version since it is fully compatible with Teensy Libs. Once downloaded, extract the tarball and run the file. Wait until it finishes and then move to the next step. I installed the environment in a fonder on my desktop.
  2. Now, download the Teensyduino library from Here, this adds support for Teensy boards within the Arduino IDE. The current version is 1.42. Execute the downloaded file, then select the Arduino root directory (the folder that contains the Arduino IDE, for me it is on my desktop) and confirm the installation.
  3. Once the setup is completed, you have to give the access to serial interfaces even to non-sudo users, so create a file called 49-teensy.rule in the /etc/udev/rules.d/ directory. Such file has to contain the following text
    # UDEV Rules for Teensy boards,
    # The latest version of this file may be found at:
    # This file must be placed at:
    # /etc/udev/rules.d/49-teensy.rules    (preferred location)
    #   or
    # /lib/udev/rules.d/49-teensy.rules    (req'd on some broken systems)
    # To install, type this command in a terminal:
    #   sudo cp 49-teensy.rules /etc/udev/rules.d/49-teensy.rules
    # Or use the alternate way (from this forum message) to download and install:
    # After this file is installed, physically unplug and reconnect Teensy.
    ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1"
    ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1"
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666"
    KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666"
    # If you share your linux system with other users, or just don't like the
    # idea of write permission for everybody, you can replace MODE:="0666" with
    # OWNER:="yourusername" to create the device owned by you, or with
    # GROUP:="somegroupname" and mange access using standard unix groups.
    # If using USB Serial you get a new device each time (Ubuntu 9.10)
    # eg: /dev/ttyACM0, ttyACM1, ttyACM2, ttyACM3, ttyACM4, etc
    #    apt-get remove --purge modemmanager     (reboot may be necessary)
    # Older modem proding (eg, Ubuntu 9.04) caused very slow serial device detection.
    # To fix, add this near top of /lib/udev/rules.d/77-nm-probe-modem-capabilities.rules
    #   SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", GOTO="nm_modem_probe_end"
  4. Now, we have to update the CMSIS library within the Teensy SDK. So,
    1. Download  the CMSIS 4.5.0 library form Here as a zip file
    2. Extract all files and copy arm_common_tables.h, arm_const_structs.h and arm_math.h from the unzipped subdirectory /CMSIS/Include to ARDUINO_ROOT/hardware/teensy/avr/cores/teensy3
    3. Open the just copied arm_math.h file and make these changes
      #include <stdint.h>
      #define __ASM __asm
      #define __INLINE inline
      #define __STATIC_INLINE static inline
      #define __CORTEX_M 4
      #define __FPU_USED 1
      #define ARM_MATH_CM4
      #include "core_cmInstr.h"
      #include "core_cm4_simd.h"
      comment out:
      #if defined(ARM_MATH_CM7)
      #include "core_cm7.h"
      #elif defined (ARM_MATH_CM4)
      #include "core_cm4.h"
      #elif defined (ARM_MATH_CM3)
      #include "core_cm3.h"
      #elif defined (ARM_MATH_CM0)
      #include "core_cm0.h"
      #define ARM_MATH_CM0_FAMILY
      #elif defined (ARM_MATH_CM0PLUS)
      #include "core_cm0plus.h"
      #define ARM_MATH_CM0_FAMILY
      #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0"
      #undef __CMSIS_GENERIC /*enable NVIC and Systick functions*
    4. Copy these two files, libarm_cortexM4l_math.a and libarm_cortexM4lf_math.a, from the folder CMSIS/Lib/GCC to /ARDUINO_ROOT/hardware/tools/arm/arm-none-eabi/lib/
  5. This step install the OpenAudio library within the Teensy SDK. Download the OpenAudio library from Here and unzip it in the /ARDUINO_ROOT/libraries directory. The name of the library directory should be OpenAudio_ArduinoLibrary.
  6. Now, open  the Arduino IDE and you can find many examples under File->Examples. Connect your Teensy to usb port and use it like an Arduino.

Happy Coding!

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *