A for-fun embedded systems project that brings the feel of a classic Mopar push-button start system to the STM32F429I-Discovery board. Complete with touchscreen support, animated LCD feedback, and LED indicators for each system state.
The Project
This project recreates the satisfying three-state push-button start sequence found in classic Chrysler/Dodge/Jeep vehicles on an STM32F429I-Discovery development board. Press the button (or tap the touchscreen) to cycle through STOP → START → RUN states with visual and LED feedback.
Key Features
Three-State System - Authentic Mopar-style state machine
- STOP - Red icon, red LED indicator (PG14)
- START - Orange shaking icon with both LEDs blinking
- RUN - Green icon, green LED blinking (PG13)
Dual Input Methods
- Physical blue USER button (PA0)
- Capacitive touchscreen via STMPE811 I2C controller
- Smart debouncing (100ms button, 50ms touch)
Hardware-Accelerated Graphics
- DMA2D (Chrom-ART) hardware acceleration
- LTDC display controller with double buffering
- Pre-rendered sprite cache in SDRAM (195 KB)
- Smooth animations capable of 120+ FPS
Production-Ready Features
- Watchdog timer for automotive-grade reliability
- UART debug output (115200 baud on PA9/PA10)
- Error handling with diagnostic LED patterns
- CMake build system with debug/release configurations
Technical Architecture
Display System
The project uses the STM32F429’s advanced graphics capabilities:
- RGB565 Color - 16-bit color depth (65,536 colors)
- 240x320 Resolution - ILI9341 LCD controller
- 8 MB SDRAM - For frame buffers and sprite cache
- LTDC Direct Access - Hardware layer composition
- DMA2D Acceleration - Hardware-accelerated fills and copies
Performance Optimizations
The display system was optimized for smooth animations:
Icon Sprite Cache
Pre-rendering icons to SDRAM provides 7.5x faster drawing:
- Before: 15ms per icon (8+ rectangle fills)
- After: 2ms per icon (single DMA2D transfer)
Partial Screen Updates
Clearing only the icon region during animations:
- 2-3x faster frame generation
- 58% fewer pixels cleared per frame
- ~36,000 pixels vs 76,800 full screen
Combined Result
Animation frames render ~6x faster (18ms → 3ms), enabling smooth 120+ FPS animations if needed.
State Machine
[Press] [Release] [Press]
STOP ─────────> START ─────────> RUN ─────────> STOP
The state machine is interrupt-driven with proper debouncing and watchdog protection for reliability.
Hardware Configuration
Required Hardware
- STM32F429I-Discovery Board - ARM Cortex-M4 @ 180 MHz
- Built-in Components:
- 2.4" TFT LCD (240x320)
- STMPE811 capacitive touch controller
- 2x User LEDs (PG13, PG14)
- User button (PA0)
- 8 MB SDRAM
Pin Connections
Function | Pin | Description |
---|---|---|
Button | PA0 | Push button input |
LED Run | PG13 | Green LED (RUN state) |
LED Stop | PG14 | Red LED (STOP state) |
UART TX | PA9 | USART1_TX (Debug output) |
UART RX | PA10 | USART1_RX (Debug input) |
I2C1 SCL | PB6 | Touch controller clock |
I2C1 SDA | PB9 | Touch controller data |
Build System
The project uses CMake with convenience scripts for quick building:
Quick Build Commands
# Debug build with UART output
./build-flash-debug.sh
# Production build (optimized, no debug output)
./build-flash-production.sh
Build Options
-DCMAKE_BUILD_TYPE=Debug
- Development with debugging symbols (-Og
)-DCMAKE_BUILD_TYPE=Release
- Production optimization (-O2
)-DBOOT_IMAGE_ENABLE=ON
- Display boot image (adds 150KB)-DDEBUG_UART_ENABLE=OFF
- Remove all debug overhead for production
Development Highlights
Lessons Learned
GPIO Alternate Functions
- Some LTDC pins use AF9 (PB0, PB1, PG10, PG12), not AF14
- Critical detail not clearly documented in datasheets
- Special thanks to dmitrystk’s stm32f429_ltdc reference
DMA2D Acceleration
- Hardware-accelerated graphics are essential for smooth UI
- Pre-rendering sprites to SDRAM provides huge performance gains
- Partial updates much faster than full-screen redraws
Touchscreen Integration
- STMPE811 I2C communication requires 100 kHz max clock
- Polling mode simpler than interrupts for this application
- 50ms debouncing prevents false triggers
Production Considerations
- Watchdog timer crucial for reliability (2 second timeout)
- UART debug can be completely compiled out for zero overhead
- Error LED patterns provide diagnostics without debug interface
Why This Project?
This was a for-fun project to explore:
- Bare-metal embedded programming without STM32 HAL abstractions
- Hardware graphics acceleration and DMA2D capabilities
- Professional build systems (CMake, toolchains)
- State machines and interrupt handling
- Production-ready practices (watchdog, error handling)
The Mopar push-button start was chosen because it’s:
- Simple enough for a weekend project
- Complex enough to be interesting
- Satisfying with tactile and visual feedback
- Recognizable to anyone familiar with classic Chrysler vehicles
Technical Stack
- Language: C (bare-metal, no HAL/RTOS)
- Toolchain: ARM GCC (arm-none-eabi)
- Build: CMake with custom toolchain file
- Debugger: ST-LINK via USB
- Libraries: CMSIS only (minimal dependencies)
Project Structure
stm32moparstartcontroller/
├── inc/ # Header files
│ ├── config.h # Configuration constants
│ ├── button_irq.h # Button interrupt handling
│ ├── drawing.h # LCD drawing primitives
│ ├── animation.h # Animation system
│ ├── effects.h # Visual effects
│ └── ... # Peripheral drivers
├── src/ # Source implementation
│ ├── main.c # Main application & state machine
│ ├── drawing.c # Display functions
│ ├── animation.c # Animation engine
│ └── ... # Peripheral implementations
├── lib/CMSIS/ # ARM CMSIS libraries
├── build-flash-debug.sh # Quick debug build script
├── STM32F429ZITx_FLASH.ld # Linker script
└── CMakeLists.txt # Build configuration
Future Enhancements
Potential improvements for this project:
- Add sound effects via DAC/speaker
- Implement actual relay control for automotive use
- Add configuration menu on touchscreen
- Create custom boot animation
- Port to other STM32 Discovery boards
- Add CAN bus interface for vehicle integration
Conclusion
This project was a fun exploration of STM32’s graphics capabilities and embedded systems development without relying on heavy frameworks. The hardware acceleration and optimization work made the difference between a sluggish prototype and a smooth, production-quality user interface.
The satisfying tactile feedback of cycling through START/STOP/RUN states with animated visual feedback makes this a great desk toy and conversation starter. Plus, it’s actually functional enough that with proper relay circuitry, it could control real automotive systems.
Key Takeaway: Hardware acceleration isn’t just for desktop GPUs—even modest microcontrollers like the STM32F429 have impressive graphics capabilities when you take the time to use them properly.
Error Codes
If things go wrong, the LEDs will blink error codes:
- HSE clock failure
- PLL initialization failure
- PLLSAI failure
- SDRAM initialization
- SDRAM test failure
- LTDC configuration
- SPI failure
- LCD initialization
Connect UART (PA9 @ 115200 baud) for detailed error messages and debugging information.