| ||
Shopping Cart
![]() |
Home | Products | Teensy | Blog | Forum |
You are here:
PJRC Store
![]() ![]() |
|
Bootloader Chip for DIY Teensy 4.0 & 4.1 Projects
This chip, together with an IMXRT1062 microcontroller and Winbond flash memory allows you to create a DIY circuit board which is fully compatible with Teensy 4.0 or Teensy 4.1. ![]()
Supported ChipsUpdate, September 2023: PJRC has a small supply of extra IMXRT1062DVJ6B chips. If you need a small number (less than 100) and it's still out of stock everywhere, contact us.An IMXRT microcontroller and flash memory chip must be paired with this MKL02 to form a working system. No programming or other setup is needed on these other chips. Blank chips sold by distributors are used.
IMXRT1062 chips with extended temperature range are likely to work. Success with some of these chips has been reported on the forum. Winbond flash memory chips with a "Q" at the end of their part number do not work. Only the "M" parts are supported. Power Up SequenceThe IMXRT1062 chip has special power-up sequence requirements. While PJRC generally recommends following the Teensy 4.0 or Teensy 4.1 schematic, understanding the proper power-up process is important for any design changes you may choose to make while designing your own PCB.
![]()
Power Design NotesThe built-in USB voltage regulator operates independently from the rest of the IMXRT power management. It may be powered up first, last, or at any time. USB power may also be removed and reapplied at any time without impacting the rest of the chip.The SNVS voltage regulator must be powered up before any other on-chip regulators, except the USB regulator which is completely separate. The SNVS (Secure Non-Volatile Storage) system manages the power for the rest of the chip. If power is applied to the other regulators first, the IMXRT may fail to boot. Before 3.3V power is applied, PMIC_ON_REQ is driven high with only 1.1V. The voltage regulator must be able to recognize 1.1V for proper startup. If a different voltage regulator is used, check its enable voltage threshold. Some chips require 1.5V or higher, which may not reliably start up. If only 3.3V power is used, a solid state switch or P-channel mosfet should be used instead of the 3.3V regulator. For proper startup, 3.3V power to the IMXRT should be turned on when PMIC_ON_REQ is asserted. PJRC does not recommend using a resistor-capacitor delay circuit to control DCDC_PSWITCH. This signal is not level sensitive. Simply being high will not enable the switching power supply. A low-to-high transition is required after 3.3V power is stable to cause the buck converted to start up. Crystal Oscillator GuidelinesThe 24 MHz crystal is required. As with all crystal oscillators, a solid ground plane should be routed on the PCB layer directly underneath the crystal. 2 capacitors and 1 resistor are required. See NXP's Hardware Development Guide for the MIMXRT1050/MIMXRT1060 Applications Processor, Rev.0, 08/2018 for details.The 32.768 kHz crystal is optional. If not used, the IMXRT will automatically use a low accuracy 32 kHz internal oscillator. BGA Pinout Diagram![]() Printable PDF of this pinout diagram. If you route I/O pins not normally used on any Teensy model, you will need to edit the Teensy core library to add support for those pins. You will also need to edit the Wire library if the 4th I2C port is used. Avoid using SD_B1_05 (BGA pin N3) for I/O. Normally this pin should be left unconnected. The flash memory controller compensates for signal speed using this pin. PCB Design and BGA RoutingBall Grid Array (BGA) routing can feel daunting. Don't be intimidated. For inspiration, here is the PCB layout used for an early 4 layer Teensy 4.0 prototype.
With the smaller 10x10mm BGA chip, where the pins are at 0.65mm pitch, signals and ground/power planes can not route between adjacent vias on other layers (unless using an expensive premium PCB process). One BGA routing strategy is keep some rows free of vias. This approach allows only about half of all the pins to be used, which is plenty for the Teensy 4.0 design. The no-via rows allow power & ground to connect on the inner layers, and provide space for decoupling capacitors or signal routing on the bottom layer.
With the larger 12x12mm BGA chip, where the pins are at 0.8mm pitch, adjacent vias do allow a signal to route between them on other layers. For a design where more than 60% of the BGA pins must be routed, the larger 0.8mm pitch BGA chip allows use a standard PCB process. Hardware InitializationIMXRT fuses are initialized the first time the IMXRT1062 and MKL02 chip are used together. Bits 4 and 19 in the HW_OCOTP_CFG5 fuse word are set. Bit 4 allows booting from flash memory. Bit 19 configures IMXRT to communicate using JTAG.The HW_OCOTP_MAC0 and HW_OCOTP_MAC1 fuses are also set with unique 48 bit Ethernet Mac address. Only a single IMXRT1062 may be initialized. The first time the Program button is pressed, the top 4K of flash memory is written with a known-good LED blink program. When the program button is pressed for 15 seconds, the rest of the flash chip is erased and this LED blink is copied to the beginning of the flash memory. Because this copy is created on the first non-15-second press, the 15 second press for restore only works if a short press for normal bootloader entry has been done at least once. Code SecuritySecure mode may be used with IC_MKL02Z32_T4_QFN16 sold starting November 1, 2021.
Secure mode provides these benefits.
To use code security, in Arduino click Tools > Teensy 4 Security.
For each board, run the Fuse Write Sketch to store your key into permanent fuse memory. Optionally, run the Verify Sketch to confirm code really is running with encryption. Then run the Lock Security Sketch to permanently lock secure mode. Full details can be found on the code security page. IC_MKL02Z32_T4_QFN16 chips sold before August 12, 2021 do not support code security. Locking secure mode will make boards make boards with those chips forever unbootable! PJRC recommends disabling changes to boot configuration, so secure mode can not become locked. Disabling Boot Configuration ChangesTo permanently prevent changes to boot & security settings, run this program.
void setup() { /* Prevent changes to boot & security configuration */ IMXRTfuseWrite(&HW_OCOTP_LOCK, 0x00400004); } void loop() { } If this program is run before secure mode is set, it will forever prevent locking secure mode. Changes to other fuses which might affect boot are also prohibited. Troubleshooting & Diagnostic Blink CodesIf your custom board does not start up, first check the power supply. As described in the power supply startup sequence, the IMXRT internal voltage regulators must start first, then 3.3V power is turned on when PMIC_ON_REQ is driven high.When the MKL02 chip receives stable 3.3V power, it will activate an internal pullup resistor on the Program signal (pin 10, PTB2). It will also drive DCDC_PSWITCH (connected to pin 3, PTA3) initially low and then high after 3.3V has remained stable for several milliseconds. This behavior on pin 3, PTA3 and the weak pullup in pin 10, PTB2 can confirm if the MKL02 has started properly. If DCDC_PSWITCH has been driven high, the buck converter should develop 1.15 volts at VDD_SOC_IN. The processor and nearly all digital logic inside the IMXRT depends on proper VDD_SOC_IN power. Once running, the MKL02 will blink its red LED when error conditions are detected. The blinks appear at 0.6 seconds apart and if the error condition remains, the pattern repeats after a 2 second pause.
User Shared ProjectsJens Chr Brynildsen Kicad example project (GitHub) using USB-C connectors for device and host, extra pins routed to test pins.
Technical Support (Forum)Please understand PJRC can not provide direct technical assistance with custom PCB design.Diagnosing problems with a brand new PCB design can be tough. If you are stuck, please consider posting a request for help on the public forum. You will need to show some or all of your custom PCB. Historically, many of the PCB designs using the Teensy 3.x bootloader chip were diagnosed on the forum. When those conversations yield valuable insight which may help others, we add links to those forum conversations from this page. This Initial forum thread is where much of the bootloader chip development was discussed. |