A high-performance Engine Control Unit (ECU) simulator built from the registers up on the STM32F446RE.
Ignition V2.0 is the ultimate evolution of a multitasking ECU simulator. While V1.0 was built using the standard ST HAL, V2.0 represents a complete "HAL Purge." Every peripheral driver was rewritten from scratch at the register level to achieve maximum efficiency, lower memory footprint, and high-speed execution.
photo_2026εΉ΄02ζ11ζ₯_19-32-28
The core mission of V2.0 was to remove all dependencies on the stm32f4xx_hal libraries. This required performing "brain surgery" on the system architecture:
- β‘ 180MHz Manual Clock Config: Bypassed
HAL_RCC_OscConfigto manually tune the PLL, Flash Latency (5WS), and Power Over-drive mode. - π‘ Custom DMA-to-RAM Pipeline: Replaced
HAL_ADC_Start_DMAwith a custom register-level driver that handles multi-channel scan modes and circular data transfers with zero CPU overhead. - π£οΈ Interrupt-Driven UART: Built a non-blocking UART driver using custom Ring Buffers, replacing the blocking
HAL_UART_Transmitcalls. - π₯οΈ TFT Library Porting: Refactored a 3rd-party ILI9341 driver by stripping out all HAL SPI and GPIO calls, replacing them with my own high-speed bare-metal implementations.
photo_2026εΉ΄02ζ11ζ₯_19-32-23
The ECU manages five concurrent high-priority tasks using FreeRTOS:
- ADC-DMA Task: Continuously monitors Engine Temp and Throttle position via a 15MHz sampled DMA pipeline.
- Logic Engine: Calculates RPM and Cooling requirements based on real-time sensor data.
- Dashboard Task: Renders a high-refresh-rate UI using my custom bare-metal SPI driver.
- Fuel Management: Precise fuel level calculation using Timer Input Capture and Binary Semaphores.
- Actuator Control: Manages the 3-stage fan cooling system via GPIO-driven relay modules.
The engineering effort is visible in the Core directory:
- π
Core/mydriver/: The pure bare-metal library created for this project (gpiox.c,MyDMA.c,MyUsart.c,MyTimer.c,MyAdcDMA.c). - π
Core/Inc&Core/Src: Application logic and the refactored ILI9341 GFX library. - π
Core/legacy_driver/: Archived Phase 1 HAL-based code for performance benchmarking and reference. - π
Core/ThirdParty/FreeRTOS: Manually integrated kernel source.
I have extracted the drivers from this project into a standalone, modular SDK for the F446RE.
π Explore the Library: stm32-baremetal-drivers-F446RE
Developed in the Kurdistan region of Iraq, this project was born from a desire to master the "magic" inside automotive control modules. Every register bit was verified using the 700+ page Reference Manual, overcoming geographic and toolchain limitations through persistence and low-level mastery.
Ignition V2.0 is a production-grade demonstration of bare-metal firmware design and real-time operating system integration.