Search code examples
arduinostm32st-link

How to upload a Arduino Program to a BARTH STG-850 via ST-LINK/V2 ISOL


I have a Barth Electronik STG-850 micro PLC, the ST-LINK/V2 ISOL Programmer and a VK-35 programming cable from Barth.

I did everything according to the docs

But I don't get a Virtual COM Port, just a USB Device "STM32 STLink".

No COM Port STM32 STLink

That doesn't show up in the Arduino IDE, so no download is possible.

I tried my normal Win 11 Pro PC as well as another running Windows 10. Same behaviour on both machines.

If I run the "ST-LINK_CLI.exe" with the "-List" Argument as described in the docs, I see that the ST-LINK is found but I guess that works through the USB interface:

.\ST-LINK_CLI.exe -List
STM32 ST-LINK CLI v3.0.0.0
STM32 ST-LINK Command Line Interface

--- Available ST-LINK Probes List ---

ST-LINK Probe 0:
     SN: 32FF6C063051563945572143
     FW: V2J45S7

----------------------------------

Does anybody know what I need to do in order to get this up and running?


Solution

  • I finally figured it out :-)

    I was able to read the target data with ST-LINK_CLI.exe -c SWD UR

    When I tried to programm the STD-850 from the Arduino IDE, I saw in the error message that a script called stlink_upload.bat that is in the same directory as the ST-LINK_CLI.exe (C:\Users<username>\AppData\Local\Arduino15\packages\STM32\tools\STM32Tools\2017.7.13/tools/win/stlink_upload.bat)

    After opening this file I saw that it programs the target with echo "" | stlink\ST-LINK_CLI.exe -c SWD -P %str% 0x8000000 -Rst -Run

    I realized that this command was missing the UR parameter.

    So the line has to be

    echo "" | stlink\ST-LINK_CLI.exe -c SWD UR -P %str% 0x8000000 -Rst -Run

    After adding it I'm able to program the STD-850 out of my Arduino IDE as expected. No need for a virtual serial port.