LED blinking project with STM32

Hardwares : STM32F103C8Tx , ST-LinkV2 






STM32CubeIDE Pinout&Configuration : 


In the System/Core settings, only Debug = Serial Wire is selected, while in the RCC, High Speed Clock(HSE) = Crystal/Ceramic Resonator is selected. The PC13 pin on the microprocessor can be selected GPIO_Output and given LED or any other different name as the Label name.

Clock Configuration settings can be made as follows :



In the Project Manager section, only theproject is given a name, STM32CubeID is selected as the Toolchain/IDE. After this step go to the Code Generator section on the left side and select second option from the top " Copy only the necessary library files ". Now it will generate the code when saved with CTRL+S keys. Or you can also generate the code using the " Device Configuration Tool Code Generation " button with a yellow icon in the upper-left menu bar.Now our main.c file will be formed. We'll write several codes here : 

We will write the code that will allow our led to blink with a delay in the while loop located under the MX_GPIO_Init() expression as follows: 

  {

  HAL_Delay(100);

  HAL_GPIO_TogglePin(LED_GPIO_Port,LED_Pin);

  }

Now, if we save our project again and say Debug from the menu bar at the top (click on the green bug icon), the design of the menu bar will change. Finally, if we press F8, we will see that the led starts flashing. By giving different values than 100 to the value of our Delay function above and Debugging it, we can observe how the led flashing speed changes.


Sources : 


https://freeelectron.ro/installing-st-link-v2-to-flash-stm32-targets-on-linux/

https://kodmek.com/keil-uvision-kullanarak-stm32f103c8-programlama.html

Comments

Popular posts from this blog

Parking sensor by using STM32CubeIDE and HC-SR04

Interface LCD 16x2 with STM32 by using STM32CubeIDE