STM32 VL DISCOVERY (STM32F100RB) -- ST-Link/V1 -- problem uploading to target

Hello All,

I am learning mbed on a 5-year old STM32 VL DISCOVERY board that was lying around (platform: ststm32, board: disco_f100rb, framework: mbed). I am on a Win7 machine.

I can build the binary, but see this issue while uploading.

2017-03-03T20:03:24 WARN C:\Users\User\Downloads\stlink\src\usb.c: Error -12 (No error) opening ST-Link/V2 device 001:004
*** [upload] Error -1

The STM32VLDISCOVERY uses the ST-Link/V1 protocol (mounts the board as a USB storage device), but seems platformio is trying to upload using the ST-Link/V2 protocol instead.

When I try to use the st-util to connect (forcing ST-Link/V1), I see

##> st-util.exe --stlink_version=1 -v99
2017-03-03T20:55:57 WARN C:\Users\User\Downloads\stlink\src\sg.c: Failed to find an stlink v1 by VID:PID
2017-03-03T20:55:57 ERROR C:\Users\User\Downloads\stlink\src\sg.c: Could not open stlink device

I have the STMicro “official” GUI “ST-LINK Utility” program v4.0.0.0, I am able to connect to my board and upload the binary built by platformio and can get my blinky program to work.

19:39:04 : ST-LINK SN : ST-Link/V1_on_E:
19:39:04 : ST-LINK Firmware version : V1J13S0
19:39:04 : Connected via SWD.
19:39:04 : Connection mode : HotPlug.
19:39:04 : Debug in Low Power mode enabled.

Ideally, I would like to upload using platformio and get gdb up over ST-Link/V1 .

Anyone knows how?

Thanks in advance.

–anirbax

@valeros do you have any ideas?

Can you try invoking the platformio packaged stlink with the “-1” flag
See here

The “-1” flag forces stlink to use the V1 protocol. If manually invoking the st-util with the flag works fine then all you have to do is pass the requisite flags in platformio.ini file.

Hi @anirbax! Could you please try to run "st-util.exe -1" using 1.3.0 version from this page?

Hi Krishna_Chaitanya: yes, I have tried passing the “-1” option to stlink – it still did not work.

Hi valeros: Unfortunately, my setup is on a 32-bit Win7 laptop. The 1.3.0 binaries are 64-bit only.

Thanks!

–anirbax

I did not see it earlier, but how come the path given to st-util is pointing to Downloads/stlink ??

Shouldnt the bundled st-util be under the /Users/.platformio folder???

Are you trying the run the executable manually??

Can you please post the console output when you hit the upload button from atom IDE.
and can you post the contents of your platformio.ini file??

Also, what is VID:PID as reported by windows?? Is there a windows centric driver that you should install for the board to show up in device manager?? If so did you install it??

Does the board show up as a storage disk in windows explorer??
If so, can you simple try dragging and dropping the compiled binary manually from the .pioenvs directory onto the disk and check if the program runs??

Hi,

Command: platformio.exe run -e disco_f100rb --target upload

[03/11/17 11:08:18] Processing disco_f100rb (platform: ststm32, board: disco_f100rb, framework: mbed)
---------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Collected 8 compatible libraries
Looking for dependencies...
Project does not have dependencies
Compiling .pioenvs\disco_f100rb\FrameworkMbed-TARGET_STM-611d4\stm_spi_api.o
<bunch of other compile statements>
Compiling .pioenvs\disco_f100rb\src\main.o
Linking .pioenvs\disco_f100rb\firmware.elf
Checking program size
text       data     bss     dec     hex filename
30016      2200     872   33088    8140 .pioenvs\disco_f100rb\firmware.elf
Building .pioenvs\disco_f100rb\firmware.bin
Uploading .pioenvs\disco_f100rb\firmware.bin
2017-03-11T11:08:57 WARN C:\Users\User\Downloads\stlink\src\usb.c: Error -12 (No error) opening ST-Link/V2 device 001:006
*** [upload] Error -1
======================================================== [ERROR] Took 38.89 seconds ========================================================

From above, the USB VID:PID seems to be 001:006

However, when I manually invoke st-util forcing ST-LINK/V1 mode (st-util.exe -1), I see:

2017-03-11T11:14:26 WARN C:\Users\User\Downloads\stlink\src\sg.c: Failed to find an stlink v1 by VID:PID
2017-03-11T11:14:26 ERROR C:\Users\User\Downloads\stlink\src\sg.c: Could not open stlink device

The directory/line numbers “C:\Users\User\Downloads\stlink\src\sg.c” seems to refer to the assertions
present in the original source code during compiling the utility.

Thanks

–anirbax

What does windows show as the Vid:pid in the device manager ??
And does the board show up as a storage disk in windows explorer?? Can you drag and drop the binary on to the disk and does it run then??

Hi,

I can’t find what VID:PID Windows uses for the board, but I see it loaded as a disk drive.

It shows up in Windows Explorer as a read-only disk – I can’t drag-drop the binary into the window.

Thanks.

I think your problem is more to do with the stm32 mbed drivers than platformio. Did you search for such issues on the mbed website?? Maybe that might yield some results.

I don’t use windows and don’t have the same board to suggest any further actions. Sorry.

Thanks for the help.

I found only the link to the ST-LINK V2 drivers on the mbed page (ST Link Driver - | Mbed) – links to the ST.com website.

However, since the ST-LINK GUI utlity from the ST website works (STSW-LINK004 - STM32 ST-LINK utility (replaced by STM32CubeProgrammer) - STMicroelectronics) works,and since I have ST-LINK V1 drivers from (…/embedded-software/stsw-link009.html) already installed, platformio+mbed should have no issues either.

Thanks