On this page

Hardware

Both firmware targets use the same physical wiring, so this page applies to either build.

Bill of materials

PartNote
Raspberry Pi Pico, RP2040the host USB device
XPT2046 resistive touch controller module, or a display panel with an integrated XPT2046the touch input
USB Micro-B cableto the host
Jumper wiresto the controller

Pin map

Pico GPIOXPT2046 pinSignalNotes
GPIO 18CLK / DCLKSPI0 SCK
GPIO 19DINSPI0 MOSI
GPIO 16DOUTSPI0 MISO
GPIO 17CS / CSBSPI0 chip selectactive low, driven by firmware
GPIO 20PENIRQtouch interruptactive low, internal pull-up enabled
GPIO 25:onboard LEDPWM feedback, optional
GPIO 0:UART0 TXdebug output at 115200 baud, optional
GPIO 1:UART0 RXcompletes the debug pair

The XPT2046 VCC pin accepts 2.7 V to 5.5 V. The wiring uses the Pico’s 3.3 V output on pin 36, and any Pico ground pin for GND.

SPI configuration

Both targets configure the controller the same way:

SettingValue
ControllerSPI0
Clock speed1 MHz
ModeCPOL 0, CPHA 0, that is mode 0
Word orderMSB first
ADC resolution12 bits

Calibration

The raw ADC limits are specific to the touch panel. They are documented, with the mapping formula and the recalibration procedure, in XPT2046 and calibration.