2025-09-04 5:24 PM - last edited on 2025-09-11 6:33 AM by Andrew Neil
Hi, I'm getting started at embedded programming, I've got this blue pill board having the STM32F103C6 MCU and ST-LINK v2 programmer.
Here's my code, just to light up the LED on port C 13:
Despite the IDE flashes successfully the LED doesn't light up as I wanted, It will only lights up if I add a break point on debugging mode on Keil uVision
And here are my flash configurations:
Any help is appreciated.
2025-09-04 7:04 PM
Replace return 0; with while(1){}
2025-09-04 7:08 PM
It didn't work
2025-09-04 7:23 PM
Try to comment out GPIOC->BSRR = (1<<13);
2025-09-04 7:29 PM
It looks like your coding in assembly language? You don't have any comments on the lines of code for what they each do. But if the LED works in step mode in debugging then your program is probably ok but when you run it it runs too fast for human eyes to see it. It only blinks once and then your program ends. If you want to see a constant blinking you need to slow down the blinking like: LED on, delay, LED off. Also, put the code in a forever loop if you want it to blink ... forever instead of just once.
2025-09-05 12:42 AM
The ST-LINK/V2 you use is a clone of a genuine ST product and the support from ST experts is very limited. To get the support you need, please contact the third party you purchased this product from.
The same applies to your board called Blue Pill, because for years now, it has not been equipped with original STM32F103, but only with clones which are not supported by STMicroelectronics.
For assurance of using authentic ST products, we recommend purchasing exclusively through our official distributors, which you can find listed here: ST Official Distributors.
Regards
/Peter
2025-09-05 1:07 AM
PC13 needs to be LOW to illuminate the LED
...
GPIOC->BSRR = (1<<(13+16)); // RESET PC13, as LED ON with LOW state
while(1) {} // Infinite loop, so as not to exit
return 0;
}
2025-09-05 5:09 AM
Sorry for the late reply. I just started on the STM32 so I merely understand
2025-09-05 5:10 AM
I am coding in C C99 standard.
2025-09-05 5:14 AM
But I was trying to turn it on, it doesn't light up if I was not in Keil debugger mode and having the command paused at
GPIOC->BSRR = (1<<13);