szymonh / JTAGscan

Identify JTAG ports using your favorite Arduino.
GNU General Public License v3.0
54 stars 8 forks source link

JTAGscan

JTAGscan allows you to find JTAG ports without buying specialized hardware like the JTAGulator. All you need is a Arduino compatible board and optionally a logic level shifter.

How does it work?

JTAGscan iterates through configured set of pins to find the JTAG TMS, TCK, TDO and TDI lines using two approaches:

Unfortunately not all chips support ID CODE retrieval so BYPASS mode scan will be needed for them.

How to use it?

How to set the pin_mask?

Pins are enabled by setting corresponding bits of PIN_MASK, i.e. pins 2-8 are enabled for PIN_MASK of 0b111111100 or 0x1fc.

Besides PIN_MASK predefined at build time you can also set the pin mask at runtime using the m command. Entering 508 or 0x1fc will result in pin_mask set to 0b111111100 so you can update the configuration without the need to rebuild the project.

How does it look like?

+-- BYPASS searching, just TDI -+ | TCK | TMS | TDO | TDI | Width | +-------------------------------+ | 2 | 3 | 0 | 1 | 31 | +----------- SUCCESS -----------+


- toggle debug level to 1, then ID CODE enumeration of TCK, TMS and TDO lines

d Debug level set to 1 i +------ IDCODE searching -------+ | TCK | TMS | TDO | IDCODE | +-------------------------------+ | 0 | 1 | 2 | 0 | | 0 | 1 | 3 | 0 | | 0 | 1 | 4 | 0 | | 0 | 1 | 5 | 0 | | 0 | 2 | 1 | 0 | | 0 | 2 | 3 | 0 | | 0 | 2 | 4 | 0 | | 0 | 2 | 5 | 0 | ... | 2 | 0 | 1 | 0 | | 2 | 0 | 3 | 0 | | 2 | 0 | 4 | 0 | | 2 | 0 | 5 | 0 | | 2 | 1 | 0 | 0 | | 2 | 1 | 3 | 0 | | 2 | 1 | 4 | 0 | | 2 | 1 | 5 | 0 | | 2 | 3 | 0 | 4ba00477 | +----------- SUCCESS -----------+ | TCK | TMS | TDO | IDCODE | +------ IDCODE complete --------+

No Platformio?

No problem, just copy the contents of src/main.cpp to a new Arduino project, remove the Arduino.h import from the first line and you're ready to go.

Using ARM?

Check SWDscan to identify the Serial Wire Debug pins.