STM32 Black Pill Board | Blinking On-board LED
by Maitali sharma in Circuits > Microcontrollers
44 Views, 1 Favorites, 0 Comments
STM32 Black Pill Board | Blinking On-board LED
![cover.png](/proxy/?url=https://content.instructables.com/FIP/GKC6/LVTJLXIC/FIPGKC6LVTJLXIC.png&filename=cover.png)
This blog post is a guide to start your STM32 Black Pill and control the on-board LED using a program on STM32CubeIDE.
Supplies
Software:
- STM32CubeIDE
- STM32CubeProgrammer
Hardware:
- Desktop or a laptop
- USB-C cable
- STM32 Black Pill
Create a Project File on STM32CubeIDE
![Screenshot 2024-05-06 122027.png](/proxy/?url=https://content.instructables.com/FLI/UYC7/LVTJLX2D/FLIUYC7LVTJLX2D.png&filename=Screenshot 2024-05-06 122027.png)
![Screenshot 2024-05-06 122100.png](/proxy/?url=https://content.instructables.com/F3M/RIMT/LVTJLX2I/F3MRIMTLVTJLX2I.png&filename=Screenshot 2024-05-06 122100.png)
![8864f5e5-2327-4ec3-a914-a2689ae1b80e.png](/proxy/?url=https://content.instructables.com/FVN/EJ08/LVTJLX2O/FVNEJ08LVTJLX2O.png&filename=8864f5e5-2327-4ec3-a914-a2689ae1b80e.png)
- Type the project name.
- Choose your preferred programming language, binary type and project type.
- Choose "Add necessary library files" for less errors and problems.
Pinout & Clock Configurations
![4.png](/proxy/?url=https://content.instructables.com/FY1/5BIZ/LVTJLX3O/FY15BIZLVTJLX3O.png&filename=4.png)
![5.png](/proxy/?url=https://content.instructables.com/F7K/UDJ5/LVTJLX3Y/F7KUDJ5LVTJLX3Y.png&filename=5.png)
Save your file.
Code
![]6.png](/proxy/?url=https://content.instructables.com/FAK/3GJT/LVTJLX63/FAK3GJTLVTJLX63.png&filename=]6.png)
![7.png](/proxy/?url=https://content.instructables.com/FWL/Y5NK/LVTJLX6H/FWLY5NKLVTJLX6H.png&filename=7.png)
![8.png](/proxy/?url=https://content.instructables.com/FM3/H787/LVTJLX6I/FM3H787LVTJLX6I.png&filename=8.png)
- Save your file, this will generate files.
- Go to Core < Src < main.c.
- Go to int main() which is around line 95.
- Change the code inside while(1).
- Debug the code .
Open the Project File in File Explorer
![9.png](/proxy/?url=https://content.instructables.com/FLX/2OZ3/LVTJLX7T/FLX2OZ3LVTJLX7T.png&filename=9.png)
- Copy the path of .elf file.
Setup STM32CubeProgrammer
![all.png](/proxy/?url=https://content.instructables.com/FRF/P3A2/LVTJLXB1/FRFP3A2LVTJLXB1.png&filename=all.png)
![all 2.png](/proxy/?url=https://content.instructables.com/F2Q/ELT4/LVTJLXBN/F2QELT4LVTJLXBN.png&filename=all 2.png)
![ll.png](/proxy/?url=https://content.instructables.com/FKX/3H1L/LVTJLXCA/FKX3H1LLVTJLXCA.png&filename=ll.png)
![fff.png](/proxy/?url=https://content.instructables.com/F9K/WUMB/LVTJLXCY/F9KWUMBLVTJLXCY.png&filename=fff.png)
- We will bootload STM using USB, this tutorial does not use ST-Link.
- Next, press on "Open file" and select the .elf file from the project folder.
- Press on "Download".
Result
![11.png](/proxy/?url=https://content.instructables.com/F0Q/ZO3Y/LVTJLXF5/F0QZO3YLVTJLXF5.png&filename=11.png)
![f4a73dd1-7b20-4337-9eef-5e1c7b705eb0.png](/proxy/?url=https://content.instructables.com/F9D/CHOO/LVTJLXFX/F9DCHOOLVTJLXFX.png&filename=f4a73dd1-7b20-4337-9eef-5e1c7b705eb0.png)
Once compiled, disconnect and reconnect the STM board using USB-C cable.
your STM32 Board's onboard LED should now start blinking.