DAPLink on STLINK - ziutek/DAPLink GitHub Wiki

This document describes how to build, flash and use the DAPLink interface firmware on ST-LINK/V2(-1) and clones.

The firmware runs at 72 MHz. Some ST-LINK clones use cheaper STM32F101 MCU which may run unstable because of the 36 MHz maximum supported clock.

Building

cd DAPLink
git checkout develop
pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
tools/progen_compile.py stlinkclone_if

The compiled firmware is in projectfiles/make_gcc_arm/stlinkclone_if/build/stlinkclone_if.bin.

Flashing

This step doesn't remove the ST bootloader so you can revert to ST-LINK firmware at any time using the official ST-LINK upgrade tool.

You need stlink-tool to talk with ST bootloader.

stlink-tool projectfiles/make_gcc_arm/stlinkclone_if/build/stlinkclone_if.bin

Using

If you replug ST-LINK/V2 it always boots to ST bootloader. Call stlink-tool without arguments to switch to DAPLink.

To automate this add something like this to your udev config:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", ACTION=="add", RUN+="/usr/local/bin/stlink-tool"

The above line runs /usr/local/bin/stlink-tool automatically after detecting new ST-LINK/V2 on USB (0483:3748). Change the path to stlink-tool if different than /usr/local/bin/stlink-tool.