Preparing Teensy 3.6 for SWD

Matt Page
Matt Page
Oct 31, 2017 · 3 min read

The Teensy 3.6 is a lovely little board. Full of promise and excitement. Compatible with Arduino by using Teensyduino, utterly loaded with CPU horsepower and peripherals, and for not much money.

BUT… there’s no immediate SWD hardware debugging support. Or, rather, there appears to be hardware SWD support on the underside through the pins DD, DC, DE, Reset.

It is a big shame this doesn’t work out-of-the-box.

Still, I love a challenge, and thanks to a very helpful BBenj on this thread: there was light.


Before describing what I’ve done, it’s worth highlighting some background information that I’ve gleaned from this exercise. It’ll shed some light on things.

The Teensy boards work by having a tiny (physically!) MKL02 Cortex-M0 CPU that can shove a USB-HID bootloader directly into the main MK66 Cortex-M4 CPU. When you hit the button, the MKL02 CPU grabs hold of the MK66 SWD pins, has a probe around and takes action.

If the MK66 is locked (i.e. security locked), then the MKL02 has only one option — full erase. WHOP! Out goes all the MK66 code.

Once it has access, the MKL02 shoves a small bootloader into RAM of the MK66 and lets it run. The Teensyduino programmer GUI detects this and then passes the binary flash data up your USB cable (using USB-HID) and into the MK66 flash.

By putting the bootloader into RAM, you can instantly reboot without having to re-flash the main application all over again.

Having burned the real code (it’s the MK66 bootloader itself that does this, not the MKL02) then all systems are “Go” and the main CPU will just run — as if the tiny MKL02 wasn’t there.

Now, the problem comes when we want to control the MK66’s SWD pins directly. The MKL02 should have let go if the DE pin is low… but PJRC haven’t got round to that. Sigh.

So, we have to go with BBenj’s suggestion of slamming reset on the MKL02 to keep it out of the way 👊

As I mentioned in the PJRC forum thread, all would have been fine if the DE pin was itself the pin 15 of the MKL02 (i.e. reset). Maybe there’ll be a PCB modification at some point 😝


This is very fine work, but possible with a magnifying glass and a steady hand.

The process is thus:

  • solder a very fine wire to pin 15 of the MKL02
  • take it to a 2-pin header that has the other side connected to GND (next to pin 13 of the module)
  • Now you can just jumper across, or wire a Dupont connector to breadboard.

Simply remove the link or wire (or tie to 3V3) to let the MKL02 have its life back again.

MKL02 pin 15 to pin header
From the side

And viewing on breadboard:

Fully wired up to the Segger J-Link Pro

The TFT test was built using Segger’s Embedded Studio using my project that allows Teensyduino/Arduino development, flashed with the J-Link, and allowing full hardware debugging. Yahaaaay!

Next step… to show you how to setup Segger’s tools for Teensyduino.

Matt Page

Written by

Matt Page

aka “MattMatic”. Embedded firmware professional and always learning.

More From Medium

Also tagged Arduino

Also tagged Arduino

Building a robotic spider

Apr 7 · 11 min read


Top on Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade