Skip to content

ziteh/stm32-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STM32 Examples

This repo contains some basic examples for STM32.

LibOpenCM3

LibOpenCM3 is an open source ARM Cortex-M microcontroller library.

My blog posts: 簡單入門 LibOpenCM3 STM32 嵌入式系統開發

Examples F103RB F446RE F401RE F302R8 L432KC G431KB
Blinking LED ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
GPIO input ✔️ ✔️ ✔️ ✔️ ✔️
EXTI button ✔️ ✔️ ✔️ ✔️ ✔️
USART with printf() ✔️ ✔️ ✔️ ✔️
USART receive interrupt ✔️ ✔️
Timer ✔️ ✔️
SysTick delay ✔️ ✔️
PWM ✔️ ✔️
IWDG ✔️ ✔️
WWDG ✔️ ✔️
ADC (Regular single channel) ✔️ ✔️
ADC (Injected multi channel) ✔️
ADC (Interrupt) ✔️ ✔️
ADC (External trigger by timer) ✔️ ✔️
SPI (Master mode) ✔️ ✔️
SPI (Slave mode) ✔️ ✔️
I2C (LCD 1602) ✔️ ✔️
I2C (EEPROM 24C256) ✔️ ✔️
CRC ✔️ ✔️

STM32 LL

STM32 Low Layer.

Examples G431KB
ADC (Injected TRGO) ✔️
UART Printf ✔️
UART Printf (Ring buffer/kfifo) ✔️
UART Printf (tiny) ✔️

Check the code under the User folder in each project.

STM32 HAL

STM32 Hardware Abstraction Layer.

Examples F103RB F446RE G431KB
Blinking LED ✔️

Usage

Clone the repo:

git clone --recursive https://github.com/ziteh/stm32-examples.git

or

git clone https://github.com/ziteh/stm32-examples.git
git submodule update --init --recursive

LibOpenCM3 & STM32 HAL

  1. Install VSCode and PlatformIO IDE.
  2. Open example project folder (e.g. blink example) in VSCode.
  3. Selecte environment (STM32 board). Ref
  4. Build project and upload to STM32 board. Ref

STM32 LL

Download STM32CubeIDE and open the project.

References

Code

STM32 Documentation

License

My code is licensed under the MIT License. Other code is licensed under their own licenses (e.g., CMSIS under Apache 2.0, STM32 HAL/LL under BSD-3-Clause), which can be identified at each level of the folder or at the beginning of each file.