About Teensy 4.0

Sunday, November 8, 2020

Teensy 4.0

t f B! P L

About Teensy 4.0

Teensy 4.0 is a compact, high-performance Arduino-compatible board released by PJRC. Despite its extremely small size (approximately 36mm x 18mm), it offers outstanding performance that stands well above other Arduino-compatible boards.

Teensy 4.0
Teensy 4.0

The board comes with a pinout reference card included in the package.
Teensy 4.0 Package
Teensy 4.0 Package

Teensy 4.0 Specifications

As shown in the comparison below, both the CPU frequency and Flash/SRAM capacity are very impressive.

ModuleSoCCPUFlashSRAM
ESP32-WROOM-32Espressif ESP32‑D0WDQ6Xtensa LX6 240MHz Dual Core4MB512KB
Sipeed
Longan Nano
GigaDevice GD32VF103CBT6RISC-V 108MHz128KB32KB
Teensy 4.0NXP IMXRT1062ARM Cortex-M7 600 MHz1.94MB512KB

For more details, please refer to the official product page. A notable feature that distinguishes Teensy 4.0 from other boards is its SD card interface, which uses SDIO (4-bit) instead of the typical SPI connection.

Arduino Environment

To use Teensy with the Arduino environment, you need to install Teensyduino.
Follow the instructions on the Teensyduino download page.
Note that there are restrictions on the supported Arduino versions. In my case, version 1.8.10 was not supported, so I updated to version 1.8.12.
The library location in the Arduino environment is:
  • C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries

For example, the Arduino setup() and loop() functions are defined in:
  • C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\main.cpp
Pin definitions can be found at:
  • C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4\pins_arduino.h

The CPU speed can be configured via Tools -> CPU Speed in the Arduino IDE.
CPU Speed Configuration
CPU Speed Configuration

VS Code - PlatformIO Environment


For larger projects, the Arduino environment can become cumbersome. In such cases, you can use the Visual Studio Code - PlatformIO environment instead.
Please refer to the PlatformIO documentation for setup instructions.
Note that Teensyduino must also be installed when using the VS Code - PlatformIO environment.

The PlatformIO project structure can be set up by referring to the examples folder in platformio/platform-teensy (GitHub).

With the VS Code - PlatformIO environment, you will also primarily build using the Arduino framework.
On Windows, the library locations are as follows:
  • %USERNAME%\.platformio\packages\framework-arduinoteensy
  • %USERNAME%\.platformio\packages\framework-arduinoteensy\cores\teensy4
  • %USERNAME%\.platformio\platforms\teensy

The CPU frequency can be configured in the platformio.ini file of each project.
[env:teensy40]
platform = teensy
framework = arduino
board = teensy40 

upload_protocol = teensy-gui

board_build.f_cpu = 600000000L

Additional Resources







About Me

My photo
Electronics, programming & audio

Featured Post

Synchronizing Radio-Controlled Clocks with Raspberry Pi Pico W (JJY Standard Radio Wave Emulator)

As a Raspberry Pi Pico W application, I built a JJY emulator for radio-controlled clocks (for time synchronization) with minimal peripheral...

QooQ