Sysprogs forums › Forums › VisualGDB › Debug STM32, Unable to connect to target
Tagged: "init mode failed", stm32, Visual Studio 2015
- This topic has 2 replies, 2 voices, and was last updated 11 months, 2 weeks ago by gboy.
-
AuthorPosts
-
January 7, 2024 at 07:54 #35210gboyParticipant
I’m a new user on a Windows 10 PC running Visual Studio Community 2015. I’m trying to use VisualGDB to create a basic SMT32Cube project on the STM3210E-EVAL board using an ST-Link / V2 programming adapter.
I’m following this Sysprogs tutorial. I get to the point of performing my first build of the program (which builds successfully) and then try to put a break-point in the code and start the debugger when I get the VisualGDB dialog error: “init mode failed (unable to connect to the target)” (see attached)
I have independently installed the drivers for the ST-Link as part of installing the STLink Utility software. In device manager, if I ‘View Devices by Type’ “STM32 STLink” shows up under the ‘Universal Serial Bus devices’ category. If I instead ‘View Devices by Connection’, I find it in the category: “ACPI x64-based PC\Microsoft ACPI-Compliant System\PCI Express Root Complex\Intel(R) USB 2.0 eXtensible Hose Controller – 1.0 (Microsoft)\USB Root Hub (USB 3.0)\Generic USB Hub” and in there there is a ‘Generic USB Hub’ and the ‘STM32 STLink’ device.
I get this error when running from Visual Studio using either “Debug => Start Debugging” or “Debug => Start Debugging with GDB”
(I also tried to connect the ST Link to a different USB port on my computer but that has not helped.)
I can click on a link in the VisualGDB error dialog that says ‘view gdb stub log’ and get this readout:
C:\<my path>\AppData\Local\VisualGDB\EmbeddedDebugPackages\com.sysprogs.arm.openocd\bin\openocd.exe -c "gdb_port 53598" -c "telnet_port 53596" -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c init -c "reset init" -c "echo VisualGDB_OpenOCD_Ready" Open On-Chip Debugger 0.12.0 (2023-10-02) [https://github.com/sysprogs/openocd] Licensed under GNU GPL v2 libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3 For bug reports, read http://openocd.org/doc/doxygen/bugs.html WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'. Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD Info : clock speed 1000 kHz Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748 Info : Target voltage: 3.232169 Error: init mode failed (unable to connect to the target)
Are there any ideas on what I’m doing wrong to get Visual Studio to step-debug my STM3210E-EVAL board?
- This topic was modified 11 months, 2 weeks ago by gboy.
- This topic was modified 11 months, 2 weeks ago by gboy.
Attachments:
You must be logged in to view attached files.January 7, 2024 at 09:21 #35214supportKeymasterHi,
This looks like an issue between a particular ST-Link and the target. It could be caused by wiring, broken target, or something else. You can try getting it working with STM32CubeIDE first. If it works there and doesn’t work with VisualGDB, we can help you compare the OpenOCD command lines and get it working as well.
January 8, 2024 at 08:11 #35216gboyParticipantThanks @support. I was able to fix my issue. Turns out I had to set ‘Debug’ to ‘Serial Wire’ in the SYS tab of the CubeMX interface. This properly assigns the PA13 & PA14 pins to the TMS and TCK signals necessary for debugging with the ST-Link / V2 adapter.
I can now step through my code in Visual Studio.
Thanks again.
-
AuthorPosts
- You must be logged in to reply to this topic.