I *love* the Freescale Freedom boards, and you probably recognized that with all my projects using them. The Freedom boards are small, inexpensive and can be easily extended with Arduino shields which makes them a great platform for prototyping. But sometimes I just need an ARM microcontroller with some headers, and then the 85mm x 55mm size of the Freedom board is not ideal. That’s nothing new, but I realized that yet again when I did my Adafruit NeoPixel clock: the FRDM board was rather bulky, even if hidden behind that clock. I need something much smaller: the Teensy board!

No Debug?

So far so good. I was very reluctant to order the board because it has a problem: It does *not* expose the JTAG/SWD debug pins :-(. That means, it is not possible to debug the ARM processor on that board with the usual JTAG/SWD debugging tools.

:idea: Maybe it is just me: I respect the ‘Arduino way of programming’, but it is just not the way I think development should be done. I need full control of the hardware which includes deep inspection (debugging) of the application. Because in my experience the hard problems (and there are many!) of embedded development can only be solved with good debugging tools.

Instead, a USB based bootloader is used, the Teensy Loader (https://www.pjrc.com/teensy/loader.html). With that loader programs can be loaded to the board, but it does not allow me to debug the board by any normal means. That topic is discussed in the forums too (see http://forum.pjrc.com/threads/6-JTag-on-Teensy). So the board is open, but not that bootloader on the MINI54TAN device. Not having the JTAG/SWD pins exposed at least on test pads on that great board is definitely a pity.

:idea: I only can speculate that Paul Stoffregen (https://www.pjrc.com/about/about_us.html) want to protect the board IP from beeing cloned, which I can understand. But why not at least expose testing pads for JTAG/SWD?

Adding SWD Debugging

:!: WARNING: of course, any change of the Teensy board like this will void any warranty!

Looking at the schematics and the board layout under the microscope, it was clear that it would be possible to add SWD debug functionality to it. As SWD only needs 5 pins (GND, 3.3V (power sense), DIO, CLK and Reset, it should not be too hard to route it to a standard 10 pin SWD/JTAG header:

:idea: Interestingly, the USB DP and DM pins are *not* connected to the MINI54TAN device, but it manages the bootloading to the K20 through USB? I belive upon press of the ‘Prog’ button, the MINI54TAN programs a small USB bootloader program to the K20 which then runs the update? Would be an interesting approach just to use a single USB connector.

3.3V andGND are easily available on the back side oftheTeensy:

3.3V, GND and Reset on Teensy 3.1

For SWD_CLK and SWD_DIO there are no easy accessible pads. But an inspection of the layout of the board suggested to cut the traces to the MINI54TAN and solder wires directly to the K20 pads.

:idea: The idea to remove the MINI54TAN and to use its pads has been considered. But then this would be a non-revertible change (or at least not easy). So cut two traces and wire some wires sounds the better approach. Maybe cutting is not necessary, but I did to isolate it just in case.

SWD DIO and CLK Traces on Teensy V3.1

With this, wires get soldered on the microcontroller K20 pads (use soldering flux and head the pin with a wire wrap wire):

SWD_CLK and SWD_DIO Wires Soldered to the K20 Pins

Then cut the traces to the MINI54TAN:

Cut Traces to MINI54TAN

Compared to the previous step, the 3.3V, GND and Reset wires on the backside of the board are easy:

Soldered Wires on Back of Teensy 3.1

Next step is to connect the wires to the normal 2×5 pin SWD/JTAG pin header (or an adapter to it). I had a header with cable at hand, I decided to solder the wires to header.

:idea: The pin pitch is rather small. Next time I better create a small adapter PCB which would make soldering easier.

Soldered wires to 2×5 pin SWD JTAG Header

Pins on SWD JTAG Header

With this, I was able to debug the Teensy V3.1 with a normal JTAG/SWD hardware debugging tool, and within minutes I had a Processor Expert blinking LED program made with Eclipse plus GNU ARM tool chain running on the Teensy:

Debugging the Blinky on Teensy 3.1 with a P&E Multilink

Now with this that board is finally useful for me: I can debug with my favorite Eclipse tools :-).

Summary

The Teensy V3.1 is a fabulous board, with a processor I love: an ARM Cortex-M4 powerful for most of my projects. The board is tiny and small. The bad thing is that the usual JTAG/SWD pins are not available either on the outside or on test pads, making JTAG/SWD debugging not possible by default. But with some hacking and good soldering skills, a Teensy board can be turned into a board which talks with a JTAG/SWD cable like a P&E Multilink or Segger J-Link. And then the board can be utilized with an IDE like CodeWarrior, Kinetis Design Studio or a DIY Eclipse ARM Toolchain :-).

:idea: My wish is that future Teensy boards have at least the footprint of a standard 2×5 JTAG/SWD header on it, with some isolation traces. That way I can solder a header, cut a few traces and I have a board I can debug with the tools I’m used to. And if I have an extra wish: Replace the MINI54TAN with a Kinetis K20 running OpenSDAv2.1 as on the Freedom boards, and the Teensy would be the perfect board for me: a small and tiny open source board with an open source bootloader and firmware :-)