PJRC Teensy 4.0

The PJRC Teensy 4.0 is a small ARM development board based on the NXP iMXRT1062 32-bit 600 MHz ARM Cortex-M7.

Interfaces

InterfaceHardware SupportedTinyGo Support
GPIOYESYES
UARTYESYES
SPIYESYES
I2CYESYES
ADCYESYES
PWMYESNot yet
USBDeviceYESNot yet

Pins

PinHardware pinAlternative names
D0PA3UART_RX_PIN, UART1_RX_PIN, SPI2_CS_PIN
D1PA2UART_TX_PIN, UART1_TX_PIN, SPI2_SDI_PIN
D2PD4
D3PD5
D4PD6
D5PD8
D6PB10
D7PB17UART2_RX_PIN
D8PB16UART2_TX_PIN
D9PB11
D10PB0SPI_CS_PIN, SPI1_CS_PIN
D11PB2SPI_SDO_PIN, SPI1_SDO_PIN
D12PB1SPI_SDI_PIN, SPI1_SDI_PIN
D13PB3LED, SPI_SCK_PIN, SPI1_SCK_PIN
D14PA18A0, UART3_TX_PIN
D15PA19A1, UART3_RX_PIN
D16PA23A2, UART4_RX_PIN, I2C2_SCL_PIN
D17PA22A3, UART4_TX_PIN, I2C2_SDA_PIN
D18PA17A4, I2C_SDA_PIN, I2C1_SDA_PIN
D19PA16A5, I2C_SCL_PIN, I2C1_SCL_PIN
D20PA26A6, UART5_TX_PIN
D21PA27A7, UART5_RX_PIN
D22PA24A8
D23PA25A9
D24PA12A10, UART6_TX_PIN, I2C3_SCL_PIN
D25PA13A11, UART6_RX_PIN, I2C3_SDA_PIN
D26PA30A12, SPI2_SDO_PIN
D27PA31A13, SPI2_SCK_PIN
D28PC18UART7_RX_PIN
D29PD31UART7_TX_PIN
D30PC23
D31PC22
D32PB12
D33PD7
D34PC15SPI3_SDI_PIN
D35PC14SPI3_SDO_PIN
D36PC13SPI3_CS_PIN
D37PC12SPI3_SCK_PIN
D38PC17
D39PC16

Machine Package Docs

Documentation for the machine package for the Teensy 4.0

Flashing

teensy_loader_cli

In order to flash your TinyGo programs onto the Teensy 4.0 board, you will need to install the teensy_loader_cli (https://.com/PaulStoffregen/teensy_loader_cli) on your machine.

CLI Flashing

  • Plug your Teensy 4.0 into your computer’s USB port.

  • Flash your TinyGo program to the board using this command:

    tinygo flash -target=teensy36 [PATH TO YOUR PROGRAM]
    
  • The Teensy 4.0 board should restart and then begin running your program.

Troubleshooting

If you have troubles getting your Teensy 4.0 board to receive code, try this:

  • Press the “RESET” button on the board two times to get the Teensy 4.0 board ready to receive code.

  • The Teensy 4.0 board will appear to your computer like a USB drive.

  • Now try running the command as above:

    tinygo flash -target=teensy40 [PATH TO YOUR PROGRAM]
    

Once you have updated your Teensy 4.0 board the first time, after that you should be able to flash it entirely from the command line.

Notes

You cannot yet use the USB port to the Teensy 4.0 as a USB CDC serial port.