I am starting with a simple STM32 board that has only SWD (i.e., SWDIO, SWCLK, SWO, and NRST) and 3V power supply. (Yes, I have double-checked the connections of all of the above pins, both on the schematic, and with a continuity tester on the actual soldered board. But I don't think the configuration issue I'm running into has anything to do with these connections).
I compiled openocd with
--enable-stlink and set up USB udev rules. When I run it, it makes the lights on my STLINK-V3 blink. Target current briefly drops from 13mA to 0mA, so maybe reset is working.
However, it appears that the SWD (or even reading target voltage) is not working.
I tried various
transport select; here is my
# Should work with all STM32L4 Nucleo Dev Boards. # http://www.st.com/en/evaluation-tools/stm32-mcu-nucleo.html source [find interface/stlink.cfg] #transport select hla_swd # This causes JTAG access, not SWD access transport select dapdirect_swd # This SHOULD be the right setting, per the docs: # http://openocd.org/doc/html/Debug-Adapter-Configuration.html # But causes "Error: Debug adapter doesn't support 'dapdirect_swd' transport" source [find target/stm32l4x.cfg] # use hardware reset reset_config srst_only srst_nogate
How do I enable STLINK-V3 SWD?
Update I looked in the MCU manual again, and noticed that entering SWD mode actually involves a JTAG sequence on the SWD pins. So maybe
hla_swd is actually trying to do the right thing. I might see if an EVB is offered that would rule out board issues.
The specific error I get with
openocd -d3 and
hla_swd in the config file is:
Debug: 252 12 stlink_usb.c:515 jtag_libusb_bulk_transfer_n(): ERROR, transfer 0 failed, error -9 Debug: 253 12 stlink_usb.c:515 jtag_libusb_bulk_transfer_n(): ERROR, transfer 1 failed, error -9 Debug: 254 1560 stlink_usb.c:515 jtag_libusb_bulk_transfer_n(): ERROR, transfer 0 failed, error -9 Debug: 255 1560 stlink_usb.c:515 jtag_libusb_bulk_transfer_n(): ERROR, transfer 1 failed, error -9 Error: 256 1560 stlink_usb.c:2882 stlink_usb_open(): read version failed
I see the reset pin toggling; I'm not sure about SWDIO/SWCLK (I should get a better scope). I don't understand why it's trying to do a bulk transfer without even reporting the target voltage first.