User avatar
NormanDunbar
Posts: 114
Joined: Wed Nov 23, 2011 12:13 pm
Location: Leeds, West Yorkshire, England.
Contact: Website Twitter

ST-Link for debugging?

Fri Jan 22, 2021 10:33 am

I'm rather excited by the new Pico and I'm still waiting for my subscription copy of Hackspace magazine to get my hands on my first one, even though the shops have the magazine before me! :(

Anyway, I've been reading the docs and it says that for debugging (C/C++) I should be connecting a Pi4 to the Pico *directly* and not through any other means, for best results.

As I develop on a Linux laptop, I was wondering, perhaps insanely, that as I have a couple of ST-Link programmers for my Blue Pills (which I'm just starting to learn to use) and the debugging connections looks similar, can I safely use the ST-Link to connect to the Pico from Linux, and do my debugging that way?

Many thanks in advance.

Take care and stay safe everyone.


Cheers,
Norm.
Author of Arduino Software Internals. Learn how your hardware and software work together.
Why do they put lightning conductors on churches?
Why did Tarzan never have a beard?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 28423
Joined: Sat Jul 30, 2011 7:41 pm

Re: ST-Link for debugging?

Fri Jan 22, 2021 10:58 am

The debugging port on the Pico is a Single Wire Debug (SWD). When connected to a Pi we bitbang the Pi GPIO's to do that SWD, and access via OpenOCD. We also have Picoprobe, which is code for a Pico to use it as a USB->SWD convertor, but you need another Pico to be the convertor.

You can of course simply Drag and Drop your code to the Pico without any extra HW, but you lose debugging facilities.

There's LOADS of stuff in the getting started guide about all this.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Working in the Application's Team.

User avatar
NormanDunbar
Posts: 114
Joined: Wed Nov 23, 2011 12:13 pm
Location: Leeds, West Yorkshire, England.
Contact: Website Twitter

Re: ST-Link for debugging?

Fri Jan 22, 2021 11:05 am

Thanks for the reply James.

I'm working my way through the docs even as I type! I have to say that for "day 1" docs, you have done yourselves proud. Thanks for all the effort.


Cheers,
Norm.
Author of Arduino Software Internals. Learn how your hardware and software work together.
Why do they put lightning conductors on churches?
Why did Tarzan never have a beard?

pica200
Posts: 270
Joined: Tue Aug 06, 2019 10:27 am

Re: ST-Link for debugging?

Fri Jan 22, 2021 2:36 pm

I don't see why you would not be able to use the st-link unless ST blocks using it with any competitor microcontroller in software. A SWD capable debugger obviously works with a SWD capable microcontroller ;)

User avatar
NormanDunbar
Posts: 114
Joined: Wed Nov 23, 2011 12:13 pm
Location: Leeds, West Yorkshire, England.
Contact: Website Twitter

Re: ST-Link for debugging?

Sat Jan 23, 2021 9:05 am

Thanks @pica200. I might still give it a try, Given I'm developing all my stuff on my laptoo and not on a Pi, yet, I was wondering.

My ST-Link devices are most likely clones. Bought from AZ Delivery in Germany, before Brexit made things "difficult".

Thanks again.

Stay safe.

Cheers,
Norm.
Author of Arduino Software Internals. Learn how your hardware and software work together.
Why do they put lightning conductors on churches?
Why did Tarzan never have a beard?

kilograham
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 472
Joined: Fri Apr 12, 2019 11:00 am
Location: austin tx

Re: ST-Link for debugging?

Sat Jan 23, 2021 8:03 pm

RP2040 uses Multi-drop SWD.. so ST-Link needs to support that (it may IDK). basically the major (blocking) difference is that despite backwards compatibility in the protocols, at startup no device is selected on the bus, therefore you have to select one of the cores before you talk to it. (Also obviously if you want to debug both cores, ST-Link has to support that too)

efe373
Posts: 1
Joined: Wed Apr 14, 2021 9:34 pm

Re: ST-Link for debugging?

Wed Apr 14, 2021 9:35 pm

Did you try debugging with ST-Link v2? Was it successful?

jayben
Posts: 247
Joined: Mon Aug 19, 2019 9:56 pm

Re: ST-Link for debugging?

Thu Apr 15, 2021 1:00 pm

It doesn't work; there is a major difference in the commands that have to be sent to an RP2040 or STM32 in order to enable SWD operation.

lurk101
Posts: 524
Joined: Mon Jan 27, 2020 2:35 pm
Location: Cumming, GA (US)

Re: ST-Link for debugging?

Thu Apr 15, 2021 4:25 pm

jayben wrote:
Thu Apr 15, 2021 1:00 pm
It doesn't work; there is a major difference in the commands that have to be sent to an RP2040 or STM32 in order to enable SWD operation.
A common problem with commercial SWD programmers. They only work with their bundled software, and don't specify their host side protocol.
Growing old is getting old.

vorosj
Posts: 19
Joined: Fri Aug 05, 2016 10:17 pm

Re: ST-Link for debugging?

Thu Apr 15, 2021 10:04 pm

J-link is working with the RP2040, including the not so expensive edu and edu mini versions. The Segger Embedded Studio supports the Pico too.

lurk101
Posts: 524
Joined: Mon Jan 27, 2020 2:35 pm
Location: Cumming, GA (US)

Re: ST-Link for debugging?

Thu Apr 15, 2021 10:34 pm

vorosj wrote:
Thu Apr 15, 2021 10:04 pm
J-link is working with the RP2040, including the not so expensive edu and edu mini versions. The Segger Embedded Studio supports the Pico too.
Does it support multi-drop SWD?
Growing old is getting old.

bgolab
Posts: 215
Joined: Sat Jan 30, 2021 12:59 pm

Re: ST-Link for debugging?

Fri Apr 16, 2021 9:41 am

Yes, it uses multi-drop, tested on J-Link EDU Mini V1

https://www.segger.com/downloads/jlink/ ... JLink.html
J-Link EDU Mini V1

SWD multi-drop was not supported by accident. This caused some devices to be not supported (e.g. the Raspberry RP2040 series devices). Fixed.


lurk101
Posts: 524
Joined: Mon Jan 27, 2020 2:35 pm
Location: Cumming, GA (US)

Re: ST-Link for debugging?

Sun Apr 18, 2021 8:22 pm

Unfortunately I don't see any supporting software that will run on 64 bit ARM Linux (PI4).
Growing old is getting old.

AlexG87
Posts: 1
Joined: Fri Apr 30, 2021 7:33 pm

Re: ST-Link for debugging?

Fri Apr 30, 2021 7:36 pm

Oh there is software that runs on Rpi4 (Linux ARM 64-bit):

https://www.segger.com/downloads/jlink

https://www.segger.com/downloads/embedded-studio

Just to name 2 examples for the previously mentioned J-Link solution

Return to “General”