0
votes

I am trying to Blink external LED using STM32CubeIDE and Proteus

     while (1)
  {
      HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
      HAL_Delay(100);
  }

STM Configuration [Proteus Blue Pill During Simulation)2

The LED doesn't blink

2
Did you configure PA1 as a GPIO output pin (can be done in STM32CubeIDE)?rel
@rel yes It's configured as output as shown in first pictureSherif Beshr
Try to set breakpoint to see if the app actually reach this code.GAMELASTER
There are many things that could be wrong, none of which are in the code fragment you have shown. Have you initialised the GPIO? Have you initialised the core clock? How you do that may vary depending on the framework you are using (if any). If it is a CubeMX project post likely SystemClock_Config() and MX_GPIO_Init(), like at wiki.st.com/stm32mcu/wiki/…Clifford
OK - the first thing you have to get right is the orientation of the LED - Anode to +ve. You have it the wrong way around. Either that or connect the cathode to GND rather then +3v3.Clifford

2 Answers

1
votes

I am assuming that you have configured the pin to be output correctly with no pull up or pull down resistor. Hence you will need to terminate the LED into the ground instead of 3.3V.

In the event there is no pull up or pull down resistor, the pin is neither high or low, the pin is in a "z-state" hence when you toggle the LED from low to high there is no potential difference between the pin and the LED so no current flows, and when the pin goes from High to low, the diode property (only allows current flow in one direction) of the LED doesn't let current flow into towards the board.

0
votes

The Problem Solved. First the polarity of the LED. Second the library of the blue pill on proteus doesn't support STM32FC103C8 that I selected on STM32CubeIDE. STM32FC103C6 should be selected instead.