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.
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!
The firmware compiles with standard gcc-arm - you don’t need an expensive proprietary toolchain to build the firmware yourself.
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 has some extra features:
SWIMpin is repurposed as an RX pin for a USB-serial port.
RSTpin is mapped so that it actually resets your target.
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 up IO lines to USB is essentially free.
From there, it’s straightforward to add things like CAN-USB support along-side the existing debug and serial capabilities.