Boards / STM32

STM32F407 + ILI9341 SPI

Black pill / Discovery style wiring using SPI1 and an XPT2046 touch panel.

The STM32F407 + ILI9341 SPI board
Photograph: Waveshare · vendor product photo, no licence stated

Building for it

A project is made for one toolchain, picked when you start it. For this board you can use one of the four:

Toolchain
Arduino (C++)Every board, every widget and every peripheral here. The most control, and the most to set up. Start a project
MicroPythonThe MicroPython export has not been built for this chip yet. It is written for the ESP32, S2, S3, C3 and C6.
ESPHomeESPHome targets the ESP32 family. Use the Arduino export for this chip.
ESP-IDF (C)ESP-IDF is Espressif's framework, for Espressif chips. Use the Arduino export for this one.

At a glance

PartDetail
MakerGeneric
MCUSTM32F4 (F401 / F407 / F411)
Cortex-M4F @ 84-180 MHz, 96-192 KB SRAM
DisplayIlitek ILI9341, 240 x 320 px, SPI (4-wire serial), 16-bit colour
TouchXPTek XPT2046 (resistive, SPI)
BacklightPB11, dimmable (PWM)
PSRAMNo
Graphics libraryLovyanGFX

Display pins

ILI9341 on SPI (4-wire serial): SPI clock 40 MHz, host VSPI, BGR colour order, inversion off.

SignalPin
SCK / CLKPA5
MOSI / SDAPA7
MISO / SDOPA6
CSPB0
DC / RSPB1
RESETPB10
BacklightPB11

Touch pins

XPT2046: 2000 kHz, shares the display bus.

SignalPin
SCKPA5
MOSIPA7
MISOPA6
CSPB12
IRQ / PENIRQPB13

Check your revision. Needs the STM32duino core. SPI1 pins are remappable - check your variant.

Designing for it in LCD Wizard

The parts

ILI9341. The most common hobby TFT. 2.2"-2.8" modules, usually with an XPT2046 resistive panel.

XPT2046. The classic 4-wire resistive controller. Needs calibration. Can share the display SPI bus with its own CS.

STM32F4 (F401 / F407 / F411). Use the STM32duino core. Panels go over SPI, or TFT_eSPI's 8-bit parallel bus. The FSMC peripheral is not used by any of the graphics libraries here.

LovyanGFX. Widest panel and bus coverage, DMA on ESP32. Configured with a C++ config class.

The pinout on one page

Every pin above, laid out to print and keep beside the bench. Generated from this preset, so it says exactly what the designer writes into lcd_pins.h.

Download the pinout (PNG)Open it as SVG

The same pins as data - board.json and pins.csv - are in the open pinout dataset on GitHub, free to reuse under CC BY 4.0.

From the people who made it

The board’s own documentation. Pinouts on vendor pages do sometimes disagree with the hardware in front of you - where this page and that one differ, trust your board and tell us.

Designs for this board

Clone any of them into the designer, or see every design for this board in the gallery.

Raspberry Pi Pico + ILI9341SPI0 driving a 2.8" ILI9341 with XPT2046 touch.RP2040 · ILI9341 240 x 320 · XPT2046 touch
ESP32-S3 + ILI9341 SPIESP32-S3 DevKitC wired to a 2.8" ILI9341 with XPT2046 touch.ESP32-S3 · ILI9341 240 x 320 · XPT2046 touch
ESP32 + ILI9341 2.8" SPIThe classic breadboard combination: ESP32 DevKit, 2.8" ILI9341, XPT2046 resistive touch on the same SPI bus.ESP32 · ILI9341 240 x 320 · XPT2046 touch
Pico + GC9A01 round240x240 round panel driven from SPI0, no touch.RP2040 · GC9A01 / GC9A01A 240 x 240 · no touch
LCDWIKI 2.8" ESP32-S3 (ES3C28P)2.8" 240x320 IPS ILI9341V over SPI with FT6336G capacitive touch, an ES8311 codec with microphone and speaker output, a WS2812 LED, a 4-bit SD slot and battery charging.ESP32-S3 · ILI9341 240 x 320 · FT6236 / FT6336U touchPurchase this board
ESP32-S3 + GC9A01 1.28" round240x240 round panel with CST816S single-touch. Popular for watch faces and gauges.ESP32-S3 · GC9A01 / GC9A01A 240 x 240 · CST816S touch

Next