Robohouse ’26 Library
Contents

Chapter 1

What a Teensy 4.1 actually is

4 sections · about 6 minutes

1.1 The chip underneath

The Teensy 4.1 is a small development board built around a single NXP microcontroller, the i.MX RT1062. Understanding that chip is most of understanding the board, because almost everything surprising about the Teensy — the odd memory layout, the enormous number of serial ports, the way it boots — comes directly from the silicon rather than from anything PJRC added.

The i.MX RT1062 belongs to a family NXP calls "crossover" processors. The idea behind that name is that it sits between two worlds. On one side you have conventional microcontrollers: they run at tens or low hundreds of megahertz, they execute code directly out of on-chip flash, they boot instantly, and they behave deterministically. On the other side you have applications processors of the sort you find in a phone or a Raspberry Pi: they run at a gigahertz or more, they have caches and external memory, and they generally run a full operating system. The crossover parts take the fast core and the caches from the applications-processor world, and combine them with the instant boot, the hard real-time determinism, and the rich peripheral set of the microcontroller world.

Concretely, the RT1062 is an ARM Cortex-M7 running at 600 MHz, and the clock rate is only part of why it is quick. The M7 is superscalar, meaning it has two instruction pipelines and can retire up to two instructions per clock cycle when the code allows it. It has a six-stage pipeline with branch prediction, a proper hardware floating-point unit that handles both single and double precision, and the ARM DSP instruction set extension for saturating and SIMD-style integer arithmetic. In practical terms it will chew through the trigonometry in an inverse-kinematics solution without you having to think about it. A full six-axis IK solve using double-precision atan2 and sqrt lands comfortably in the tens of microseconds, which means you could run it thousands of times a second if you wanted to.

This changes how you write the firmware. On an 8-bit AVR or even a 72 MHz STM32F1, you spend a lot of design effort avoiding floating point and pre-computing tables. On the Teensy 4.1 you can write the maths the way it appears in the textbook, in float or even double, and it will be fast enough. Take advantage of that rather than optimising ahead of any measurement.

1.2 The board around the chip

PJRC surrounds that processor with a fairly minimal but very well-chosen set of support hardware. There is 8 MB of QSPI flash on board for your program, of which just under 8 MB is available to you — an amount that is difficult to fill with hand-written firmware. There is a microSD socket wired to the SDIO peripheral in 4-bit mode, which is fast — not the bit-banged SPI arrangement you find on cheaper boards. There is a 10/100 Ethernet MAC brought out to a set of pads (you supply the magjack). There are USB host pins, so the Teensy can act as a USB host and talk to keyboards, or to another microcontroller. And there are two footprints on the underside of the board for extra QSPI chips: you can solder on additional flash, or PSRAM, or one of each.

Electrically, the board runs at 3.3 volts, and the pins are not 5 volt tolerant. Putting 5 V on a Teensy 4.x input pin is a reliable way to destroy that pin, and sometimes the chip. That matters here because a great many stepper driver breakout boards, limit switch boards, and cheap optical endstops are designed around 5 V logic. Every one of those needs either a level shifter, a resistive divider, or an open-collector arrangement with the pull-up going to 3.3 V rather than 5 V. It is worth asking what voltage a thing actually drives before you connect it.

The output drive is also modest. A Teensy 4.x pin sources or sinks a few milliamps comfortably — around 4 mA in the default pad configuration, and the pad drive strength can be increased in the register settings, but treat something like 10 mA as a practical ceiling per pin and keep the total across the chip well below its absolute maximum. That is plenty for the STEP, DIR, and EN inputs of a TMC2209, which are high-impedance CMOS inputs drawing essentially no current. It is not enough for a relay coil, a solenoid, or a brake. Anything with a coil in it gets a transistor and a flyback diode.

Power comes in over USB or over the VIN pin, which accepts roughly 3.6 to 5.5 V. The board draws on the order of 100 mA at full speed. One detail catches people out: the Teensy 4.1 ships with a solder pad between VUSB and VIN that is bridged by default. If you intend to power the board from an external 5 V supply while also having USB plugged in for programming and debugging — which you will, constantly, during development — cut that trace. Otherwise your bench supply's 5 V rail is tied straight to your computer's USB 5 V rail, which at best does nothing and at worst damages a USB port.

1.3 The peripheral set, and what you will actually use

The RT1062 has far more peripherals than any one project needs. The subset that matters for a six-axis stepper-driven arm is as follows.

For digital I/O, you have 55 usable pins, of which 42 are on the outer edges and breadboard-friendly; the rest are on the underside pads. A six-axis arm with STEP, DIR, and a shared enable, plus six DIAG lines, plus six limit switches, plus a UART pair for the drivers, comes to well under half of that. Since you will not run out of pins, you can afford to give each driver its own DIAG input rather than wire-OR-ing them.

For timing, there are four FlexPWM modules, each with three submodules; four QuadTimer modules with four channels each; four Periodic Interrupt Timers; and two General Purpose Timers. Chapter 3 is about how to spend all of that.

For serial, there are eight hardware UARTs (Serial1 through Serial8), three SPI buses, three I²C buses, two CAN 2.0B controllers plus one CAN-FD controller, and the native high-speed USB. Chapter 4 covers these.

For feedback, there are four hardware quadrature decoder units, which can count encoder pulses entirely in hardware without troubling the CPU. If you ever move the VCP6 from open-loop steppers to closed-loop with encoders on the joints, this is what you will use, so leave the right pins free now.

For analogue, there are two ADCs covering 18 input pins, with 12-bit resolution available. Useful for reading a potentiometer-based teach pendant, monitoring supply voltage, or reading a current-sense output.

And underpinning all of it, a 32-channel DMA controller. DMA lets a peripheral move data to or from memory without the CPU being involved at all. For stepper control that is what keeps the step train steady while the USB link is busy.

1.4 Clocking and overclocking

The 600 MHz figure is the default, not a limit. The Teensyduino tools menu lets you select clock speeds from 24 MHz up to 1 GHz. Running above 600 MHz requires attention to cooling — the little chip will happily throttle or misbehave when hot, and PJRC sell a heatsink kit for exactly this reason.

For a robot arm, my advice is to leave it at 600 MHz. You will not be compute-bound. What you will be is timing-bound, and a stable, well-characterised clock is worth more than headline speed. If you ever find yourself wanting to overclock to make the motion planner keep up, the correct fix is almost always to restructure the planner rather than to raise the clock.

One clocking detail does matter: the RT1062's clock tree is complex, with multiple PLLs feeding different peripheral groups, and some peripherals derive their clocks from sources you might not expect. When you compute a timer period or a UART baud divisor by hand, always confirm which clock actually feeds that peripheral rather than assuming it is the core clock. The Teensyduino core handles this for you in the standard APIs; it becomes your problem only when you drop to bare registers.