Interfacing STM32 Blue Pill Board with ST7789 TFT Display

This STM32 tutorial shows how to easily connect and interface STM32 Blue Pill development board with ST7789 color TFT display module.
The STM32 Blue Pill development board is based on STMicroelectronics ARM Cortex-M3 microcontroller STM32F103C8T6 running at maximum clock frequency of 72MHz. This particular development board gained popularity due to its low cost and compact size, making it a popular choice for hobbyists, students, and developers.
To use the STM32 Blue Pill, a hardware programmer, such as the ST-Link, is required to upload the code to the board. A USB-to-Serial converter module can also be used to upload the code to the board, one example of this converter is the popular one from FTDI which is FT232RL module.

TFT: Thin-Film Transistor.
SPI: Serial Peripheral Interface.
IPS: In-Plane Switching.
MOSI: Master Out Slave In.
MISO: Master In Slave Out.

About The ST7789 TFT display:
The ST7789 display is commonly used in projects involving microcontrollers like Arduino or Raspberry Pi. Here are some key features and aspects of the ST7789 display:

  • Display Controller: This display is based on a controller IC of the same name, ST7789 (or, ST7789V, ST7789VW), providing an interface between the master device and the display panel.
  • Color TFT-LCD: It is specifically designed for color displays, supporting various color depths.
  • Resolution: The ST7789 displays come with different resolutions (320×240 pixel, 240×240 pixel…) supporting landscape and portrait orientations.
  • Communication Interface: It usually interfaces with microcontrollers or other devices using SPI (Serial Peripheral Interface).
  • Supported Operations: The ST7789 TFT display supports standard display operations such as drawing pixels, lines, rectangles, and displaying images.
  • Low Power Consumption: It is designed to be power-efficient, suitable for battery-powered or low-power devices.
  • Voltage Levels: The ST7789 typically works with various voltage levels, and the specific requirements may vary based on the module or display being used.
  • Widely Used in Projects: The ST7789 is often used in DIY electronics projects, especially those involving microcontrollers like Arduino, Raspberry Pi, STM32 Blue Pill, and others.

The following image shows a ST7789 display module provided by Adafruit Industries:

Adafruit ST7789 TFT display module

Another version of the ST7789 display module is shown below, it is the one used in this tutorial. This one has no CS (chip select) pin that internally attached to GND. The resolution of this display is 240×240 pixel.

ST7789 TFT display without CS pin

ST7789 TFT display module pin description:

  • GND: Ground connection pin
  • VCC: Power supply voltage pin
  • SCL: Serial Clock pin. Connected to the SPI clock pin of the master device.
  • SDA: Serial Data Input pin. Connected to the SPI MOSI (Master Out Slave In) pin of the master device.
  • RES: Reset signal pin. Connected to a digital output pin on the master device. It is often optional, and if not used, it could be connected to master device reset pin or tied to a stable low level point.
  • DC (Data/Command): Data/Command control signal. Connected to a digital output pin on the master device. It determines whether the data on the bus is a command or actual pixel data.
  • BLK (Backlight): Backlight control pin. Connected to a digital output or PWM (Pulse Width Modulation) pin on the master device, it could be connected to VCC for maximum and permanent backlight on the display.

If the display has a CS pin:

  • CS: Chip Select pin. Connect to a digital pin on the master device. Used to enable or disable the communication with the ST7789 display.

Hardware Required:

  • STM32 Blue Pill board   —> STM32F103C8T6 32-bit Arm Cortex-M3 MCU
  • ST7789 TFT display module
  • Breadboard & jumper wires…
  • FTDI FT232RL USB-to-UART converter (for burning program file to the MCU)

Interfacing STM32F103C8T6 Blue Pill with ST7789 TFT display circuit:
Project circuit schematic diagram is shown below.
The ST7789 display module shown in project circuit diagram has 7 pins: (from left to right): GND (ground), VCC, SCL (serial clock), SDA (serial data), RES (reset), DC (or D/C: data/command) and BLK (back light).
Connecting the BLK pin is optional. The back light turns off when the BLK pin connected to the ground (GND).

STM32 STM32F103C8T6 BLUE PILL with ST7789 TFT display circuit

Circuit description:
The main power source of the circuit comes from the micro USB port of the STM32 Blue Pill board with voltage of 5V. The board contains a voltage regulator that feeds the STM32F103C8T6 microcontroller with 3.3V. The ST7789 TFT display module is powered with 3V3 from the STM32 Blue Pill board where its ‘VCC’ & ‘BLK’ pins are connected to ‘3.3V’ pin of the BluePill board.

The ST7789 display is connected to the STM32F103C8T6 Blue Pill board as follows:
GND is connected to pin GND of the Blue Pill board,
VCC and BLK pins are connected to pin 3V3 of the Blue Pill board,
SCL pin is connected to pin PA5 of the Blue Pill board,
SDA pin is connected to pin PA7 of the Blue Pill board,
RST pin is connected to pin PB0 of the Blue Pill board,
DC pin is connected to pin PB1 of the Blue Pill board.

If the display module has a CS pin then it should be connected to pin PA3 of the Blue Pill board.

Pins PA5 and PA7 are hardware SPI1 module pins of the STM32F103C8T6 microcontroller respectively for SCK (serial clock) and MOSI (master-out slave-in).

Interfacing STM32 Blue Pill with ST7789 Display Arduino Code:
Arduino IDE (Integrated Development Environment) is used to write project code, the STM32 Blue Pill board has to be added to the IDE before compilation.
The STM32 Blue Pill board can be installed using Arduino IDE Boards Manager.
Project Arduino code is just an example of graphics test provided by Adafruit Industries with the ST7789 display library.

The FT232RL USB to serial UART converter is used to program the STM32F103C8T6 microcontroller, the ST-LINK V2 programmer also can be used and it is supported by the Arduino IDE.

The following Arduino code requires two libraries from Adafruit Industries:
The first library is a driver for the ST7789 TFT display which can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries…, in the search box write “st7789” and install the one from Adafruit).
The second library is Adafruit graphics library which can be installed also from Arduino IDE library manager.
During installation of the Adafruit ST7789 library, Arduino IDE may ask for installing some other libraries form Adafruit Industries (dependencies).

This example code was tested with the following library versions:
Adafruit GFX Library: Version 1.11.9
Adafruit ST7735 and ST7789 Library: Version 1.10.3

The used libraries are included in the Arduino code as shown below:

The connection between the STM32 Blue Pill board and the ST7789 display is as shown in the above circuit schematic, it is defined in the Arduino code as shown below:

And the initialization of the ST7789 TFT display library with the connections previously defined:

Full Arduino code:

Interfacing STM32 Blue Pill with ST7789 Display Video:
The video below shows my DIY test hardware circuit of a Blue Pill board with ST7789 color display:

Related Projects:
Interfacing STM32 Blue Pill with ST7735 Color TFT Display

Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

2 thoughts on “Interfacing STM32 Blue Pill Board with ST7789 TFT Display”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top