March 29, 2024, 01:21:01 PM

ARM-USB-SWD SWDIO line never driven

Started by Grant Edwards, April 19, 2022, 12:04:28 AM

Previous topic - Next topic

Grant Edwards

I'm trying to use a brand-new ARM-USB-TINY-H with ARM-JTAG-SWD to work with an STM32G030.

First problem, it's not at all obvious which pins one is supposed to use for the SWD link. Perhaps you could put that info on this page?

  https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-SWD/

Even looking at the ARM-JTAG-SWD schematic, it is not obvious which pin on the 20-pin header is to be used for SWCLK. I think it is pin 9?

Second problem, I connected p9 to SWCLK, p7 to SWDIO, p8 to Gnd on my STM32G030 target, but when I run OpenOCD it fails to connect.

$ openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg  -f interface/ftdi/olimex-arm-jtag-swd.cfg -f target/stm32g0x.cfg
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : FTDI SWD mode enabled
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 2000 kHz
Error: Error connecting DP: cannot read IDR

When I look at SWCLK and SWDIO with an oscilloscope, it appears that SWDIO is always floating (high). SWDIO is never driven low by the adapter during commands the way it is when using an ST-Linkv2 adapter (which works fine with my target).

I've tried other STM32 target configuration files (including the one shown on the Olimex  web page), and I get the same result with all of them: SWDIO is floating during SWD commands.

I've also tried the latest git master version of OpenOCD with the same results.

When I switch to an older ARM-USB-TINY (without the -H), then the SWCCK and SWDIO lines both do nothing. [I get the same error message from OpenOCD: Error: Error connecting DP: cannot read IDR

Can somebody explain how the SWD adapter can be used with OpenOCD?








LubOlimex

SWCLK = TCK = pin 9

> Second problem, I connected p9 to SWCLK, p7 to SWDIO, p8 to Gnd

You probably need to connect the reset. Without reset line you would have to perform manual resets which is not so easy. Reset is #15 of the 20-pin header (system reset is the required one). If the problem remains, maybe also connect VCC to your target, there might be checks if the target is powered.

Also did you connect the adapter directly to the ARM-USB-TINY-H (without cable between ARM-USB-TINY-H and ARM-JTAG-SWD)?
Technical support and documentation manager at Olimex

Grant Edwards

Yes, the adapter was connected directly to the ARM-USB-TINY-H.

The problem was that the ARM-JTAG-SWD adapter apparently requires external power supplied to pin 1 (or 2). Other SWD adapters I use are powered via USB and only require three connections: Ground, SWDIO, SWCLK.

The external power requirement should be documented — that would have saved me a half day of work.


Grant Edwards

Quote from: JohnS on April 19, 2022, 06:35:47 PMDoesn't the schematic https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-SWD/resources/ARM-JTAG-SWD-schematic.pdf show pin 1 to VCC?
Yes the schematic shows pin 1 as Vcc.

However, there is no indication on the schematic showing who is supposed to supply Vcc.

Since the clock line driver worked fine without connecting Pin 1 to my target, it appeared to me that Vcc was being supplied from the USB side.

All the other SWD adapters I've used were powered from the USB side and required only Ground and two signal lines to be connected to the target. Without any documentation stating otherwise, I assumed the Olimex was the same.

Just a few lines of documentation on the web page stating which pins need to be connected to the target would have been extremely helpful.

LubOlimex

#5
Thank you for the update. Yes, VCC is required. I think it is common knowledge.

Quote from: Grant Edwards on April 19, 2022, 11:55:15 PMAll the other SWD adapters I've used were powered from the USB side and required only Ground and two signal lines to be connected to the target. Without any documentation stating otherwise, I assumed the Olimex was the same.

The problem is not in the ARM-JTAG-SWD, the problem is mainly in ARM-USB-TINY-H. Almost any debugger requires VCC (or at least any debugger that I've seen) to probe and negotiate the voltage level of the target. Because ARM-USB-TINY-H can work with devices in the 2V - 5V range, which is huge range.

Again I believe this is common knowledge, please google "Do I connect VCC JTAG" or "Is VCC required JTAG".
Technical support and documentation manager at Olimex