CST816S at a glance
Item | Value | Source |
|---|---|---|
I2C address (7-bit) | | Espressif esp_lcd_touch_cst816s; Linux device-tree example |
Touch points | 1 (single finger) | Espressif driver and README |
Touch data | Starts at | Linux hynitron-cst816x driver |
Chip ID register | | Espressif driver |
Linux compatible | | Linux device-tree binding |
Reading a touch
The Linux driver reads 6 bytes from register 0x01:
Register | Contents |
|---|---|
| Gesture code |
| Number of fingers (0 or 1) |
| X, big-endian, low 12 bits |
| Y, big-endian, low 12 bits |
Gesture codes handled by the Linux driver: 0x01 slide up, 0x02 slide down, 0x03 slide left, 0x04 slide right, 0x0C long press.
The CST816S doesn't answer until you touch it
Espressif's README warns that the chip "only responds to I2C commands after an event, such as a touch detection. Do not expect it to respond on init." That is why an I2C scanner at boot often finds nothing at 0x15, and why ESPHome has a skip_probe option that skips reading the chip ID at startup. Espressif adds that on some chips reading the ID can make initialization fail. Touch the screen while you scan, or skip the ID check.
Reset and interrupt
- The Linux driver drives reset for 50 ms, releases it and waits 100 ms. Espressif's driver waits 200 ms on each side.
- INT is optional in Espressif's driver (it can poll). The Linux driver requests an interrupt and fails to probe without one.
Phantom (ghost) touches
One developer has published a test sketch showing the CST816D on the Waveshare ESP32-S3-Touch-LCD-2 reporting touches nobody made, mostly along the vertical centre line, on two boards and with Waveshare's own demo code. No fix has been confirmed. If you see ghost touches, first run the vendor's demo to separate hardware from your code, then check the board's power and grounding before filtering touches in software.
Related controllers
ESPHome's cst816 component lists CST716, CST816D, CST816S, CST816T, CST820, CST826 and CST836. For 4″–7″ multi-touch panels see GT911; for round 1.28″ displays see our GC9A01 + ESP32 guide.
Guides & comparisons
CST816S troubleshooting & FAQ
Why is my CST816S not detected on I2C?
The CST816S only responds to I2C after an event such as a touch, so a scan at boot usually finds nothing at 0x15. Touch the screen while scanning, release reset first, and in ESPHome set skip_probe: true. Espressif notes that on some chips reading the ID can make initialization fail.
Does the CST816S support multi-touch?
No. It reports a single finger; Espressif’s driver caps the point count at 1. It does report gestures: slide up, down, left and right, and long press. For multi-touch use a GT911-class controller.
Why does my CST816 report ghost touches?
One public report shows a CST816D on the Waveshare ESP32-S3-Touch-LCD-2 reporting touches along the vertical centre line with the vendor’s own demo code, and no fix has been confirmed. Run the vendor demo to rule out your code, then check power and grounding before filtering touches in software.
Sources
- Espressif ESP-BSP: esp_lcd_touch_cst816s driver
- Espressif ESP-BSP: esp_lcd_touch_cst816s README
- Linux kernel: drivers/input/touchscreen/hynitron-cst816x.c
- Linux kernel: hynitron,cst816x device-tree binding
- ESPHome: CST816 touchscreen
- seanuleh: ghost-touch test sketch for Waveshare ESP32-S3-Touch-LCD-2 (CST816D)