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.
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)