cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Error: ST-LINK error (DEV_TARGET_CMD_ERR) when I try to connect to STM32F103C5T6.

FPayn.1
Associate II

Hi,

Although I'm quite familiar with Arduino and Teensy MCU's, I'm just getting started with STM32. I followed this 'getting started' video to upload an Arduino bootloader to my STM32F103C5T6 'blue pill' module, using an ST_LINK module.

Before uploading the bootloader, I verified that I could program an Arduino sketch (the 'blink' sketch) into the module. Then I followed the rest of the video and successfully uploaded the bootloader files using STM32CubeProgrammer.

However, now I can't seem to program the device using the USB connector; I get the following error from the Arduino IDE

+-----------------------------------------------------------------------+
 
> Trying to open the [usb:10000/0/0/2/4/8]...
> Unable to open the [usb:10000/0/0/2/4/8]
> Searching for [1209:BEBA] device...
##########
Error - [1209:BEBA] device is not found :(> Searching for [usb:10000/0/0/2/4/8] ...
> Finish
the selected serial port > Finish
 does not exist or your board is not connected

Troubleshooting, I figured out that I had uploaded the 'Medium and High Density' version instead of the 'Low Density' one (I misread the lettering on the chip), so I tried to reupload the bootloader. Unfortunately now I can no longer connect to the ST_LINK device. The serial number and other parameters show up, but when I click on 'Connect', the ST32CubeProgrammer application hangs with a 'Error: ST-LINK error (DEV_TARGET_CMD_ERR)' message, and I have to use Task Manager to kill the app (actually I have to kill Java in order to get the ST32CubeProgrammer app to exit). Here's the output:

16:19:22 : STM32CubeProgrammer API v2.5.0
16:19:28 : ST-LINK SN : 48FF70065067545629581587
16:19:28 : ST-LINK FW : V2J37S7
16:19:28 : Board : --
16:19:28 : Voltage : 3.49V
16:19:28 : Error: ST-LINK error (DEV_TARGET_CMD_ERR)

One last thing that may or may not be significant: The reason I got the wrong uploader version in the first place is because the chip itself actually says

STM32F103C5T6 (not 6 or 8 as it should). I originally misread the '5' as an '8' which would mean I needed the 'Medium or High Density' version. I now suspect this number should have been a '6', meaning I needed the 'Low Density' version instead.

I'm absolutely certain the chip numbering is STM32F103C5T6. I used a magnifying loupe, and spent some time examining the lettering, which is etched into the surface rather than printed. I was also able to visually compare the '5' to the '6' (in 'T6') so I am also pretty sure its actually a 5 and not a 6 or an 8.

Any clues as to what I'm doing wrong here, or how I can recover from what I've already done wrong?

TIA,

Frank

6 REPLIES 6
FPayn.1
Associate II

Additional data: I purchased two of these 'blue pill' modules, and the second one clearly shows 'STM32F103C8T6'

Frank

prain
Senior III

Be aware that some blue pill boards​ have fake MCUs (same name as original).

for programming issue, I suggest to connect to MCU under reset.​

S.Ma
Principal

The blue pill cost saving will probably cost you some debug time. Once the bootloader is screwed, try to connect an STLink to the target SWD lines and try to debug a simple while() code.

FPayn.1
Associate II

Thanks for the replies. I was able to reload the bootloader using a CKDevices FTDI I had lying around my lab. Ironically, I bought an ST_LINK module because I thought using it would be easier than the FTDI - boy was I wrong! 😉

I wasn't familiar with ST Micro and their line of MCU's at all before I started playing with their VL53L0X line of proximity sensors for a robotics project, so didn't know about the popular 'blue pill' at all. I guess it's a sign of success when your product is being pirated by the Chinese ;-).

“Imitation is the sincerest form of flattery that mediocrity can pay to greatness.�? - Oscar Wilde

Frank

S.Ma
Principal

blue pill, black pill... how much is your hourly debug time enables grand total cost...

FPayn.1
Associate II

Since I've been retired for almost a decade now, my hourly rate is pretty low. I can spend an infinite amount of time to obtain even small technology gains and still come out ahead! ;-).