# Tag Info

38

Electrically Pin Count JTAG requires 4 signal lines SWD only requires 2 signal lines 2-wire JTAG interface specified in IEEE 1149.7 drops the pin count but doesn't seem to be widely available on many ICs. It also reduces bandwidth. Topology JTAG uses a daisy chain configuration for its data lines between chips. JTAG's speed is thus limited by the slowest ...

16

You'll need to isolate the microcontroller from the st-link portion of the board. To do this just remove the jumpers on the CN3 pins. Then, to use your external st-link, make the following connections to the microconroller pin headers: SWDIO -> PA13 SWCLK -> PA14 GND -> GND VAPP -> 3V/VDD Do not connect the USB cable Program it in SW mode. Not sure why ...

15

Thanks for the pointers, markt and chris-stratton. The semihosting option turned out to be quite straightforward. I managed to find the source for a couple of simple logging routines that can send messages to the OpenOCD console. I'll post them here since (i) they required some modification to work and (ii) I think this info is not super easy to find for ...

12

SWD should be able to program the ARM chipset plus you can debug and add breakpoints. The other good thing about SWD is you can use the serial wire viewer for your printf statements for debugging. I have only used it with the Keil compiler.

11

First of all, you are right, if your board has already got a supply voltage source you do not have to connect ST-Link's VDD pin. The second thing I would recommend you is to open the STM32F411 Nucleo board's reference manual and look at the schematics. Especially the part where the ST-Link is connected to the controller on the board. By ST Microelectronics,...

11

Use a multimeter. You will probably find that those pins are connected to the SWD pins. Note that PA14 clearly goes to a via, which will then run along the bottom side of the PCB. PA13 most likely runs underneath the micro, and into a via, and runs to the SWD header through the bottom layer too. Just because you look at something from the top and cannot ...

8

The typical thing to do on Cortex parts that only have a single processor core is to only use SWD. In this case, the only lines which need to be routed to the 10-pin header are SWDCLK/SWDIO/SWO/!RESET/+3V3/GND. Notice that !RESET is the microcontroller reset, and is not the same as TRST. From my experience, the only pin that needs to be pulled up via a ...

8

