# Maple Reference Documentation: JTAG

JTAG is an interface for low-level debugging of digital devices. It gives instruction by instruction control over the microprocessor and allows data to be read and written to arbitrary memory and register locations. It is typically used with a debugging tool like gdb when hacking low level routines and hardware peripherals (we use it when working on libmaple) or to flash a new bootloader.

Note that the stm32 on the Maple has a built-in low level serial debugger which could also be used to flash bootloaders, and that the ASSERT framework allows basic debugging over a USART serial channel; we expect only advanced users who already have a JTAG device would want to use this feature.

- Wiring Diagram
- Compatible Devices
- Recommended Reading

## Wiring Diagram

JTAG wiring diagram to connect a standard 20-pin ARM JTAG device to the 8-pin JTAG port on the Maple.

The Maple has holes for a 8-pin JTAG header but that header is not soldered on by default. If you know ahead of time that you'll be needing it, and you order straight from LeafLabs, add a comment to your order and we can probably solder one on for no charge. Otherwise you can simply attach standard 0.1" pitch male header pins (either the exact 4x2 block or two 4-pin pieces of breakaway straight header). For one-off usage hack the header can be jammed in the holes and twisted to ensure electrical contact: this is what we do to flash our bootloader.

The following schematic assumes that the header has been soldered on to the bottom of the board, not the top; most ribbon cable connectors will interfere with the power header. If you don't want a header coming off the bottom you can use a slim connector and invert this diagram appropriately.

## Compatible Devices

We have had good experience with the Olimex ARM-USB-OCD device, which costs about 55 euro plus shipping ( http://www.olimex.com/dev/arm-usb-ocd.html).

If you have success with something else let us know!

## Recommended Reading

- Wikipedia Article on Joint Test Action Group (JTAG)
- STM32/gdb/OpenOCD HOWTO
- STMicro documentation for STM32F103RB microcontroller:
  - All
  - Datasheet (pdf)
  - Reference Manual (pdf)

### About this Document

A more recent version of this document may be available from the LeafLabs website. Our documentation is versioned on github; you can track changes to the master branch at this link.

This documentation is released under a Creative Commons Attribution-Share Alike 3.0 license.

Translations are welcomed; give us a ping to make sure we aren't in the process of revising or editing first.