STM32 ILI9341 Graphics Interface: Seamless Integration of TFT Displays

by Marwen Maghrebi

In this article, we’ll cover the STM32 ILI9341 Graphics Interface, demonstrating how to connect the STM32 microcontroller to the ILI9341 TFT display for enhanced graphical output.

STM32 ILI9341 Graphics Interface: Complete Interfacing Guide

Things used in this project

Software apps and online services:

1- STMicroelectronics STM32CubeMX

2- STMicroelectronics STM32CubeIDE

3- Proteus 8

STM32 Microcontroller Integration with ILI9341 TFT Display via SPI: Simulation in Proteus

In this project, we will explore the STM32 ILI9341 graphics interface by integrating STM32 microcontrollers and ILI9341 TFT displays using the Serial Peripheral Interface (SPI) communication protocol.

Impact and Versatility of ILI9341 TFT Display Module in Embedded Systems:

The ILI9341 TFT (Thin Film Transistor) is a popular color TFT display module used in embedded systems for displaying graphical content. Based on the ILI9341 controller, it is a versatile and powerful graphics controller capable of driving TFT displays with a resolution of up to 320×240 pixels. The ILI9341 TFT display module typically features a 2.8-inch diagonal screen size and supports 65K colors, making it widely used in various applications, such as IoT devices, wearables, home automation systems, and industrial control panels, where visual feedback and user interactions are required.

Control and Functionality Options of ILI9341 TFT Display: SPI and I2C Communication Interfaces:

The ILI9341 TFT display module is usually controlled using parallel or serial communication interfaces, including SPI (Serial Peripheral Interface) or I2C (Inter-Integrated Circuit). This graphics interface supports a wide range of operations, such as displaying text, images, animations, and touch input for user interactions.

Component Requirements and Pin Connections for STM32 Microcontroller to ILI9341 TFT Display Interfacing:

To interface the STM32 microcontroller with the ILI9341 TFT display using SPI communication, we need a few essential components. Firstly, we require the STM32 microcontroller, which serves as the main MCU controlling the overall operation of the embedded system. Secondly, we need the ILI9341 TFT display module itself,. Finally, we need to establish the SPI interface between the STM32 microcontroller and the ILI9341 TFT display, which typically requires connecting specific pins for communication, including SCK (Serial Clock), MOSI (Master Output Slave Input), MISO (Master Input Slave Output), and CS (Chip Select) and also connect two output pins DC (Data/Command): This is the control signal used to distinguish between data and command information during SPI communication. It is used to indicate whether the data being sent is pixel data for display or commands for configuration and RESET: This is the reset signal used to reset the ILI9341 TFT display.

Overall, this project provides example of how to interface an STM32 microcontroller with an ILI9341 TFT display using SPI communication protocol in a Proteus simulation environment.

STM32CubeMX Configuration:

  • Open CubeMX & Create New Project Choose The Target MCU STM32F103C6 & Double-Click Its Name
  • Go To The Clock Configuration & Set The System Clock To 72MHz
  • Configure The GPIO Pins PA4 (Chip Select) as Output Pin
  • Configure The GPIO Pins PB0, PB1 [(Data/Command) & RESET} as Output Pins
  • In the Categories tab, select the SPI1 & Transmit Only Master
  • In the Parameter settings tab, set the Prescaler (for baud Rate) to 64
  • Generate The Initialization Code & Open The Project In CubeIDE

STM32CubeIDE Configuration :

  • Write The Application Layer Code
  • ili9341.h & ili9341.c
  • ili9341_touch.h & ili9341_touch.c
  • fonts.h & fonts.c
  • testimg.h
  • main.c

Proteus Configuration :

  • Open Proteus & Create New Project and click next

  • Click on Pick Device
  • Search for STM32F103C8 & ILI9341
  • Click on Terminal Mode then choose (DYNAMIC & POWER &GROUND)
  • finally make the circuit below and start the simulation
STM32 ILI9341 TFT Display connection diagram

That’s all!

If you have any questions or suggestions don’t hesitate to leave a comment below

You Might Also Like

6 comments

PHLu September 29, 2024 - 5:39 am

How can i use touch on this ????

Reply
Marwen Maghrebi September 30, 2024 - 10:02 am

You can use touch functionality with the ILI9341 TFT, but it works only with actual hardware, not in simulation.

Reply
SAJIB November 29, 2024 - 11:16 am

ALL IS OK BUT NOT WORK IN MY PROTUSE

Reply
Marwen Maghrebi November 29, 2024 - 3:59 pm

Hey! Glad to hear you’re trying it out. If it’s not working in Proteus, make sure you’re using version 8.15 or above, as older versions can have compatibility issues. Also, try lowering the clock frequency and reducing the SPI speed—it often helps with stability in simulations. Let me know if it works after that!

Reply
Samuel Moraes January 8, 2025 - 9:04 pm

How did you convrte the image?

Reply
Marwen Maghrebi January 9, 2025 - 8:30 am

I used the LCD Image Converter tool. It’s super handy for converting images for LCD displays. You can check it out here: LCD Image Converter. https://lcd-image-converter.riuson.com/en/about/

Reply

Leave a Comment


Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
-
00:00
00:00
Update Required Flash plugin
-
00:00
00:00