External LED Blink Using STM32F401CE
by Arshdeep singh in Circuits > Electronics
28 Views, 0 Favorites, 0 Comments
External LED Blink Using STM32F401CE
![Screenshot 2024-04-09 175711.png](/proxy/?url=https://content.instructables.com/F1H/CBNF/LUQYQYZ4/F1HCBNFLUQYQYZ4.png&filename=Screenshot 2024-04-09 175711.png)
Let's dive into the exciting world of embedded systems by learning how to make an LED blink using the STM32F401CE microcontroller. This microcontroller is a powerful yet accessible tool for creating all sorts of electronic projects.
we will blink an external LED, using STM32F401CE with HAL programming.
Supplies
![Screenshot 2024-04-09 181002.png](/proxy/?url=https://content.instructables.com/FCZ/90AJ/LUQYQZ3Z/FCZ90AJLUQYQZ3Z.png&filename=Screenshot 2024-04-09 181002.png)
![Screenshot 2024-04-09 180854.png](/proxy/?url=https://content.instructables.com/FTN/FOTH/LUQYQZ46/FTNFOTHLUQYQZ46.png&filename=Screenshot 2024-04-09 180854.png)
![Screenshot 2024-04-09 180824.png](/proxy/?url=https://content.instructables.com/FAU/W06O/LUQYQZ4D/FAUW06OLUQYQZ4D.png&filename=Screenshot 2024-04-09 180824.png)
![Screenshot 2024-04-09 181133.png](/proxy/?url=https://content.instructables.com/FB2/0PAR/LUQYQZ4L/FB20PARLUQYQZ4L.png&filename=Screenshot 2024-04-09 181133.png)
- STM32F401CE
- LED 3V
- Jumper wires M-F
- C-type Cable
Open New File in STM32cubeIDE
![Screenshot 2024-03-12 150750.png](/proxy/?url=https://content.instructables.com/FC7/DAXV/LUQYQZDK/FC7DAXVLUQYQZDK.png&filename=Screenshot 2024-03-12 150750.png)
Open STM32cubeIDE>>file>>New>>STM32project.
Configure Your STMcubeIDE
![Screenshot 2024-03-12 151107.png](/proxy/?url=https://content.instructables.com/F0I/LLV9/LUSE5QZ2/F0ILLV9LUSE5QZ2.png&filename=Screenshot 2024-03-12 151107.png)
Select your stm board, after selecting rename it.
PIN Mode Selection
![Screenshot 2024-04-09 182651.png](/proxy/?url=https://content.instructables.com/FWN/S03N/LUQYQZLQ/FWNS03NLUQYQZLQ.png&filename=Screenshot 2024-04-09 182651.png)
set the pin c14 for GPIO_output.
Pinout & Clock Configuration
![Screenshot 2024-04-09 183805.png](/proxy/?url=https://content.instructables.com/FR1/15F5/LUSE5R8M/FR115F5LUSE5R8M.png&filename=Screenshot 2024-04-09 183805.png)
![Screenshot 2024-04-09 183823.png](/proxy/?url=https://content.instructables.com/FXG/GKDG/LUSE5R99/FXGGKDGLUSE5R99.png&filename=Screenshot 2024-04-09 183823.png)
System core>>RCC>>High speed clock(HSE)>>Crystal/ceramic Resonator.
In clock configuration fill the columns shown in the picture.
How to Open Code File
![Screenshot 2024-04-09 184535.png](/proxy/?url=https://content.instructables.com/F14/9W3J/LUSE5S8F/F149W3JLUSE5S8F.png&filename=Screenshot 2024-04-09 184535.png)
Now press ctrl+s to open codding file, After this the new code file will open.
Add the Code
![Screenshot 2024-04-09 184822.png](/proxy/?url=https://content.instructables.com/F4C/8CC0/LUSE5SIJ/F4C8CC0LUSE5SIJ.png&filename=Screenshot 2024-04-09 184822.png)
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_14,1);
HAL_Delay(1000);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_14,0);
HAL_Delay(1000);
write this code in while loop.
Building Binary File
![Screenshot 2024-03-12 160000.png](/proxy/?url=https://content.instructables.com/F09/MC75/LUSE5STA/F09MC75LUSE5STA.png&filename=Screenshot 2024-03-12 160000.png)
Click on debug (On top left corner) to generate binary file.
Open STMCubeProgrammer and Connect With STM Board Via USB
![Screenshot 2024-04-09 185612.png](/proxy/?url=https://content.instructables.com/FYU/86EF/LUSE5SXI/FYU86EFLUSE5SXI.png&filename=Screenshot 2024-04-09 185612.png)
Change ST-Link to USB and click on 'Connect'
Go to Download Options
![Screenshot 2024-03-15 111912.png](/proxy/?url=https://content.instructables.com/F42/MT59/LUSE5TME/F42MT59LUSE5TME.png&filename=Screenshot 2024-03-15 111912.png)
Modify Download Options and Click on "Start Automatic Mode
![Screenshot 2024-04-09 190221.png](/proxy/?url=https://content.instructables.com/FS7/XVAQ/LUSE5TR7/FS7XVAQLUSE5TR7.png&filename=Screenshot 2024-04-09 190221.png)
Fill the all options shown in picture.
Final Step
![Screenshot 2024-04-09 190420.png](/proxy/?url=https://content.instructables.com/F73/APZX/LUSE5UCE/F73APZXLUSE5UCE.png&filename=Screenshot 2024-04-09 190420.png)