Hardware
Both firmware targets use the same physical wiring, so this page applies to either build.
Bill of materials
| Part | Note |
|---|---|
| Raspberry Pi Pico, RP2040 | the host USB device |
| XPT2046 resistive touch controller module, or a display panel with an integrated XPT2046 | the touch input |
| USB Micro-B cable | to the host |
| Jumper wires | to the controller |
Pin map
| Pico GPIO | XPT2046 pin | Signal | Notes |
|---|---|---|---|
| GPIO 18 | CLK / DCLK | SPI0 SCK | |
| GPIO 19 | DIN | SPI0 MOSI | |
| GPIO 16 | DOUT | SPI0 MISO | |
| GPIO 17 | CS / CSB | SPI0 chip select | active low, driven by firmware |
| GPIO 20 | PENIRQ | touch interrupt | active low, internal pull-up enabled |
| GPIO 25 | : | onboard LED | PWM feedback, optional |
| GPIO 0 | : | UART0 TX | debug output at 115200 baud, optional |
| GPIO 1 | : | UART0 RX | completes 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:
| Setting | Value |
|---|---|
| Controller | SPI0 |
| Clock speed | 1 MHz |
| Mode | CPOL 0, CPHA 0, that is mode 0 |
| Word order | MSB first |
| ADC resolution | 12 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.