DirtyJTAG is a JTAG adapter firmware for $2 STM32 development boards ("blue pill"/"black pill" STM32F103-based ARM boards). The DirtyJTAG project was created to find an alternative to the obsolete (but cheap) LPT Wiggler cables, and expensive USB JTAG probes.
DirtyJTAG is dirty and dirt cheap, but is not fast nor a perfect implementation of the JTAG protocol. Yet it is a bit less than 500 sloccount lines, therefore it is easily understandable and hackable.
DirtyJTAG is supported in mainline UrJTAG, see the Installing UrJTAG with DirtyJTAG support section.
If you prefer OpenOCD to UrJTAG, I suggest using Zoobab's fork of Versaloon firmware, which is available on his GitHub repository.
Download a pre-built version of the firmware (available on the release page) or build the firmware yourself (instructions provided below). Install stlink, then use this command :
st-flash write /path/to/dirtyjtag.bin 0x8000000
STM32 | JTAG |
---|---|
PA0 | TDI |
PA1 | TDO |
PA2 | TCK |
PA3 | TMS |
PA4 | TRST |
PA5 | SRST |
Pin definition can be modified in src/jtag.c
.
Once the bluepill dongle has been flashed, you should see the following USB VID=1209 and PID=c0ca belonging to "InterBiometrics" once plugged in on a linux computer:
$ lsusb
[...]
Bus 002 Device 003: ID 1209:c0ca InterBiometrics
The VID/PID was obtained through http://pid.codes, which is a registry of USB PID codes for open source hardware projects.
More infos: http://pid.codes/1209/C0CA/
Mainline UrJTAG has DirtyJTAG support since 763bbc revision. However, most package sources still use 2011 UrJTAG sources, so you'll need to compile UrJTAG :
cd /tmp
git clone https://git.code.sf.net/p/urjtag/git urjtag-git
cd urjtag-git/urjtag/
./autogen.sh
make
sudo make install
Then, you can use DirtyJTAG like any other JTAG cable in UrJTAG :
$ jtag
UrJTAG 0.10 #
Copyright (C) 2002, 2003 ETC s.r.o.
Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors
UrJTAG is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
There is absolutely no warranty for UrJTAG.
warning: UrJTAG may damage your hardware!
Type "quit" to exit, "help" for help.
jtag> cable dirtyjtag
jtag>
In order to compile DirtyJTAG, you will need the following software :
- git
- ARM toolchain (I'm using Fedora's
arm-none-eabi-gcc-cs
/arm-none-eabi-newline
packages) - make
Clone this repository :
git clone https://github.com/jeanthom/dirtyjtag
cd dirtyjtag
Then download unicore-mx :
git submodule init
git submodule update
Then you can build the firmware :
make bin
Your freshly compiled firmware will appear as src/dirtyjtag.bin
.