Skip to main content
Associate
April 2, 2025
Solved

Black Pill: Debugging STM32F103RCT6 in Keil Fails to Enter main()

  • April 2, 2025
  • 17 replies
  • 5620 views

Title edited to highlight that this is a "Black Pill" board


  • MCU: STM32F103RCT6

  • Toolchain: Keil MDK v5.31 + DAPLink debugger

  • Behavior:

    • Program flashes successfully via DAPLink.

    • Debug session starts but never enters main() – halts at address 0x200001E0 (check Disassembly/Register window).

    • All debug buttons (Step, Run) are grayed out except Reset/Stop.

  • Key Observations:

    • Same code runs correctly on another STM32F103 board.

    • Rebuild/Clean did not resolve the issue.

merose_0-1743582902994.png

The "Option for target" as below.

merose_1-1743583253545.png

merose_2-1743583272480.pngmerose_3-1743583294382.png

merose_4-1743583305233.png

merose_0-1743583956883.png

This topic has been closed for replies.
Best answer by mƎALLEm

Hello,

ST resources are dedicated to supporting genuine ST products. We are not committed to ensuring that clones/fakes work properly with the firmware we provide.

Thank you for your understanding.

17 replies

mƎALLEm
ST Technical Moderator
April 2, 2025

Hello @merose and welcome to the ST community,

Are you using Blue pill or Black pill board?

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
meroseAuthor
Associate
April 2, 2025

It's Black Pill. What's the difference between them?

Andrew Neil
Super User
April 3, 2025

@Ozone wrote:

If the MCU itself is indeed a "fake", you don't know whats in it. And thus you can't predict it's behavior..


@merose  You might be able determine something using the this previously-mentioned utility:

https://mecrisp-stellaris-folkdoc.sourceforge.io/bluepill-diags-v1.640.html

 


@Ozone wrote:

I don't know where these fake MCUs come from and how they they created. 


Some of them are bona-fide 3rd-party "compatible" chips - much like a huge number of manufacturers had (some still have) "8051-compatible" products.

Some of them might even be "enhanced" versions (again, like 8051/2).

Others may be just plain duds

See: https://mecrisp-stellaris-folkdoc.sourceforge.io/bluepill-diags-v1.640.html#clones

and: https://mecrisp-stellaris-folkdoc.sourceforge.io/bluepill-diags-v1.640.html#bluepill-mcu-candidates

Also: STM32 - Originals, Clones and Counterfeits

 

Another problem with buying from places like ali express, amazon, ebay is that you have no guarantee that any two boards will actually use the same chip.

That's one reason why they are cheap. You gets what you pays for!

 


@Ozone wrote:

I would cut the losses, stop wasting time, and get proper MCUs.


Absolutely!

@merose Get a genuine Nucleo board - which comes complete with a genuine ST-Link; eg,

https://www.st.com/en/evaluation-tools/nucleo-f103rb.html

At least, use that to get familiar with the part and the tools - then, maybe, you will be equipped to dig into what's going on with these fake/clone chips

 

#Fake #Clone #FakeSTM32 #CloneSTM32 #BlackPill #BluePill #Pill

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
April 2, 2025

Welcome to the forum.

Please give details of your two boards - see: How to write your question to maximize your chances to find a solution.

 


@merose wrote:
  • MCU: STM32F103RCT6


Are you sure it's a genuine ST chip?

 


@merose wrote:
    • Debug session starts but never enters main() – halts at address 0x200001E0 


So somewhere in the startup code.

Look at the startup code to see what should be happening ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Ozone
Principal
April 2, 2025

As usual, try to locate the "Run to main" setting in your debugging environment, and disable it.
The code obviously fails in the init code, most probably during clock setup.
If the same code runs properly on "another board", memory size and lication issues are unlikely - unless these are not the same kind of board.
Differently placed jumpers that affect settings might be another reason.

meroseAuthor
Associate
April 2, 2025

Thanks.I will try this.

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
April 14, 2025

Hello,

ST resources are dedicated to supporting genuine ST products. We are not committed to ensuring that clones/fakes work properly with the firmware we provide.

Thank you for your understanding.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.