Wiring for your board
The library keeps one set of pins for the ESP32-S3 and one for the classic ESP32, and picks between them from the board you chose in Tools. The panel has no say in it — which is the point, and also where the one gap in the table is.
Pins belong to the board
Two controls. The top one changes every number on the drawing. The bottom one — the panel size — changes nothing at all, and that is the thing worth sitting with for a moment.
The GPIO a wire lands on is a property of the board you are compiling for. The driver chip, the resolution, the offsets and the backlight polarity are properties of the glass. They never meet, so there is no combination to look up: pick your board, pick your panel, and the two answers are independent.
The library goes further and picks the board row for you, from what you selected in Tools ▸ Board. Compile for an ESP32-S3 and you get the S3 pins; compile for an ESP32 Dev Module and you get the classic ones. Nothing to edit.
The gap in the table
There are two rows and no third one. The library chooses the S3 row when it is built for an S3, and the classic-ESP32 row otherwise.
Otherwise includes the ESP32-C3, and the classic row hands out GPIO 23 for data and GPIO 32 for the backlight. A C3's pins stop at GPIO 21. Neither of those exists.
So on a C3 — and on anything else that is not one of the two named chips — the default pins are not a starting point, they are wrong, and you set them yourself:
LB_Wiring pins = LB_WIRING; // start from the default for this chip
pins.cs = 7; // ...then change what your board actually has
pins.dc = 6;
pins.rst = 10;
pins.mosi = 3;
pins.sclk = 2;
pins.backlight = 5;
display.setWiring(pins); // before begin()
display.begin();Copy LB_WIRING rather than declaring an empty one. It carries an SPI bus
number whose meaning is not the same on every chip, and starting from the
default gives you a bus that is already correct for the chip you are building
for.
printInfo() prints the pins actually in use and marks any you overrode, which
turns a wiring mistake into a line in the serial log instead of a blank screen.
More than one display
Clock and data are shared. Each display gets its own CS, and DC and RST can be common. That is ordinary SPI, and it is the reason CS exists — without it, two panels on one bus both take every byte.
When it does not work
The library has two wiring rows, one for the ESP32-S3 and one for everything else, and everything else means the classic ESP32's pins — GPIO 23 for data and GPIO 32 for the backlight. Neither number exists on a C3, which only goes up to GPIO 21. Copy LB_WIRING, change the pins to ones your C3 has, and call setWiring before begin.
Override them. Copy LB_WIRING into a variable, change only the fields that differ, and pass it to setWiring before begin. Start from the default rather than filling one in from scratch — the SPI bus number in it means different things on different chips, and copying gets that right for free.
No. Pins belong to the board, the driver and resolution belong to the screen, and the two do not interact. Swapping a panel changes one constant in the sketch and no wiring at all.
Yes — clock and data are shared, and each display gets its own CS pin. DC and RST can be shared too. That is the normal way to run several SPI devices, and chip select is what stops them talking over each other.
What a single panel constant resolves to, and why five settings hide behind it.
The one line that changes →Edit this page — content/books/spi-tft-kit/wiring-for-your-board.mdx
Questions about this product
See what other owners have asked, and read their solutions.
SPI TFT LCD Display Kit, 6-Pack from 0.96 to 3.5 inch
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.