cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the STLink BRIDGE API - UART bridge?

Roadrunner1805
Associate III

I want to use the STLink BRIDGE API and setup a C++ project. So far the GPIO worked fine, next I want to use the UART. I found the following Warning in the docu: "UART "bridge" is not supported on the STLink USB bridge interface. This functionality is currently provided through a second VCP interface using VCP UART."

How does this work exactly? Has anybody experience and tried this?

8 REPLIES 8
Pavel A.
Evangelist III

I think this text means that [modern] ST-LINK devices expose the target UART interface as a separate USB function, so the host applications just use this interface as independent VCP - not via ST-LINK API.

Maybe ST-LINK firmware once had provision to access the target UART interface via its main USB function.

You can tell which VCP on the host corresponds to the ST-LINK (if there are several of them) using host OS specific libraries or APIs.

Roadrunner1805
Associate III

Ok. Thanks.

Are there any plans to update the API to support the Bridge UART as well?

Roadrunner1805
Associate III

One more question: Is it possible to flash/program a target if the bridge is connected? At the moment I have to disconnect the bridge and then I can flash/program. But is there any dll or API where I haven't to do this?

Pavel A.
Evangelist III

> Is it possible to flash/program a target if the bridge is connected? 

The ST-LINK DLL (on Windows) works thru WinUSB, and it does not support multiple concurrent applications. So, unfortunately, only one client app can connect to ST-LINK. Either your program or CubeProgrammer.

The VCP function is separate and can be used independently from ST-LINK. This is good.

Roadrunner1805
Associate III

Thanks.

For progamming/flashing I'm uisng the RF-Flasher. Is there no DLL available?

For the STLink Bridge I'm using the STLinkUSBDriver.dll.

So is it not possible to use both DLL's in parallel? For example connect the STLink with the STLinkUSBDriver.dll, do some stuff and then use the program/flash DLL without connect/disonnect the STLink.

One program can perform any task after connection to the st-link device thru winusb API.

The problem seems to be that there's no "DLL" for flashing.

Roadrunner1805
Associate III

Ok. This is bad. I thought that there is also a DLL for flashing. How does the RF-Flasher then work?

It contains a copy of openocd.exe.

That in its turn uses libusb.dll, that on Windows calls winusb.

Maybe openocd (some version) already has ability to share the debugger connection.

If not - in theory one can "hook" the lowest interface layer, libusb, to share the connection between your app and the openocd. Quite a hack.