This commit is contained in:
2026-05-29 09:07:29 +03:00
parent d32fcbab9b
commit 21141c29b2

106
Readme.md
View File

@@ -1,10 +1,104 @@
Some working code examples for STM32 # Repository Overview
====================================
Built without any third-party library. The `stm32samples` repository is a collection of low-level, bare-metal code examples and complete
projects for various STM32 microcontroller series (F0, F1, F3, F4, G0). It uses CMSIS header files
from `modm-io/cmsis-header-stm32` for register definitions.
Supported F0, F1, F3, F4 and G0 series. ## Project Structure by MCU Series
### STM32F0 (F030, F042, F072)
- **3steppersLB** Controls 3 stepper motors with encoders via USB/CAN bus
- **blink** Simple LED toggling
- **CANbus4BTA** CAN replacement for PEP-CAN
- **CANBUS_SSI** Works with BTA SSI azimuth encoder
- **Chiller** Basic chiller temperature controller
- **F0_testbrd** Tests STM32F0x2 on custom board
- **htu21d_nucleo** Reads HTU-21D sensor on Nucleo-F042K
- **morze** Echoes USART1 data as Morse code on TIM3CH1 (PA6)
- **NUCLEO_SPI** SSI over SPI on Nucleo-F042K
- **PL2303_ringbuffer** USB CDC ACM with ring buffers
- **QuadEncoder** Quadrature encoder via timer
- **Servo** Controls SG-90 style servos
- **Socket_fans** Manages multiple fans
- **TM1637** Drives 7segment displays
- **tsys01_nucleo** Reads two TSYS01 sensors
- **uart_blink & uart_blink_dma** USART echo with DMA
- **usbcan_relay** Relay board over CAN bus
- **usbcan_ringbuffer** USBCAN adapter with ring buffers
- **USBHID** USB HID keyboard + mouse
CMSIS-headers: ### STM32F1 (F103)
https://github.com/modm-io/cmsis-header-stm32 - **BMP180, BMP280** I²C temperature/pressure sensors
- **Canon_managing_device** Controls Canon lenses
- **canUART** UARTCAN bridge
- **DHT22_DHT11** Humidity sensors using timer+DMA
- **DS18** DS18x20 temperature sensors
- **F1_testbrd** Test board for LQFP48 packages
- **I2Cscan** I²C scanner with register R/W
- **LED_Screen** Drives 32×16 LED matrices (P10)
- **MAX7219_screen** Controls 8×8 LED matrices
- **RGB_LED_Screen** HUB75E RGB panel with 8.8.4 color
- **SevenCDCs** Seven USBCDC ACM instances on one MCU (joke project)
- **shutter** Bistable shutter via USB/external signal
- **Tetris** Tetris on HUB75E panel
- **USB_HID** USB HID mouse+keyboard
- **ws2815** Rainbow effect on WS2815 strips
### STM32F3 (F303)
- **ADC** Works with ADC peripheral
- **blink** Toggles LEDs on PB0/PB1
- **CANusb** USBCAN adapter
- **floatPrintf** Converts floats to strings
- **Multistepper** Controls up to 64 multiplexed steppers
- **NitrogenFlooding** Automatic nitrogen flooding
- **PL2303** PL2303 emulator (old)
- **Seven_CDCs** Seven USB CDC ACM interfaces
- **usart1fullDMA** USART1 Rx/Tx DMA with match detection
- **USB_template_CDC** USBCDC template
### STM32F4 (F401)
- **blink** Simple LED toggling
### STM32G0 (G070, G0B1)
- **blink** Basic LED blink
- **RTC** Realtime clock
- **flash** Flash memory operations
- **g0b1** USBCDC working on G0B1
- **i2c** I²C operations
- **usart** USART communication
### Other Directories
- **deprecated** Archive of older, nolongermaintained code
- **snippets** Small reusable code fragments
- **testboard** KiCad 8 design files
## Development Environment
- **Toolchain**: arm-none-eabigcc with `-flto` optimisations
- **Build**: Structured Makefiles per series
- **Debug**: OpenOCD configuration files provided
- **Libraries**: No thirdparty libraries; only CMSISSVD headers
## Project Maturity
- **Alpha**: USB template for F303, MLX90640 allsky camera
- **Stable**: LED blink, UART echo, sensor interfaces, USBCDC
- **Draft**: CANbus4BTA, MLX90640multi
- **Deprecated**: Older code in `deprecated/`
## Summary
This repository is a valuable resource for learning lowlevel STM32 programming without vendor
libraries. It covers practical applications:
- **Industrial control**: Stepper motors, CAN bus, relay boards
- **Sensor interfacing**: Temperature, pressure, humidity, encoders
- **Humanmachine interfaces**: LED matrices, 7segment displays, USB HID
- **Communication**: UART, SPI, I²C, USBCDC, USBHID, CAN
- **Prototyping**: Test boards for F0, F1, F3, G0
For the latest updates, check the repository on GitHub.
## License
This repository is provided under the GNU General Public License v3 or later.
Full text of the GPLv3 is available at <https://www.gnu.org/licenses/gpl-3.0.html>.