External Led Blink Using STM32F401CE
by devraj4520 in Circuits > Electronics
45 Views, 0 Favorites, 0 Comments
External Led Blink Using STM32F401CE
![WhatsApp Image 2024-04-09 at 17.54.02_39c684cb.jpg](/proxy/?url=https://content.instructables.com/FWX/50YF/LUQYR1H4/FWX50YFLUQYR1H4.jpg&filename=WhatsApp Image 2024-04-09 at 17.54.02_39c684cb.jpg)
Tody we are using STM32F401CE to Blink an LED , using STM32cubeIDE and HAL programming.
Supplies
![F F wire.jpeg](/proxy/?url=https://content.instructables.com/F11/0W2J/LUQYR1OZ/F110W2JLUQYR1OZ.jpg&filename=F F wire.jpeg)
![STM32F401CE.jpeg](/proxy/?url=https://content.instructables.com/FDO/AIWG/LUQYR1P6/FDOAIWGLUQYR1P6.jpg&filename=STM32F401CE.jpeg)
![usb-c-type-cable.jpg](/proxy/?url=https://content.instructables.com/F1V/4CJ2/LUQYR1PF/F1V4CJ2LUQYR1PF.jpg&filename=usb-c-type-cable.jpg)
![Screenshot 2024-04-09 180806.png](/proxy/?url=https://content.instructables.com/FMJ/RQ96/LUQYR1Q9/FMJRQ96LUQYR1Q9.png&filename=Screenshot 2024-04-09 180806.png)
The Material required For this project is:
- STM32F401CE
- C-type Cable
- F-F Jumper Wires
- LED 3v
Creating New File in STM32cubeIDE
![Screenshot 2024-03-17 101441.png](/proxy/?url=https://content.instructables.com/F94/JUO4/LUQYR1RO/F94JUO4LUQYR1RO.png&filename=Screenshot 2024-03-17 101441.png)
Open STM32cubeIDE>> file>> New>> STM32 project
Select Board and Name of Project
![Screenshot 2024-03-17 101613.png](/proxy/?url=https://content.instructables.com/FVA/E0TX/LUQYR1WT/FVAE0TXLUQYR1WT.png&filename=Screenshot 2024-03-17 101613.png)
![Screenshot 2024-03-17 101646.png](/proxy/?url=https://content.instructables.com/FMH/6BJK/LUQYR1X8/FMH6BJKLUQYR1X8.png&filename=Screenshot 2024-03-17 101646.png)
After opening new project select the board STM32F401CE
and After Selecting board name your project.
Pinout Configration
![Screenshot 2024-04-09 182225.png](/proxy/?url=https://content.instructables.com/FEF/TX4C/LUQYR2CL/FEFTX4CLUQYR2CL.png&filename=Screenshot 2024-04-09 182225.png)
![Screenshot 2024-04-09 182240.png](/proxy/?url=https://content.instructables.com/FZD/BVUM/LUQYR2E6/FZDBVUMLUQYR2E6.png&filename=Screenshot 2024-04-09 182240.png)
In pinout configration, choose pin PC14 by Clicking it, select its mode as GPIO_OUTPUT.
Clock Configration
![Screenshot 2024-04-09 183253.png](/proxy/?url=https://content.instructables.com/FZK/CRVF/LUSE57VO/FZKCRVFLUSE57VO.png&filename=Screenshot 2024-04-09 183253.png)
![Screenshot 2024-04-09 182319.png](/proxy/?url=https://content.instructables.com/FOA/C9CE/LUSE586Z/FOAC9CELUSE586Z.png&filename=Screenshot 2024-04-09 182319.png)
In system Core >> RCC >> high speed clock(HSE)>>Crystal/ceramic resonator.
In clock configration set clock as shown in figure.
Opening Code File
After setting Pinout and configuring clock, save your project by pressing CTRL+S,
New coding file will open.
Programming for Blinking of LED
![Screenshot 2024-04-09 182707.png](/proxy/?url=https://content.instructables.com/F9S/Q9HB/LUSE58Z6/F9SQ9HBLUSE58Z6.png&filename=Screenshot 2024-04-09 182707.png)
In while loop write code provided,
Here is the Explanation of code:
- HAL_GPIO_WritePin(GPIOC,GPIO_PIN_14,1); - This line sets the state of the pin 14 (which is connected to the LED) on GPIO port C to HIGH (1). When the pin is set to HIGH, it provides voltage to the LED, causing it to light up.
- HAL_Delay(1000); - This line causes the program to wait for 1000 milliseconds, or 1 second. During this time, the LED remains lit.
- HAL_GPIO_WritePin(GPIOC,GPIO_PIN_14,0); - This line sets the state of the pin 14 on GPIO port C to LOW (0). When the pin is set to LOW, it cuts off the voltage to the LED, causing it to turn off.
- HAL_Delay(1000); - This line causes the program to wait for another 1000 milliseconds, or 1 second. During this time, the LED remains off.
Downloads
Debuging
![Screenshot 2024-03-17 110848.png](/proxy/?url=https://content.instructables.com/FDM/P5A0/LUSE59HI/FDMP5A0LUSE59HI.png&filename=Screenshot 2024-03-17 110848.png)
![Screenshot 2024-04-09 185009.png](/proxy/?url=https://content.instructables.com/F1J/YJAW/LUSE59XH/F1JYJAWLUSE59XH.png&filename=Screenshot 2024-04-09 185009.png)
After writing code, Debug using Hammer option as shown in figure and your coding file is saved as name given in console.
Connecting STM32F401CE
![Screenshot 2024-03-15 112822.png](/proxy/?url=https://content.instructables.com/FP5/YXDY/LUSE5AUL/FP5YXDYLUSE5AUL.png&filename=Screenshot 2024-03-15 112822.png)
Open STM32cubeProgrammer change ST-LINK to USB and click Connect, while our stm32 board is connected with Your PC by USB
Uploding Code
![Screenshot 2024-03-15 112755.png](/proxy/?url=https://content.instructables.com/FIO/BMIR/LUSE5AYX/FIOBMIRLUSE5AYX.png&filename=Screenshot 2024-03-15 112755.png)
![Screenshot 2024-03-15 112810.png](/proxy/?url=https://content.instructables.com/F2X/29KQ/LUSE5B01/F2X29KQLUSE5B01.png&filename=Screenshot 2024-03-15 112810.png)
Goto Erasing and Programming option>>browse your file path.
choose option as shown in the picture. Click Start automatic mode.
Finish
![FWX50YFLUQYR1H4.jpg](/proxy/?url=https://content.instructables.com/FTX/ZSF8/LUSE5C45/FTXZSF8LUSE5C45.jpg&filename=FWX50YFLUQYR1H4.jpg)
Your Led will Start blinking .
Follow for more content