How can I make ST-LINK debugging work?
Answer
Sometimes customers experience problems getting debugging to work with ST-LINK.
First of all, ensure that the ST-LINK gdbserver (found in the TrueSTUDIO entry in the Windows Start-menu) is started before a debug session is launched.
In some cases, the ST-LINK will not initialize properly. In such a case, try the following sequence that works for most customers:
- Connect the ST-LINK to the electronic board (with power off)
- Connect power to the electronic board
- Connect the ST-LINK USB cable into the PC
- Start the ST-LINK gdbserver
- Launch a TrueSTUDIO debug session from inside the IDE
You can see in the ST-LINK gdbserver console window if connection is established with the H/W or not.
- If the final printout from the gdbserver is "Waiting for client to connect on port <PORTNR>..." everything is fine.
- If the gdbserver print "Error in Initializing ST-Link device" and terminate, the gdbserver cannot connect to the hardware. Try the sequence above to make it work.