Teensy 4.0 and 4.1

The Teensy 4.0 and 4.1 are very compact boards developed by Paul Stoffregen, based on the NXP iMXRT1062 ARM M7 processor running at 600 MHz and with 1 Mbytes of RAM.

The Teensy RAM is divided into two blocks, and uLisp has access to an entire block for its workspace, providing 60000 objects.

These are now the fastest boards for running uLisp. In addition, for speed-critical tasks you can incorporate functions written in ARM machine code using the ARM assembler written in Lisp; see ARM assembler overview.

Teensy 4.0

The Teensy 4.0 board is 1.4" x 0.7". It has 2 Mbytes of flash memory:


It's available directly from PJRC [1], or from Adafruit [2] or its distributors such as Pimoroni in the UK [3].

Teensy 4.1

The Teensy 4.1 board is 2.4" x 0.7". It has 8 Mbytes of flash memory and includes a micro SD socket:


It's available directly from PJRC [4], or from Adafruit [5] or its distributors such as Pimoroni in the UK [6].

Installing uLisp on the Teensy 4.0/4.1

You can install the ARM Version 3.3a or later of uLisp on a Teensy 4.0/4.1.

Support for the Teensy boards requires more customization than is currently available from the Arduino's Boards Manager, so Paul decided to provide a Teensyduino installer that upgrades your copy of the Arduino IDE to provide the necessary Teensy support. The main upgrades affect the Serial Monitor, to support the many non-Serial protocols the Teensy boards support in the USB Type submenu on the Tools menu, and to optimise its performance to allow sustained high transmission rates without the Arduino IDE locking up.

For Windows or Linux PJRC the Teensyduino installer patches your resident copy of the Arduino application to work with the Teensy boards.

For Mac OS 10.10 onwards PJRC provides a complete version of the Arduino IDE (currently 1.8.12) with the Teensy support already added, so no patching is necessary. You can use this to work with Teensy boards, as well as continuing to use it instead of the original Arduino application with your other boards.

To download Teensyduino, and for information about using the Teensy boards with the Arduino IDE, see Download Teensyduino on the PJRC site.

Common features


The Teensy 4.0 and 4.1 boards provide two SPI ports accessible from uLisp, SPI, and SPI1.

You can use SPI1 using the sixth port parameter to with-spi:

(with-spi (str 10 4000 1 0 1)
  (write-byte #xAA str))


The Teensy 4.0 and 4.1 boards provide four serial ports accessible from uLisp, Serial, Serial1, Serial2, and Serial3.

The serial interface works with the following pins on the two boards:

Platform Port 0 (RX, TX) Port 1 (RX, TX) Port 2 (RX, TX) Port 3 (RX, TX)
Teensy 4.0 USB 0, 1 7, 8 15, 14
Teensy 4.1 USB 0, 1 7, 8 15, 14


The Teensy 4.0 and 4.1 boards provide one I2C port accessible from uLisp on 18 (SDA) and 19 (SCL).


The Teensy 4.0 and 4.1 boards provide a red LED on pin 13 which you can flash with the following program:

(defun blink (&optional x)
  (pinmode 13 t)
  (digitalwrite 13 x)
  (delay 1000)
  (blink (not x)))

Run it by typing:


Pin 13 can also be used as an analogue pin, so you can pulsate the red LED slowly on and off with the program:

(defun pulse ()
  (let (down)
     (dotimes (x 256) 
       (delay 5) 
       (analogwrite 13 (if down (- 255 x) x)))
     (setq down (not down)))))

Run it by typing:


Exit from either program by entering ~.

Other features

Both boards have many other features not currently supported by uLisp, including: an Ethernet interface (Teensy 4.1 only), a USB host interface allowing you to connect a USB keyboard, three CAN Bus ports, an I2S Digital Audio interface, an S/PDIF Digital Audio interface, cryptographic acceleration, a random number generator, and an RTC for date/time.


The quality of the boards is impressive; Paul Stoffregen described the specification on the PJRC forum as follows:

"The processor chip is a BGA part with 196 pads and 0.65mm pitch, and the boards use a 6 layer PCB, where the top layer has 4 mil traces and 4.4 mil spacing in the BGA area, and 5/5 trace/space outside the BGA and on all 5 other layers. Vias in the BGA are 8 mils, with a 4 mil ring on the top layer and 5 mil ring on all other layers. Vias on the rest of the board are 10 mils, with 5 mil rings on all layers."

  1. ^ Teensy 4.0 on PJRC.
  2. ^ PJRC Teensy 4.0 on Adafruit.
  3. ^ Teensy 4.0 on Pimoroni.
  4. ^ Teensy 4.1 on PJRC.
  5. ^ PJRC Teensy 4.1 on Adafruit.
  6. ^ Teensy 4.1 on Pimoroni.