Overview

dap42 is an open-source debug probe for ARM Cortex-M devices.

It sits between your computer and your microcontroller and translates the commands it receives over USB into bit-banged Serial Wire Debug (SWD) signals that the microcontroller’s on-chip debug peripheral understands.

DAP42 data flow diagram

It uses ARM’s standard CMSIS-DAP debug protocol, so it works with many tools and IDEs, such as Keil uVision, LPCXpresso, and openocd.

In addition to speaking CMSIS-DAP for debugging, it also acts as a CDC-ACM USB-serial adapter and can act as a limited CAN-USB logger.

What’s special about dap42 vs other debuggers?

dap42 is a project I work on for my own education, so it’s special to me, but for everyone else, it might be of interest for a few reasons.

It’s easy to build

You don’t really need much more than a microcontroller, a voltage regulator, and a USB connector to build a debug probe. The bill of materials reflects that. You don’t even need a dedicated crystal - the STM32F042 can trim its internal RC oscillator from the USB clock.

As a bonus, the STM32F042 has a ROM USB DFU bootloader, so you can bootstrap it with a USB cable - no need for a debugger to flash your debugger!

It supports really cheap hardware

I don’t sell any hardware - I fully support taking dirt-cheap STLink/v2 clones, erasing their pirated firmware and flashing open-source firmware onto them.

As an added bonus, the dap42 firmware adds some extra features that you won’t get if you use the pirated firmware:

  • The SWIM pin is repurposed as an RX pin for a USB-serial port.
  • the RST pin is mapped so that it actually resets your target - the pirated firmware toggles a different RST pin that isn’t accessible.

It’s easy to extend

dap42 is designed to be usable standalone, but it can also be embedded into a development board as an on-board debug probe. Once you’ve put the debugger onto the board, hooking a few more IO lines to USB is essentially free.

BRAINv3.33 development board A DAP42 debugger embedded in this development board does triple-duty as a debugger, USB-serial adapter, and CAN bus monitor

The firmware compiles with standard gcc-arm - you don’t need an expensive proprietary toolchain to build the firmware yourself.

Sources on GitHub:

See also

  • dapboot, a USB DFU bootloader for STLink/v2 clones