cancel
Showing results for 
Search instead for 
Did you mean: 

Problems debugging from STM32CubeIDE and Linux Debian

MHof
Associate II

Hello developers,

I am a beginner in STM32 programming.

I have the board STM32L152C-Discovery, the ST-Link V2 adapter and Linux Debian on my laptop installed.

I am using STM32CubeIDE as IDE.

I setup my first project in STM32CubeIDE with the automated code generation and added my own code for toggling LED 4, which is being connected to Pin 7 of the CPU.

I can build and compile the project, but not debug it. Following error comes:

Open On-Chip Debugger 0.10.0+dev-00021-g524e8c8 (2019-06-12-13:05)

Licensed under GNU GPL v2

For bug reports, read

   http://openocd.org/doc/doxygen/bugs.html

none separate

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

adapter speed: 8000 kHz

adapter_nsrst_delay: 100

Info : Listening on port 6666 for tcl connections

Info : Listening on port 4444 for telnet connections

Info : clock speed 1800 kHz

Error: init mode failed (unable to connect to the target)

in procedure 'init'

in procedure 'ocd_bouncer'

I am using the OCD debugger.

What can be wrong? Did I maybe have connected the wiring from ST-LINK-V2-adapter to the SWD pins of the board in a wrong way?

I also removed the jumper bridge from CN3 as described for debugging an external application. Did I forget something? Or do I have to change a solder bridge (if so, this would be stupid, because I do not have a soldering iron).

I have pictures of the wiring attached.

Many thanks in advance for your help!

Sincerely,

Marco

8 REPLIES 8

Ok, you've got that entirely backward. The headers on the discovery board are for output. Why can't you just use the on-board ST-LINK?

To connect to the STM32F3 target from an external ST-LINK you'd need to go to the SWDIO/SWCLK pins of the micro controller, either via the primary pin headers, or the target side of the two jumpers you removed.

Review the board schematics to understand the electrical connectivity.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I'd also recommend to use the on-board STLink (putting back the jumpers).

JW

MHof
Associate II

Hello you two,

first, thanks for your help!

But I do not know what exactly you mean with "on-board" ST-LINK. I read the manual of my board and I wired it exactly like it has been described there.

In the manual stands that you have to remove the jumpers from CN3 and wire the six pins from CN2 to the 20-pin-side of the ST-LINK-V2-adapter pins,

if you want to debug your own programm.

Sorry for my maybe in your view stupid questions but as I said I am totally new in programming STM32-devices.

And I am confused with all the terms like "ST-LINK (OpenOCD)" and "ST-LINK (ST-LINK GDB Server)" and so on..,

Maybe I have used the wrong debugger configuration in STM32CubeIDE?

Sincerely,

Marco

> In the manual stands

Which manual and where?

The STM32L152C-Discovery board contains already a 'F103 mcu which contains the STLink firmware; it's the mcu next to the USB connector. You don't need to connect an external STLink.

You can also try the CubeProgrammer program instead of the CubeIDE, to check whether the STLink debugger "talks" to the target 'L152 chip.

JW

MHof
Associate II

I have read that in document "UM1079" from the site www.st.com in chapter 4.2.2.

I also tried the CubeProgrammer, but this could not detect my board either.

So if I do not need the ST-LINK V2, so I can debug my program with a normal USB-connection to the board?

I have tried this, but now the IDE complains, that it cannot find a debugger.

MH​

Yes, you can program/debug using a normal usb cable hooked up to the mini usb on the board. This is definitely the recommended config. The external debugger isn't necessary.

You’ll need to set the onboard jumpers accordingly, on the right hand side of your picture. You probably removed them.

If you feel a post has answered your question, please click "Accept as Solution".
MHof
Associate II

Ok, I have connected my board with the normal USB to my laptop and made the jumbers on CN3 again.

But if I want to debug my program from STM32CubeIDE, I still get an error:

Open On-Chip Debugger 0.10.0+dev-00021-g524e8c8 (2019-06-12-13:05)

Licensed under GNU GPL v2

For bug reports, read

   http://openocd.org/doc/doxygen/bugs.html

srst_only separate srst_nogate srst_open_drain connect_assert_srst

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

adapter speed: 8000 kHz

adapter_nsrst_delay: 100

Info : Listening on port 6666 for tcl connections

Info : Listening on port 4444 for telnet connections

Info : clock speed 8000 kHz

Error: open failed (no matching adapter found)

in procedure 'init'

in procedure 'ocd_bouncer'

MHof
Associate II

I guess I have to install another debugger?

I tried to install the GDB C/C++ debugger like described at https://erika.tuxfamily.org/wiki/index.php?title=Tutorial:_STM32_-_Integrated_Debugging_in_Eclipse_using_GNU_toolchain.

But still no success..