Skip to main content
BDimi
Associate
August 21, 2019
Question

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

  • August 21, 2019
  • 5 replies
  • 4349 views

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.

This topic has been closed for replies.

5 replies

mattias norlander
ST Employee
August 21, 2019

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?

BDimi
BDimiAuthor
Associate
August 21, 2019

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

mattias norlander
ST Employee
August 22, 2019

STM32CubeIDE works only with genuine STM32 parts.

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

BDimi
BDimiAuthor
Associate
August 22, 2019

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

Tesla DeLorean
Guru
August 22, 2019

>>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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
BDimi
BDimiAuthor
Associate
August 23, 2019

OK, thanks for support.

I will try to replace MCU or buy new BluePill.

Thanks.

TMaia.1
Associate
June 17, 2020

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?

mattias norlander
ST Employee
June 17, 2020

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.

TMaia.1
Associate
June 17, 2020

Hello Mattias, indeed. I wasn't clear enough.

Steps to reproduce:

1) Use a bluepill STM32F103C8 + St-link V2 + Stm32CubeIDE

2) Leave all configs as default and try to debug

I was running over and over my configurations. I was able to fix the problem.

As it seems, using native Stm32CubeMX ioc generate the problem. When it ask, do the migration for STM32CubeIDE.

Problem solved!

mattias norlander
ST Employee
June 18, 2020

@TMaia.1​, hmmm... interesting. MX itself is not "CubeIDE debug configuration"-aware.

The only reasons we can think of as to why "using native Stm32CubeMX ioc generate the problem" would be if MX uses the SWD/JTAG pins for some other function and thereby not making them available for debugger. You could double-check that if you want... Then again if your problem is solved - I am happy :)