| KNOWLEDGE BASE

A rich source of expert knowledge

Learn from experts in the world of embedded systems

STM32 Programming Tutorial for Custom Hardware | SWD, PWM, USB, SPI - Phil's Lab #13

Overview of how to write test firmware for a custom STM32-based PCB, in particular for a variant of one made using the hardware design tutorial videos (including various sensors, flash memory, USB, etc.).

Includes topics such as: STM32CubeIDE, SWD and ST-Link, Timers and PWM (RGB LED), USB (Virtual COM Port), SPI (driver for inertial measurement unit). By no means a complete tutorial but rather a guide on how to approach writing firmware when you first get your custom boards!
Chapters:
  • 00:00Assembled Boards
  • 02:53Hand-Soldered Components
  • 03:26Initial Testing Suggestions and ST-Link/USB Connections
  • 04:45How to Order (JLCPCB)
  • 06:36STM32CubeIDE Overview
  • 07:43CubeIDE Project Creation
  • 08:44Pin and Peripheral Assignment
  • 12:40Clock Configuration
  • 13:43USB CDC Config
  • 14:28SPI Baud Rate Config
  • 15:10Timer PWM Config
  • 18:23RGB LED Firmware (Timers and PWM)
  • 21:38Debugging via ST-Link and SWD
  • 24:11USB Virtual COM Port Firmware (USB CDC)
  • 29:05Inertial Measurement Unit (IMU) (SPI in Polling Mode)
  • 37:28Final Testing