Tic-Tac-Toe Game on STM32 Board
STM32 Tic-Tac-Toe Game with HAL, Interrupts, and Timers
Project Overview
This project showcases a full implementation of the classic Tic-Tac-Toe game on the STM32F429i Discovery Board.
Built as the final project for ECEN 2370 – Embedded Systems, the goal was to integrate multiple peripherals and concepts learned throughout the course, including interrupts, timers, and RNG.
The game features two modes (single player and multiplayer), a clean LCD-based UI, and an AI opponent driven by pseudo-random logic. It also tracks wins, losses, and elapsed game time — offering a complete and interactive embedded experience.
A responsive, real-time game implemented entirely through embedded C and STM32 HAL.
Project Scope
This project scope covered virtually all the topics learned throughout the course. The breakdown is as follows:
- Utilized Peripherals:
- RNG (Random Number Generator): Used for random moves in the game.
- Timers: Used for timing game events.
- Interrupts: Used for handling user input and game reset logic.
- LCD Screen: Displayed the intro screen, game board, and game result screen.
- Tic-Tac-Toe Game:
- Standard 3x3 game board.
- User selects either single player or multiplayer mode.
- Implemented X’s and O’s.
- Game ends when someone gets 3 in a row or if there is a stalemate.
- Additional Requirements Implemented:
- Created two screens besides the game board screen:
- One for selecting the game mode.
- One for displaying game results, time elapsed, and current record (W-L-Ties).
- Implemented AI logic for 1 player using the RNG (brute force possibilities).
- Created two screens besides the game board screen:
Key Features
- Designed a user-friendly interface on the LCD screen for game mode selection, gameplay, and result display.
- Created AI opponent using RNG-based logic for dynamic single-player mode.
- Utilized HAL for peripheral control, including the LCD, timers, and RNG.
- Implemented external interrupts for user input and game resets.
Technical Stack
- Hardware: STM32F429i Discovery Board
- Language: C (Embedded C)
- Framework: STM32CubeIDE, STM32 HAL (Hardware Abstraction Layer)
- Concepts: Timers, RNG, External Interrupts, FSMs
- Display Interface: LCD display via memory-mapped I/O
- Tools: STM32CubeMX, JTAG Debugger, Logic Analyzer (for testing input timing)