cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot download code into STM32f103 by St-Link v2 in STM32CubeIDE

BDimi
Associate II

HI,

I have trouble with downloading code in MCU STM32F103 (Blue Pill) by ST-Link v2.

I have also try to download, read, erase MCU by STM32CubeProgrammer and it works correctly.

Project was made by STMCube as Atolic project and after that it was converted to STMCubeIDE project. Firmer, which is made by STMCubeIDE and downloaded in MCU by STMCubeProgrammer works as expected.

14 REPLIES 14
mattias norlander
ST Employee

What if you first use CubeProgrammer to do a full chip erase, and then try to use CubeIDE with ST-LINK GDB-server to start a debug session (and thereby flash the application)?

Does that work?

I've tried it one more time. Unfortunately without success. Please take a look on snippets form CubeIDE and Cube Programmer.

Version of CubeProgrammer is v2.1.0, CubeIDE is 1.0.2

0690X00000AA4OlQAL.png0690X00000AA4OSQA1.png

STM32CubeIDE works only with genuine STM32 parts.

Make sure that your BluePill board embeds a genuine STM32 device.

BDimi
Associate II

Hello,

ST Link v2 is original STM product bought from famous distributor in EU. You can see picture below.

BluePill is bought on open market but MCU is origin STM product. I hope, I can not believe that there are "fake" STM MCU's on market.

From my point off view, it looks like that GDB - server can not establish connection with ST LInk. Why, I do not know. Also, I can not understand how CubeProgrammer can deal with that MCU but CubeIDE can not.

In meanwhile, I have tried to utilize JTAG but without success. I could use CubeProgrammer, but could not CubeIDE.

0690X00000AA9H6QAL.jpg0690X00000AA9GXQA1.jpg

>>Also, I can not understand how CubeProgrammer can deal with that MCU but CubeIDE can not.

Probably because the latter uses OpenOCD or some crappy DLL/Driver combination.

Check the settings/configuration items for the GDB Server, perhaps try less aggressive clocks settings if those are options. Enable Verbose mode so you might get richer diagnostic information.

Likely also works properly under Keil.

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

Both CubeIDE and ST-LINK GDB-server performs check of vendor ID. If the device does not return the proper vendor code we can conclude that the device has not been manufactured by ST.

We know for sure that there are numerous STM32 clones out there.

CubeProgrammer does not seem to perform this check, not sure if it is on their roadmap or not. OpenOCD for sure does not make the check.

Based on this assumption I would assume that your BluePill is a dead-end.

I don't know where you bought the BluePill, but consider sourcing it from a more "established" distributor. :)

Sorry about the inconvenience! This is not something we can support.

BDimi
Associate II

OK, thanks for support.

I will try to replace MCU or buy new BluePill.

Thanks.

TMaia.1
Associate II

Hi, I am having a similar problem. I put the boot0 at 1 and worked. It doesn't feel right. When I used ac6 openSTM, I don't remember of doing that. Is that correct?

With similar problem, do you mean that you get the "Reason (18) Could not verify ST device. Abort connection." error?

Ac6 with OpenOCD debugger back-end did not perform the clone device detection. CubeIDE with ST-LINK GDB server does. So, assuming your bluepill embeds a cloned ST device, this is perfectly expected.

If other error message, then please elaborate.