🛠 Premiers pas sur la Teensy 3.2 : Teensyduino, HalfKay et premier Blink
Objectives
Discover the Teensy 3.2, PJRC's (USA) most famous board: an NXP/Freescale MK20DX256VLH7 (ARM Cortex-M4 without hardware FPU) clocked at 72 MHz, officially overclockable to 96 MHz, with 256 KB of flash and 64 KB of RAM. This first tutorial sets up the environment — Arduino IDE + "Teensy boards" add-on — and uploads your first program, while understanding this board's unique programming architecture: the HalfKay bootloader lives in a physically separate chip (all main flash is free for your code and the bootloader cannot be destroyed by a failed flash), the program executes immediately upon power-up (no bootloader delay as on classic Arduinos), and flashing is driven by the Teensy Loader application, invoked automatically by the IDE.
Hardware
- 1 Teensy 3.2 board — note: discontinued / EOL board: the last batch sold in October 2023 ("It is a painful decision for us to discontinue Teensy 3.2 after 11 years… NXP… simply can't [help with chip supply]", PJRC shop page); limited restocks have occurred (e.g., July 7, 2025, and October 13, 2025, limit 5 pieces per person). Plan for spare parts or consider the Teensy 4.0 migration recommended by PJRC.
- 1 micro-USB DATA cable ("charge-only" cables are the #1 cause of undetected boards)
- PC, Mac, or Linux with a recent Arduino IDE
- The pinout card provided in the package (PDF card7a / card7b on the PJRC website)
Environment Installation
- Install the Arduino IDE, then the Teensy add-on: via the IDE's Boards Manager, or by downloading Teensyduino from <https://www.pjrc.com/teensy/td_download.html>. The add-on includes a vast collection of libraries optimized for the Cortex-M4.
- Other supported environments: PlatformIO (cross-platform), Visual Micro (Visual Studio, commercial), or the command-line Makefiles shipped with Teensyduino in
{Arduino}/hardware/teensy/avr/cores/teensy3/Makefile. - In the IDE: Tools > Board > Teensy 3.2, then select the USB port.
Complete Code
// Blink version Teensy : la LED orange est sur la broche 13.
void setup {
pinMode(13, OUTPUT);
}
void loop {
digitalToggle(13); // fonction propre à Teensy : inverse l'état de la broche
delay(500);
}
Uploading
Click Upload: the IDE compiles, then Teensy Loader opens and requests entry into programming mode. If the board does not switch automatically, press the small Program button near the USB connector (or briefly connect the Program pin to GND). Since HalfKay is in a separate chip, a buggy sketch cannot destroy the bootloader: the button remains always available to regain control — this is your permanent safety net.
Expected Verification
The orange LED blinks every 500 ms upon power-up, with no startup delay. Unplug and replug: the program restarts instantly — the major difference from classic Arduinos. For the Serial Monitor, set Tools > USB Type: Serial and add a Serial.begin(9600) in setup.
Common Errors
- Wrong board type: Teensy 3.2 (MK20DX256) is not Teensy LC, 3.5/3.6, or 4.0 — the compiler would target the wrong microcontroller.
- "Charge-only" USB cable: Teensy Loader never sees the board; test with another cable.
- Expecting an UNO-style auto-reset: here, Teensy Loader requests programming mode; if the window closes too quickly, restart the upload and press the Program button.
- Forgetting that logic is at 3.3 V: HIGH = 3.3 V, 10 mA max recommended per pin (inputs are, however, 5 V tolerant).
- Panicking over a "dead" board: see the advanced recovery tutorial (Program button,
teensy_reboot, secure mode FSEC). - >
Other tutorials for this board
- Broches, ADC 13 bits, DAC 12 bits et PWM : dompter les E/S de la Teensy 3.2
- Un instrument MIDI USB en 10 minutes : Bounce, boutons et règle d'or du drain
- Audio Shield SGTL5000 : boucle stéréo 44,1 kHz et outil de conception graphique
- OctoWS2811 : piloter 8 rubans WS2812 en parallèle par DMA (presque zéro CPU)
- Timers matériels, interruptions imbriquées et FASTRUN : la vitesse Cortex-M4
- Intégration produit : alimentation VIN/VUSB, régulateur 250 mA, RTC à quartz et EEPROM
Code examples for this board
clignotante.inoArduinotouche-capacitive.inoArduinoanalogique-12-bits.inoArduinomidi-piano.inoArduinopwm-respiration.inoArduinoservo-angle.inoArduino