1.. _teensy40: 2 3PJRC TEENSY 4 4############# 5 6Overview 7******** 8 9The Teensy is a complete USB-based microcontroller development system, in a 10very small footprint, capable of implementing many types of projects. All 11programming is done via the USB port. 12 13.. tabs:: 14 15 .. group-tab:: Teensy 4.0 16 17 .. figure:: img/teensy40.jpg 18 :align: center 19 :alt: TEENSY40 20 21 (Credit: https://www.pjrc.com) 22 23 .. group-tab:: Teensy 4.1 24 25 .. figure:: img/teensy41.jpg 26 :align: center 27 :alt: TEENSY41 28 29 (Credit: https://www.pjrc.com) 30 31Hardware 32******** 33 34.. tabs:: 35 36 .. group-tab:: Teensy 4.0 37 38 - MIMXRT1062DVL6A MCU (600 MHz, 1024 KB on-chip memory) 39 - 16 Mbit QSPI Flash 40 - User LED 41 - USB 2.0 host connector 42 43 See the `Teensy 4.0 Website`_ for a complete hardware description. 44 45 .. group-tab:: Teensy 4.1 46 47 - MIMXRT1062DVJ6A MCU (600 MHz, 1024 KB on-chip memory) 48 - 64 Mbit QSPI Flash 49 - User LED 50 - USB 2.0 host connector 51 - USB 2.0 OTG connector 52 - 10/100 Mbit/s Ethernet transceiver 53 - TF socket for SD card 54 55 To connect an Ethernet cable, additional `Teensy 4.1 Ethernet Kit`_ is required. 56 57 See the `Teensy 4.1 Website`_ for a complete hardware description. 58 59For more information, check the `i.MX RT1060 Datasheet`_. 60 61Supported Features 62================== 63 64The Teensy 4.0 board configuration supports the following hardware 65features: 66 67+-----------+------------+----------------------+ 68| Interface | Controller | Driver/Component | 69+===========+============+======================+ 70| ADC | on-chip | adc | 71+-----------+------------+----------------------+ 72| CLOCK | on-chip | clock_control | 73+-----------+------------+----------------------+ 74| FLASH | on-chip | flash | 75+-----------+------------+----------------------+ 76| GPIO | on-chip | gpio | 77+-----------+------------+----------------------+ 78| I2C | on-chip | i2c | 79+-----------+------------+----------------------+ 80| I2S | on-chip | i2s | 81+-----------+------------+----------------------+ 82| NVIC | on-chip | arch/arm | 83+-----------+------------+----------------------+ 84| PWM | on-chip | pwm | 85+-----------+------------+----------------------+ 86| RTC | on-chip | system clock | 87+-----------+------------+----------------------+ 88| SPI | on-chip | spi | 89+-----------+------------+----------------------+ 90| CAN | on-chip | can | 91+-----------+------------+----------------------+ 92| UART | on-chip | serial | 93+-----------+------------+----------------------+ 94| USB | on-chip | usb | 95+-----------+------------+----------------------+ 96| TRNG | on-chip | entropy | 97+-----------+------------+----------------------+ 98| WDT | on-chip | watchdog | 99+-----------+------------+----------------------+ 100 101The Teensy 4.1 board configuration supports additional hardware 102features: 103 104+-----------+------------+-------------------------------------+ 105| Interface | Controller | Driver/Component | 106+===========+============+=====================================+ 107| SDHC | on-chip | disk access | 108+-----------+------------+-------------------------------------+ 109| ENET | on-chip | ethernet | 110+-----------+------------+-------------------------------------+ 111 112Other hardware features have not been enabled yet for this board. 113 114Connections and IOs 115=================== 116 117Pin mappings from Teensy to MIMXRT1062 SoC. 118 119+-----+------------+-------------------------------------+ 120| Pin | Pad ID | Usage | 121+=====+============+=====================================+ 122| 0 | AD_B0_03 | GPIO1_3 / UART6_RX / CAN2_RX | 123+-----+------------+-------------------------------------+ 124| 1 | AD_B0_02 | GPIO1_2 / UART6_TX / CAN2_TX | 125+-----+------------+-------------------------------------+ 126| 2 | EMC_04 | GPIO4_4 | 127+-----+------------+-------------------------------------+ 128| 3 | EMC_05 | GPIO4_5 | 129+-----+------------+-------------------------------------+ 130| 4 | EMC_06 | GPIO4_6 | 131+-----+------------+-------------------------------------+ 132| 5 | EMC_08 | GPIO4_8 | 133+-----+------------+-------------------------------------+ 134| 6 | B0_10 | GPIO2_10 | 135+-----+------------+-------------------------------------+ 136| 7 | B1_01 | GPIO2_17 / UART4_RX | 137+-----+------------+-------------------------------------+ 138| 8 | B1_00 | GPIO2_16 / UART4_TX | 139+-----+------------+-------------------------------------+ 140| 9 | B0_11 | GPIO2_11 | 141+-----+------------+-------------------------------------+ 142| 10 | B0_00 | GPIO2_0 | 143+-----+------------+-------------------------------------+ 144| 11 | B0_02 | GPIO2_2 | 145+-----+------------+-------------------------------------+ 146| 12 | B0_01 | GPIO2_1 | 147+-----+------------+-------------------------------------+ 148| 13 | B0_03 | GPIO2_3 / LED | 149+-----+------------+-------------------------------------+ 150| 14 | AD_B1_02 | GPIO1_18 / UART2_TX | 151+-----+------------+-------------------------------------+ 152| 15 | AD_B1_03 | GPIO1_19 / UART2_RX | 153+-----+------------+-------------------------------------+ 154| 16 | AD_B1_07 | GPIO1_23 / UART3_RX / I2C3_SCL | 155+-----+------------+-------------------------------------+ 156| 17 | AD_B1_06 | GPIO1_22 / UART3_TX / I2C3_SDA | 157+-----+------------+-------------------------------------+ 158| 18 | AD_B1_01 | GPIO1_17 / I2C1_SDA | 159+-----+------------+-------------------------------------+ 160| 19 | AD_B1_00 | GPIO1_16 / I2C1_SCL | 161+-----+------------+-------------------------------------+ 162| 20 | AD_B1_10 | GPIO1_26 / UART8_TX | 163+-----+------------+-------------------------------------+ 164| 21 | AD_B1_11 | GPIO1_27 / UART8_RX | 165+-----+------------+-------------------------------------+ 166| 22 | AD_B1_08 | GPIO1_24 / CAN1_TX | 167+-----+------------+-------------------------------------+ 168| 23 | AD_B1_09 | GPIO1_25 / CAN1_RX | 169+-----+------------+-------------------------------------+ 170| 24 | AD_B0_12 | GPIO1_12 / UART1_TX / I2C4_SCL | 171+-----+------------+-------------------------------------+ 172| 25 | AD_B0_13 | GPIO1_13 / UART1_RX / I2C4_SDA | 173+-----+------------+-------------------------------------+ 174| 26 | AD_B1_14 | GPIO1_30 / SPI3_MOSI | 175+-----+------------+-------------------------------------+ 176| 27 | AD_B1_15 | GPIO1_31 / SPI3_SCK | 177+-----+------------+-------------------------------------+ 178| 28 | EMC_32 | GPIO3_18 / UART7_RX | 179+-----+------------+-------------------------------------+ 180| 29 | EMC_31 | GPIO4_31 / UART7_TX | 181+-----+------------+-------------------------------------+ 182| 30 | EMC_37 | GPIO3_23 / CAN3_RX | 183+-----+------------+-------------------------------------+ 184| 31 | EMC_36 | GPIO3_22 / CAN3_TX | 185+-----+------------+-------------------------------------+ 186| 32 | B0_12 | GPIO2_12 | 187+-----+------------+-------------------------------------+ 188| 33 | EMC_07 | GPIO4_7 | 189+-----+------------+-------------------------------------+ 190 191Only Teensy 4.0: 192 193+-----+------------+-------------------------------------+ 194| 34 | SD_B0_03 | GPIO3_15 | 195+-----+------------+-------------------------------------+ 196| 35 | SD_B0_02 | GPIO3_14 | 197+-----+------------+-------------------------------------+ 198| 36 | SD_B0_01 | GPIO3_13 | 199+-----+------------+-------------------------------------+ 200| 37 | SD_B0_00 | GPIO3_12 | 201+-----+------------+-------------------------------------+ 202| 38 | SD_B0_05 | GPIO3_17 | 203+-----+------------+-------------------------------------+ 204| 39 | SD_B0_04 | GPIO3_16 | 205+-----+------------+-------------------------------------+ 206 207Only Teensy 4.1: 208 209+-----+------------+-------------------------------------+ 210| 34 | B1_13 | GPIO2_29 / UART5_RX | 211+-----+------------+-------------------------------------+ 212| 35 | B1_12 | GPIO2_28 / UART5_TX | 213+-----+------------+-------------------------------------+ 214| 36 | B1_02 | GPIO2_18 | 215+-----+------------+-------------------------------------+ 216| 37 | B1_03 | GPIO2_19 | 217+-----+------------+-------------------------------------+ 218| 38 | AD_B1_12 | GPIO1_28 / SPI3_CS | 219+-----+------------+-------------------------------------+ 220| 39 | AD_B1_13 | GPIO1_29 / SPI3_MISO | 221+-----+------------+-------------------------------------+ 222| 40 | AD_B1_04 | GPIO1_20 | 223+-----+------------+-------------------------------------+ 224| 41 | AD_B1_05 | GPIO1_21 | 225+-----+------------+-------------------------------------+ 226 227Programming and Debugging 228************************* 229 230Flashing 231======== 232 233Both the Teensy 4.0 and Teensy 4.1 ship with a dedicated bootloader chip, 234which supports flashing using USB. This allows easy flashing of new images, 235but does not support debugging the device. 236 237#. Build the Zephyr kernel and the :zephyr:code-sample:`blinky` sample application. 238 239.. tabs:: 240 241 .. group-tab:: Teensy 4.0 242 243 .. zephyr-app-commands:: 244 :zephyr-app: samples/basic/blinky 245 :board: teensy40 246 :goals: build 247 :compact: 248 249 .. group-tab:: Teensy 4.1 250 251 .. zephyr-app-commands:: 252 :zephyr-app: samples/basic/blinky 253 :board: teensy41 254 :goals: build 255 :compact: 256 257#. Connect the board to your host computer using USB. 258 259#. Tap the reset button to enter bootloader mode. 260 Red LED blinks. 261 262#. Flash the image. 263 264.. tabs:: 265 266 .. group-tab:: Teensy 4.0 267 268 .. zephyr-app-commands:: 269 :zephyr-app: samples/basic/blinky 270 :board: teensy40 271 :goals: flash 272 :compact: 273 274 .. group-tab:: Teensy 4.1 275 276 .. zephyr-app-commands:: 277 :zephyr-app: samples/basic/blinky 278 :board: teensy41 279 :goals: flash 280 :compact: 281 282#. You should see the orange LED blink. 283 284Configuring a Console 285===================== 286 287.. tabs:: 288 289 .. group-tab:: UART-Console 290 291 By default console output is mapped to teensy pins 0 (RX1) and 1 (TX1). Connect a usb-to-serial adapter 292 to use this serial console. Use the following settings with your serial terminal of choice (minicom, putty, 293 etc.): 294 295 - Speed: 115200 296 - Data: 8 bits 297 - Parity: None 298 - Stop bits: 1 299 300 .. group-tab:: USB-Console 301 302 By mapping the console output to USB, a usb-to-serial adapter is no longer required. 303 Utilizing the :ref:`snippet-cdc-acm-console` and a config option will enable this feature. 304 305 #. If application code doesn´t enable USB device support, this must be done via Kconfig option. 306 307 .. code-block:: kconfig 308 309 CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y 310 311 #. Build application including the snippet. 312 313 .. zephyr-app-commands:: 314 :zephyr-app: samples/basic/blinky 315 :snippets: cdc-acm-console 316 :board: teensy41 317 :goals: flash 318 :compact: 319 320 #. After application startup a serial device named like 321 ``tty.usbmodem14203`` should appear on your host computer. 322 You can use e.g. ``Serial Monitor`` plugin for VScode to monitor. 323 324References 325********** 326 327.. target-notes:: 328 329.. _Teensy 4.0 Website: 330 https://www.pjrc.com/store/teensy40.html 331 332.. _Teensy 4.1 Website: 333 https://www.pjrc.com/store/teensy41.html 334 335.. _Teensy 4.1 Ethernet Kit: 336 https://www.pjrc.com/store/ethernet_kit.html 337 338.. _i.MX RT1060 Datasheet: 339 https://www.nxp.com/docs/en/nxp/data-sheets/IMXRT1060CEC.pdf 340