2025-08-09 12:50 AM - edited 2025-08-09 12:53 AM
I used the settings and code below for a simple project: Blink an external DIP LED using the blue pill:
In Pinout & Configuration:
- PA5 => GPIO_Output
- user label: LED
The wire connections (like screenshot below):
PA5 pin => Resistor => Long leg (anode) of LED
Short leg (cathode) => GND on Blue Pill
And finally code:
while (1)
{
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
HAL_Delay(500);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
But the LED doesn't turn on!
What could be the reason?
The .ioc file is also attached.
Solved! Go to Solution.
2025-08-11 2:09 AM
@TechyAry wrote:1- Is the issue then with the blue pill itself? (Or maybe its debugger or utility)
Again, the Blue pill will (almost) certainly not have a genuine STM32 - so, if it works on a genuine STM32, definitely suspect the Blue Pill!
There are loads of posts here about the grief people have with these Blue Pills; eg,
@TechyAry wrote:2- Is there any specific type of breadboard I can purchase for my Nucleo board? (So that I can access all pins on the edges as well as the ones on the green lines below)
Probably not - because you need separate connections to pairs of adjacent pins.
But they are standard 0.1" pitch - so can be used with standard soldered prototyping boards.
You can also get prototyping boards to fit on the Arduino connectors.
But this a separate question - please start a new thread in the STM32 MCUs Boards and hardware tools section for that.
2025-08-09 1:22 AM
Note that the Blue Pill is not an ST product, and likely does not have a genuine STM32.
What testing/debugging/investigation have you done to find what's wrong?
If you simply take that flying lead and connect it to +3V, does the LED light?
What's going on here:
You seem to have both the LED and the resistor pushed into the same hole on the breadboard?!
2025-08-09 1:56 AM - edited 2025-08-09 1:57 AM
> What testing/debugging/investigation have you done to find what's wrong?
Using 3.3 => Anode => Cathode => resister => GND the LED turns on
Also, when using PC13 for the same purpose, the onboard LED blinks correctly.
Not sure what else I should do.
> If you simply take that flying lead and connect it to +3V, does the LED light?
You mean anode to 3.3 and cathode to GND without a resister?
>You seem to have both the LED and the resistor pushed into the same hole on the breadboard?!
yeah, because the resister's leads are very thin and I doubted they might not fit well into the holes.
2025-08-09 2:21 AM - edited 2025-08-09 2:24 AM
@TechyAry wrote:Also, when using PC13 for the same purpose, the onboard LED blinks correctly.
So the issue is with the PA5 pin, then.
Have you checked that it's making good contact with the breadboard?
Have you checked the board schematic to see if there's anything else connected to that pin?
Have you tried other PAxx pins?
Have you tried this on a real STM32?
Note that, for a real STM32, it's not recommended to drive LEDs from PC13, PC14 or PC15:
https://www.st.com/resource/en/datasheet/stm32f103c8.pdf#page=33
@TechyAry wrote:> If you simply take that flying lead and connect it to +3V, does the LED light?
You mean anode to 3.3 and cathode to GND without a resister?
No! Never connect an LED direct to a power supply without a resistor!
I meant to just take the top end of the red wire, and connect it to +3V:
@TechyAry wrote:yeah, because the resister's leads are very thin and I doubted they might not fit well into the holes.
and yet you have the other end in a hole on its own?!
Seriously, putting 2 wires into 1 hole is more likely to give an unreliable connection.
2025-08-09 4:16 AM - edited 2025-08-09 4:17 AM
Connecting the top end of the red wire to +3V will turn on the LED.
I also tested PB8 instead of PA5, yet no success.
The mcu seems to be normally connecting to the bread board.
Testing the same project with Nucelo-64 (STM32F411RE) works properly.
1- Is the issue then with the blue pill itself? (Or maybe its debugger or utility)
2- Is there any specific type of breadboard I can purchase for my Nucleo board? (So that I can access all pins on the edges as well as the ones on the green lines below)
2025-08-11 2:09 AM
@TechyAry wrote:1- Is the issue then with the blue pill itself? (Or maybe its debugger or utility)
Again, the Blue pill will (almost) certainly not have a genuine STM32 - so, if it works on a genuine STM32, definitely suspect the Blue Pill!
There are loads of posts here about the grief people have with these Blue Pills; eg,
@TechyAry wrote:2- Is there any specific type of breadboard I can purchase for my Nucleo board? (So that I can access all pins on the edges as well as the ones on the green lines below)
Probably not - because you need separate connections to pairs of adjacent pins.
But they are standard 0.1" pitch - so can be used with standard soldered prototyping boards.
You can also get prototyping boards to fit on the Arduino connectors.
But this a separate question - please start a new thread in the STM32 MCUs Boards and hardware tools section for that.
2025-08-11 3:28 AM
@TechyAry wrote:The mcu seems to be normally connecting to the bread board.
it looks like you have double-ended headers on your board; ie, connections are accessible both above & below the pill board.
So have you tried connecting direct to the "top" end of the header - instead of via the breadboard?
Breadboard contacts are notoriously unreliable.
2025-08-17 2:35 AM
Ended up being using male-to-female jumper wires. Handy.
2025-08-17 2:38 AM
Left the blue pill away and got back to the nucleo. IT works fine.
Something of the blue pill we didn't note seemingly is its jumpers. They can be switched based on the need.
Anyway, I'm much more OK with the nucleo.
Thanks for your help and comments.