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.
JTAG uses a daisy chain configuration for its data lines between chips. JTAG's speed is thus limited by the slowest ...
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 ...
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 ...
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,...
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
How can I daisy chain these mcu's?
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:...
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 ...
You can program firmware via USB just fine, that is not a problem. It is perfectly good for firmware updates.
Why you should have SWD interface is not because of programming the MCU, but debugging the firmware.
It would be pretty anemic to have high performance MCU there, and you are limited to debugging code problems over serial console, LEDs, pushbuttons ...
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) ...
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'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 ...
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 ...
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 ...
An MCU GND pin wasn't making contact with its pad, soldered it correctly and was able to communicate with the chip without problems!
EDIT: After erasing the MCU using J-Link commander I lost connection and noticed the MCU was overheating. I haven't managed to program any board yet. This is the thread with the follow up.
The main question is: Under what circumstances do my SWD pins work?
The SWD pins work under any of these conditions:
The flashed firmware/program does not use the SWD pins for something else. In that case, you can connect to the MCU at any time.
The bootloader is running instead of the firmware. This can usually be achieved by pulling BOOT0 high on power-up ...
My SWD program outputs 50 clock cycles, issues the SWD switchover command,
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 ...
Reset pin is often not needed, because controller is possible to reset using debug registers.
Only one case when is necessary is connection under reset, this mean that if SWD signals are shared with other functionality on board (forexample SWDIO or SWDCLK is set as output), then only way to access MCU is to put MCU in to reset (at this moment are some ...
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 ...
As it turns out, on the 32 pin variant of the SAML21, you have to tie VDDANA to the power supply as well (with a decoupling cap in place obvs).
Got around it by soldering a bit of wire from the VDDANA pin to an exposed power pin on the first batch of boards. Got it rectified properly on the second set.
Note to self: read the datasheet properly next time!