Teensy
- Registry:
- Configuration:
platform =
platformio/teensy
Teensy is a complete USB-based microcontroller development system, in a very small footprint, capable of implementing many types of projects. All programming is done via the USB port. No special programmer is needed, only a standard USB cable and a PC or Macintosh with a USB port.
For more detailed information please visit vendor site.
Configuration
Optimization
(valid only for Teensy LC, Teensy 3.0-3.6)
You can control firmware optimization via special macro/define using build_flags in “platformio.ini” (Project Configuration File):
-D TEENSY_OPT_FASTER
, default-D TEENSY_OPT_FASTER_LTO
-D TEENSY_OPT_FAST
-D TEENSY_OPT_FAST_LTO
-D TEENSY_OPT_FASTEST
-D TEENSY_OPT_FASTEST_LTO
-D TEENSY_OPT_FASTEST_PURE_CODE
, valid only for Teensy 3.5-3.6-D TEENSY_OPT_FASTEST_PURE_CODE_LTO
, valid only for Teensy 3.5-3.6-D TEENSY_OPT_DEBUG
-D TEENSY_OPT_DEBUG_LTO
-D TEENSY_OPT_SMALLEST_CODE
-D TEENSY_OPT_SMALLEST_CODE_LTO
The only one macro can be used in per one build environment. Also, you can see
verbose build using -v, --verbose
option for pio run command.
Example:
Let’s set optimization for the smallest code
[env:teensy_hid_device]
platform = teensy
framework = arduino
board = teensy36
build_flags = -D TEENSY_OPT_SMALLEST_CODE
USB Features
If you want to use Teensy USB Features, you need to add special macro/define using build_flags:
-D USB_SERIAL
-D USB_KEYBOARDONLY
-D USB_TOUCHSCREEN
-D USB_HID_TOUCHSCREEN
-D USB_HID
-D USB_SERIAL_HID
-D USB_MIDI
-D USB_MIDI4
-D USB_MIDI16
-D USB_MIDI_SERIAL
-D USB_MIDI4_SERIAL
-D USB_MIDI16_SERIAL
-D USB_AUDIO
-D USB_MIDI_AUDIO_SERIAL
-D USB_MIDI16_AUDIO_SERIAL
-D USB_MTPDISK
-D USB_RAWHID
-D USB_FLIGHTSIM
-D USB_FLIGHTSIM_JOYSTICK
-D USB_EVERYTHING
-D USB_DISABLED
A default macro is set to -D USB_SERIAL
if no one is specified.
Example:
[env:teensy_hid_device]
platform = teensy
framework = arduino
board = teensy20
build_flags = -D USB_RAWHID
See Teensy USB Examples.
Uploading using CLI
By default the Teensy platform uses the graphical version of the Teensy upload tools. For cases where the GUI tools cannot be used (e.g. headless OS) the native Teensy Loader tool is also available in a command line version which can be enabled directly in your project configuration, for example:
[env:teensy36]
platform = teensy
framework = arduino
board = teensy36
upload_protocol = teensy-cli
Examples
Examples are listed from Teensy development platform repository:
Debugging
Debugging - “1-click” solution for debugging with a zero configuration.
Tools & Debug Probes
Supported debugging tools are listed in “Debug” column. For more detailed information, please scroll table by horizontal. You can switch between debugging Tools & Debug Probes using debug_tool option in “platformio.ini” (Project Configuration File).
Warning
You will need to install debug tool drivers depending on your system. Please click on compatible debug tool below for the further instructions.
External Debug Tools
Boards listed below are compatible with Debugging but DEPEND ON external debug probe. They ARE NOT READY for debugging. Please click on board name for the further details.
Name |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|
IMXRT1062 |
600MHz |
7.75MB |
512KB |
|
MK20DX256 |
72MHz |
256KB |
64KB |
|
MK64FX512 |
120MHz |
512KB |
255.99KB |
|
MK66FX1M0 |
180MHz |
1MB |
256KB |
|
IMXRT1062 |
600MHz |
1.94MB |
512KB |
|
IMXRT1062 |
600MHz |
7.75MB |
512KB |
|
MKL26Z64 |
48MHz |
62KB |
8KB |
Stable and upstream versions
You can switch between stable releases of Teensy development platform and the latest upstream version using platform option in “platformio.ini” (Project Configuration File) as described below.
Stable
; Latest stable version, NOT recommended
; Pin the version as shown below
[env:latest_stable]
platform = teensy
board = ...
; Specific version
[env:custom_stable]
platform = teensy@x.y.z
board = ...
Upstream
[env:upstream_develop]
platform = https://github.com/platformio/platform-teensy.git
board = ...
Packages
Name |
Description |
---|---|
Arduino Wiring-based Framework for Teensy boards |
|
Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures |
|
CMake is an open-source, cross-platform family of tools designed to build, test and package software. |
|
Device tree compiler |
|
GNU gperf is a perfect hash function generator |
|
Software and Documentation Pack for SEGGER J-Link debug probes |
|
Ninja is a small build system with a focus on speed |
|
Upload tools for Teensy boards |
|
GCC Toolchain for Microchip AVR microcontrollers |
|
GNU toolchain for Arm Cortex-M and Cortex-R processors |
|
GNU toolchain for Teensy boards based on Arm Cortex-M |
Warning
Linux Users:
Install “udev” rules 99-platformio-udev.rules
Raspberry Pi users, please read this article Enable serial port on Raspberry Pi.
Windows Users:
Teensy programming uses only Windows built-in HID drivers. When Teensy is programmed to act as a USB Serial device, Windows XP, Vista, 7 and 8 require this serial driver is needed to access the COM port your program uses. No special driver installation is necessary on Windows 10.
Frameworks
Name |
Description |
---|---|
Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences. |
|
Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures |
Boards
Note
You can list pre-configured boards by pio boards command
For more detailed
board
information please scroll the tables below by horizontally.
SparkFun
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
External |
IMXRT1062 |
600MHz |
7.75MB |
512KB |
Teensy
Name |
Debug |
MCU |
Frequency |
Flash |
RAM |
---|---|---|---|---|---|
No |
ATMEGA32U4 |
16MHz |
31.50KB |
2.50KB |
|
No |
MK20DX128 |
48MHz |
128KB |
16KB |
|
External |
MK20DX256 |
72MHz |
256KB |
64KB |
|
External |
MK64FX512 |
120MHz |
512KB |
255.99KB |
|
External |
MK66FX1M0 |
180MHz |
1MB |
256KB |
|
External |
IMXRT1062 |
600MHz |
1.94MB |
512KB |
|
External |
IMXRT1062 |
600MHz |
7.75MB |
512KB |
|
External |
MKL26Z64 |
48MHz |
62KB |
8KB |
|
No |
AT90USB1286 |
16MHz |
127KB |
8KB |