STM32 ST7735 TFT Display SPI: A Complete Guide to Interfacing

by Marwen Maghrebi

This article covers interfacing STM32 with ST7735 color TFT display using SPI. You’ll learn about the required components, connections, and programming techniques to display graphics and text on the TFT screen.

STM32 ST7735 TFT Display SPI: Complete Interfacing Guide

Things used in this project

Software apps and online services:

1- STMicroelectronics STM32CubeMX

2- STMicroelectronics STM32CubeIDE

3- Proteus 8

Displaying Graphics and Text on ST7735 TFT LCD with STM32 Microcontroller:

This project involves interfacing STM32 with the ST7735 TFT display using SPI communication in Proteus simulation software. The purpose of this project is to demonstrate how to display graphics and text on the ST7735 display through interfacing STM32 with ST7735 TFT display using SPI.

 

ST7735 Display Module Overview: Features and Capabilities:

The ST7735 display is a small, color TFT LCD display module that supports a resolution of 128×160 pixels. It has an integrated controller that supports SPI communication protocol for transferring data to the display. The ST7735 display is capable of displaying up to 18-bit color depth, which means it can display up to 262,144 colors.

Configuring Pins for STM32 to ST7735 Display Interfacing:

To interface the STM32 microcontroller with the ST7735 display, we need to connect the SPI pins of the microcontroller to the corresponding pins of the display module. The SPI pins include MOSI (Master Output Slave Input), MISO (Master Input Slave Output), SCK (Serial Clock), and CS (Chip Select). We also need to connect the power and ground pins of the display module to the corresponding pins of the microcontroller.

Overall, this project provides example of how to interface an STM32 microcontroller with an ST7735 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
  • In the Categories tab, select the RCC High Speed Clock (HSE) to Crystal/Ceramic Resonator
  • Go To The Clock Configuration & Set The System Clock To 72MHz
  • Configure The GPIO Pins [PB12..PB15] as Output Pin
  • In the Categories tab, select the SPI1 & Transmit Only Master
  • In the Parameter settings tab, set the Prescaler (for baud Rate) to 16
  • Generate The Initialization Code & Open The Project In CubeIDE

STM32CubeIDE Configuration :

  • Write The Application Layer Code
  • t7735_cfg.h
  • ST7735.h  & ST7735.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 STM32F103C6 & ST7735R
  • Click on Terminal Mode then choose (DYNAMIC&POWER &GROUND)
  • finally make the circuit below and start the simulation
Interfacing STM32 with ST7735 Color TFT Display via SPI

That’s all!

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

You Might Also Like

4 comments

shin dj July 19, 2024 - 6:36 am

#include “testimg.h”
const uint16_t test_img_128x128[][128] = {
{0x0B6B,0x0B63,0x0B6B,0x2B6B,0x2B6B,0x2B6B………………………….};
What program was it converted with?

Reply
Marwen Maghrebi July 19, 2024 - 7:31 am

The image array test_img_128x128 was converted using the LCD Image Converter software. This tool allows you to convert images into arrays suitable for displaying on various LCDs and graphical displays. You can download and learn more about the software at the following link: LCD Image Converter.

Reply
mike Miller January 11, 2025 - 5:46 am

Nice job! It’s an awesome library!
I’m planning to create some custom fonts for it, but every font creator I’ve used generates 1 byte of data (like 0x08). How can I make it compatible with your library?

Do you recommend any specific tools or applications for this purpose?

Thanks for your cooperation!

Reply
Marwen Maghrebi January 11, 2025 - 8:43 am

To create custom fonts compatible with the STM32 and ST7735 display library, you can utilize the Font Rasteriser tool developed by Fun Stack Labs. This tool is specifically designed for embedded projects and can generate font data in a format suitable for your library.

Steps to Create Compatible Fonts:

Access the Font Rasteriser Tool:

Navigate to the Font Rasteriser tool: https://funstacklabs.github.io/font-rasteriser.html
Design and Generate Font Data:

Select your desired font, size, and style within the tool.
The tool will generate the corresponding font data, typically in the form of C arrays, compatible with your STM32 library.
Integrate the Font Data into Your Project:

Copy the generated font data into your fonts.c file.
Ensure that the data structure matches the format expected by your library.
Declare the new font array as an external variable in your fonts.h file to make it accessible throughout your project.
By following these steps, you can create and integrate custom fonts tailored to your application’s requirements. The Font Rasteriser tool simplifies the process, ensuring compatibility with your existing STM32 and ST7735 display setup

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