STM32F407 + ILI9341 SPI
Black pill / Discovery style wiring using SPI1 and an XPT2046 touch panel.

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 |
| MicroPython | The MicroPython export has not been built for this chip yet. It is written for the ESP32, S2, S3, C3 and C6. |
| ESPHome | ESPHome 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
| Part | Detail |
|---|---|
| Maker | Generic |
| MCU | STM32F4 (F401 / F407 / F411) Cortex-M4F @ 84-180 MHz, 96-192 KB SRAM |
| Display | Ilitek ILI9341, 240 x 320 px, SPI (4-wire serial), 16-bit colour |
| Touch | XPTek XPT2046 (resistive, SPI) |
| Backlight | PB11, dimmable (PWM) |
| PSRAM | No |
| Graphics library | LovyanGFX |
Display pins
ILI9341 on SPI (4-wire serial): SPI clock 40 MHz, host VSPI, BGR colour order, inversion off.
| Signal | Pin |
|---|---|
| SCK / CLK | PA5 |
| MOSI / SDA | PA7 |
| MISO / SDO | PA6 |
| CS | PB0 |
| DC / RS | PB1 |
| RESET | PB10 |
| Backlight | PB11 |
Touch pins
XPT2046: 2000 kHz, shares the display bus.
| Signal | Pin |
|---|---|
| SCK | PA5 |
| MOSI | PA7 |
| MISO | PA6 |
| CS | PB12 |
| IRQ / PENIRQ | PB13 |
Check your revision. Needs the STM32duino core. SPI1 pins are remappable - check your variant.
Designing for it in LCD Wizard
- Choose STM32F407 + ILI9341 SPI on the Hardware tab (or use the button above) and every pin on this page is filled in. The export writes the sketch,
lcd_pins.h, the LovyanGFX configuration,lv_conf.handplatformio.ini- a project that builds for this board as it comes. - The XPT2046 is resistive and reads through its library; set its raw range on the Touch tab.
- The backlight is dimmable: give a slider or a button a Set backlight action.
- Screens are designed for 240 x 320 px in either orientation, with LVGL 9 or LVGL 8.
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.
- The vendor’s product page
- Vendor documentation
- Schematic (PDF)
- ILI9341 datasheet (hosted by Adafruit)
Designs for this board
Clone any of them into the designer, or see every design for this board in the gallery.
Similar boards
Next
- Quick start - from an empty screen to firmware on the board
- Boards and displays - presets, controllers, pins and touch in the designer
- Flashing and configuration - PlatformIO, the Arduino IDE and first-boot checks
- Troubleshooting - a white screen, mirrored image or touch that misses