Project Title: SparkUI – Bare-Metal STM32 Dashboard
This project is a real-time, bare-metal hardware interface built on the RT-Spark STM32 development board. It acts as an interactive dashboard that bridges the physical and digital worlds. By reading inputs from a physical 5-way joystick, the system instantly triggers digital logic to control external discrete LEDs and render dynamic text on a high-speed 16-bit TFT LCD screen.
I wanted to strip away the safety net of modern operating systems and learn how hardware truly functions at the silicon level. Instead of relying on something like Linux or an RTOS (Real-Time Operating System), I decided to write "bare-metal" C code using STM32's Hardware Abstraction Layer (HAL).
I wanted the challenge of:
Figuring out how to route electrical signals using physical pin mapping.
- Figuring out how to route electrical signals using physical pin mapping.
Decoding and modifying third-party driver software (RT-Thread) to work in a bare-metal environment.
- Decoding and modifying third-party driver software (RT-Thread) to work in a bare-metal environment.
Understanding complex memory buses like the Flexible Static Memory Controller (FSMC) to push graphics to a screen.
- Understanding complex memory buses like the Flexible Static Memory Controller (FSMC) to push graphics to a screen.
It was an exercise in pure embedded systems engineering—fixing floating reset pins, aligning memory addresses, and making the hardware do exactly what I coded it to do.
The system operates on a continuous, high-speed loop driven by a 168/180 MHz system clock, executing three main phases:
- Hardware Initialization: On startup, the C code manually toggles specific GPIO pins. It pulls the LCD backlight pin (PF9) high to provide power and sends a precise electrical timing sequence to the hardware reset pin (PD3) to wake the screen up from its default sleep state.
- Input Polling: The microcontroller rapidly reads the voltage states of the GPIO pins connected to the 5-way joystick. It actively checks for active-low signals (meaning a button is pressed and the circuit is grounded). The software even accounts for physical hardware quirks, electronically swapping the left and right inputs (
GPIO_PIN_5andGPIO_PIN_2) to match the user's physical orientation - Dynamic Output: When an input is detected, the logic routes the signal to two places. First, it pulls the designated LED pin low to illuminate a colored light. Second, it uses the FSMC mapped to memory address
0x68000000to rapidly overwrite the pixels on the LCD, displaying a crisp white confirmation message (e.g., "Button left is pressed") on a pitch-black background.
The Final Result in Action:
The camera starts on the blank black screen with the "Hello World" startup text. A hand comes into frame and presses the joystick Up, illuminating the Red LED. The joystick is then pressed Left and Right; with each press, the specific text "Button left is pressed" and "Button right is pressed" instantly pops up on the screen in white text, disappearing the moment the joystick is released.








Comments