External STLink V2: Difference between revisions

From Embedded Workshop
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 15: Line 15:
  TDO/TRACESWO (13)          CN10-31        White    PB3  JTAG '''T'''est '''D'''ata '''O'''utput
  TDO/TRACESWO (13)          CN10-31        White    PB3  JTAG '''T'''est '''D'''ata '''O'''utput
  NRST (15)                  CN7-14        Orange  Active Low Reset
  NRST (15)                  CN7-14        Orange  Active Low Reset
TRST (3)                    CN10-27        Purple  PB4  JTAG '''T'''est '''R'''e'''S'''e'''T'''
  TRST, ”Test Reset” (low active) is used for an asynchronous reset of the JTAG Test Access Port (TAP).
  It resets the TAP state machine and on most ARM families the debug register
   
   
  * The wire colors depicted here are not part of any standard but what we used to keep track of each signal
  * The wire colors depicted here are not part of any standard but what we used to keep track of each signal
Line 43: Line 46:
https://www.tincantools.com/wp-content/uploads/2018/08/Flyswatter2-20-Pin-JTAG-Connector.pdf<br>
https://www.tincantools.com/wp-content/uploads/2018/08/Flyswatter2-20-Pin-JTAG-Connector.pdf<br>
It appears there's a 10-pin connector version: http://software-dl.ti.com/ccs/esd/documents/xdsdebugprobes/emu_jtag_connectors.html<br>
It appears there's a 10-pin connector version: http://software-dl.ti.com/ccs/esd/documents/xdsdebugprobes/emu_jtag_connectors.html<br>
10-Pin Adapter board with cable: https://www.digikey.com/product-detail/en/olimex-ltd/ARM-JTAG-20-10/1188-1016-ND/3471401

Latest revision as of 20:14, 30 August 2020

External STLink V2

My friend Rusty and I sat down after breakfast one Saturday morning and decided we wanted to use our new STLink V2 units to talk to our new NUCLEO-F103RB boards using JTAG vs the on-board SWIM (SWD).
Using STM32CubeMX and Keil uVision 5, we built a typical "Blinky" program and attempted to download the program to flash using the JTAG interface.
Here's the result of our exploration:

1) Connect the external ST-Link unit to the NUCLEO board

This example is using the NUCLEO-F103RB board
JTAG Signal (20 pin)  NUCLEO Attach Point  Wire*    Comment
VCC (1)                     CN7-12         Red      Required - Adapter senses target supply voltage
GND (20)                    CN7-8          Black    Common ground
TMS  / SWDIO (7)            CN7-13         Blue     PA13  JTAG Test Mode Selection / Serial Wire Data Input/Output
TCK  / SWCLK (9)            CN7-15         Yellow   PA14  JTAG Test CLocK / Serial Wire Clock
TDI (5)                     CN7-17         Green    PA15  JTAG Test Data Input
TDO/TRACESWO (13)           CN10-31        White    PB3   JTAG Test Data Output
NRST (15)                   CN7-14         Orange   Active Low Reset
TRST (3)                    CN10-27        Purple   PB4   JTAG Test ReSeT
  TRST, ”Test Reset” (low active) is used for an asynchronous reset of the JTAG Test Access Port (TAP).
  It resets the TAP state machine and on most ARM families the debug register

* The wire colors depicted here are not part of any standard but what we used to keep track of each signal

2) It is recommended to remove the two ST-LINK jumpers on the NUCLEO board, at CN2.

This disconnects the on-board debug adapter from the target processor.

3) Plug in the USB debug adapters

Plug in the External ST-Link adapter first, and then the NUCLEO board.

4) Configure the adapter

When applying power to the NUCLEO board as well as the external STLink-V2, the Keil IDE
saw two USB debug adapters, the on-board one and the external one. The on-board one was
labeled "ST-LINK/V2-1", and the external one was labeled "ST-LINK/V2".
The debug adapter to use and settings for the adapter are configured under:
 Project -> Options for Target <project name> -> Debug tab -> ST-Link Debugger (Settings) ->
   Debug Adapter Unit: {{#if:|{{#ifexpr:({{#time:U|{{{3}}}}} - {{#time:U|now}}) > 0|ST-LINK/V2|ST-LINK/V2}}|ST-LINK/V2}}

If all the wires are connected correctly, within that Debug Adapter settings dialog,
 Target Com Port: selecting {{#if:|{{#ifexpr:({{#time:U|{{{3}}}}} - {{#time:U|now}}) > 0|JTAG|JTAG}}|JTAG}} or {{#if:|{{#ifexpr:({{#time:U|{{{3}}}}} - {{#time:U|now}}) > 0|SW|SW}}|SW}} should both display information in the
 Target Device window.
Select "JTAG"
Click on "OK" button(s) to close the dialogs

5) Build the application(F7)
6) Download (F8)

The program should download to the target.

7) Press the reset (black) button to begin running the program.

Reference Documentation

https://www.st.com/resource/en/user_manual/dm00026748-stlinkv2-incircuit-debuggerprogrammer-for-stm8-and-stm32-stmicroelectronics.pdf
https://www2.lauterbach.com/pdf/arm_app_jtag.pdf
https://www.tincantools.com/wp-content/uploads/2018/08/Flyswatter2-20-Pin-JTAG-Connector.pdf
It appears there's a 10-pin connector version: http://software-dl.ti.com/ccs/esd/documents/xdsdebugprobes/emu_jtag_connectors.html
10-Pin Adapter board with cable: https://www.digikey.com/product-detail/en/olimex-ltd/ARM-JTAG-20-10/1188-1016-ND/3471401