Old question, but none of the answers address the performance comparison. Although the feature set between SWD and JTAG (when using a CoreSight DAP) are near enough the same, SWD sequences are roughly 10% shorter than the equivalent JTAG sequences. There is no loss in data bandwidth in most cases (particularly streaming reads or writes where bandwidth is ...

8

The bootloader is in ROM, it is not user-modifiable (ie: you can't "burn" a new bootloader). This appnote describes the bootloader features for different STM32 parts. On the all the STM32 parts that I've used, you pull BOOT0 to ground to bypass the bootloader and boot from flash (address 0x0800000 on most STM32s). With BOOT0 pulled low, the pin state of ...

7

I may be a bit too late for OP, but maybe it will be useful for some other people with the same question. So, here we go (personal experience): It is possible to program and debug (fetch memory/register maps, break, run from specific point, etc.) with SWD. Using Eclipse here with GDB via J-Link EDU, which goes for ~50 Euros. There are some bugs (resetting ...

6

First of all thanks to everyone for their contribution. After two sleepless nights and struggle, I could find out the issue. The problem was in pin connections in my custom board: I thought that, in my MCU, Pin 9 (VDDA) is short-circuited with PINs 24-36-48, and Pin 8 (VSSA) with PINs 23-35-47, but it's not so. I needed to give another 3.3V and GND to ...

6

You could also flash the st-link and convert it to a Black Magic Probe. The same image will also convert a Blue Pill into a BMP. I've done both. The Blue Pill has the advantage that the usb-rs232 bridge the BMP exports is easily available. The BMP supports a range of chips to include but not limited to: ST Microelectronics STM32F0, STM32F1, STM32F3, ...

6

Yes, you can use STM32 SWD pins as GPIO, and yes, you need to think about the impact of doing so on the SWD functionality. Likely you want anything else driven by those lines to be behind a buffer with a high impedance input, and you want anything that could drive those lines to be behind a specific enable. But there's also a risk in re-purposing those ...

5

Atmel shares JTAG and SWD pins on their ICs. The SAM4E datasheet says it clearly: SWD is (in most cases) a two-wire interface, so the only program/debug connection is TMS/SWDIO and TCK/SWDCLK.

5

Microchip has some nice 8-bit microcontrollers with USB capabilities and internal oscillator. The cheapest one would be PIC16F1455: Cheap in small-medium quantities (~100). The PIC16F1455 is available from Digikey at $1.30 in quantities of 100. Native high-speed USB interface. Universal Serial Bus 2.0 Module with clock recovery from USB host. ... 5 Thank you for your great comments. Because of them, I have been confident that my design is error-free. That's why I focused my attention to search for errors in the hardware. And I found the error! This is a soldering error. I found this error after following this instruction: "Use a multimeter and test all of the connections for shorts or lack of ... 5 Right below Figure 10 of AN2586 it mentions: Resistor values are given only as a typical example. These pins can be tied directly to VDD or GND, but it is common practice to use resistors for a few reasons. Series resistors can provide some current-limiting protection to the microcontroller pins. Putting at least one resistor between the pin and VDD/GND ... 4 I2C spec: http://www.nxp.com/documents/user_manual/UM10204.pdf The main difference is in the handling of multiple devices on the same pair of wires. I2C allows this, SWD does not. As a result, I2C was designed to use open-collector logic with pull-up resistors: this is robust (no way one device can damage another by fighting over whether the line is 1 or 0) ... 4 How can I daisy chain these mcu's? MCU: STM32F407VG Debug protocol: SWD These MCUs support JTAG and SWD. While JTAG supports a daisy chain configuration, SWD does not. There is a multi drop extension in SWD 2.0 protocol, but I am pretty sure your MCU does not implement this. If you really want to debug multiple chips in a daisy chain, use JTAG. Beware:... 4 I'd advise you constult the 'BLE examples' section in the SDK documentation to choose an appropriate example based, then follow these steps. I've chosen the Heart Rate Sensor example to run through here. With the Keil pack installer, ensure you have the appropriate devices, drivers and example packs installed. In the Pack installer, choose an example that ... 4 I'm going to configure SWDCLK as normal output, and SWDIO as an open-drain SWDCLK is OK, but SWDIO is bidirectional and not open drain. That means you must be able to switch from output to input mode and vice versa. is there minimum allowed clock period? Usually not, but some devices have minimum clock rates for special functions like unlocking. I ... 4 Your layout is entirely lacking in decoupling capacitors. The MCU won't run with that layout and the clock probably won't even oscillate. 4 To add to the existing answer; some chips are known not to work properly with ST-LINK and OpenOCD. In particular, if your target is from the Atmel SAMD21 family of MCUs, you are likely to run into weird issues, where the processor is detected, but any attempts to erase flash sectors fail with an error. The reason is rather involved, to quote: AFAIK the ... 4 You research is correct. SWD cannot be remapped, but the pins can be used otherwise. The connector is non-standard. Typically people use the 10 pin SWD connector (often with 1.27mm pitch) for ARM JTAG/SWD. To communicate with the chip you need 4 pins. Target gnd and vcc, and SWDIO, SWDCLK. The programmers use target Vcc for their level shifters. Since many ... 4 CMSIS is the generic name for ARM-specified infrastructure around Cortex processors. The project we know today as DAPLink actually started as mbedmicro/CMSIS-DAP, we can find multiple references of the rename in the project history. "CMSIS-DAP" name became ambiguous as it was both the name for the spec and Mbed's implementation. So today, CMSIS-DAP is the ... 3 My SWD program outputs 50 clock cycles, issues the SWD switchover command, Not accurate: What could be causing this strange RESET_b behavior? The reset behavior is normal for an un-programmed chip. It is crashing (main() returns) and being reset by the watchdog timer. Here are a few general tips: First, check the errata for the part and family. There ... 3 NXP has some USB Full Speed ARM Cortex(M0 and M3) based microcontrollers which start in the ~$1.70 range for low quantity. They do not require an external oscillator for USB and have a dedicated PLL for USB use. For example, the LPC11U12FBD48.(price from AVNET)I would personally avoid using 8-bit microcontrollers these days unless you are going to use very ...

3

ST's extremely low cost cortex eval boards have a somewhat oddball USB-SWD adapter which can work with external targets as well as the on-board target by changing a few jumpers. There are open source PC-side drivers for these. What I don't know is if they are universal enough to work with other manufacturer's ARM chips as targets. However, there's at ...

3

Here are the 2x5 1.27mm headers we use (all in stock at digikey): Harwin part # M50-3500542 (It's an open header, then we snip pin 7 to polarize.) CNC Tech part # 3220-10-0100-00 (It's a boxed header, so you get polarization w/o snipping any pins. Actually cheaper than the Harwin part, but takes up more room.) Then we use this cable to connect (also in ...

3

Yes. Many STM32 devices come with built-in bootloader. See the documentation on how to trigger it. This is often done by tying a pin high during power up. You will also need to read the datasheet on how to use the SPI and UART in bootloader mode. So yes you can program the device either using the bootloader or using SWD. SWD is also be used for debugging ...

Only top voted, non community-wiki answers of a minimum length are eligible