Reset the Elecrow's GT911 the way Elecrow's own V3.0 example does (0.2.96, firmware 0.2.82)
CI / checks (push) Waiting to run
CI / firmware (add-on) (push) Blocked by required conditions
CI / firmware (min_version) (push) Blocked by required conditions

The 2 ms reset of ESPHome's expander support (0.2.81) left the chip silent: "Calibration error" with the PCA9557
answering at 0x18. A component of smart_display's (elecrow_touch_reset.h, setup priority 700: after the I2C bus,
before the GT911 driver) writes the expander as Elecrow's V3.0 ESPHome example does: every pin an output and low,
20 ms, the reset released, 100 ms, the interrupt line back to an input. The driver's reset and interrupt pins are gone.
This commit is contained in:
Xandrossian
2026-09-21 13:30:41 -07:00
parent da28d19961
commit 4ec8c7a935
9 changed files with 96 additions and 36 deletions
+12 -22
View File
@@ -383,6 +383,10 @@ psram:
# CLOSE_CARDS_HOOK, MAY_OPEN_EXTRA, TICK_HOOK, AWAY_EXTRA and ALERT_SHOW_HOOK emptied) it is 1,754 KB, 86.4 %.
smart_display:
partitions: 4mb_wide_slots
# The GT911 out of reset through the V3.0's PCA9557 before the driver runs (elecrow_touch_reset.h, firmware 0.2.82).
elecrow_touch_reset:
i2c_id: touch_bus
address: 0x18
# The icon fonts at 2 bits a pixel (four levels of edge smoothing instead of sixteen) where the text keeps its four:
# the three sizes of the 314 tile icons are 312 KB at 4 bits, half that at 2. The text fonts are the sharper for it.
@@ -487,29 +491,21 @@ text_sensor:
update_interval: 60s
lambda: 'return {"elecrow"};'
# Pinout of the CrowPanel 7.0" (DIS08070H, V2.0 and V3.0): Elecrow's wiki and the ESPHome devices page. The V3.0 has a
# PCA9557 I/O expander at I2C 0x18 on the GT911's reset (IO0) and interrupt (IO1) lines, and the GT911 stays in reset
# until something drives them (firmware 0.2.81: a unit whose touch never answered, "Calibration error" at setup). The
# expander gets the same register map as the PCA9554 ESPHome knows, and the GT911 driver does Elecrow's own reset
# through it: reset low with the interrupt line low (that picks address 0x5D), reset high, 56 ms. On a V2.0 without
# the expander its setup fails, the GT911 boots by its pull-up as before, and the driver still finds it (it tries 0x14
# by itself when 0x5D does not answer).
# Pinout of the CrowPanel 7.0" (DIS08070H, V2.0 and V3.0): Elecrow's wiki and their V3.0 ESPHome example. The V3.0 has
# a PCA9557 I/O expander at I2C 0x18 on the GT911's reset (IO0) and interrupt (IO1) lines, and the GT911 stays in
# reset until something drives them: on a unit tested here the driver reported "Calibration error" at setup
# (firmware 0.2.79 to 0.2.81, the last one through ESPHome's own expander support, whose 2 ms reset the chip ignored).
# elecrow_touch_reset (below) runs Elecrow's own sequence before the driver looks for the chip; a V2.0 without the
# expander boots its GT911 by the pull-up as before, and the driver tries 0x14 by itself when 0x5D does not answer.
i2c:
id: touch_bus
sda: GPIO19
scl: GPIO20
frequency: 400kHz
# The scan logs what answers on the bus (0x18 the expander, 0x5D or 0x14 the GT911), with `logger: level: DEBUG` in
# a screen's Override YAML: which revision a screen is, and whether the bus is alive at all. It runs before the
# GT911's reset, so it upsets nothing.
# The scan logs what answers on the bus with `logger: level: DEBUG` in a screen's Override YAML: 0x18 is the
# expander; the GT911 is still in reset at that moment and shows up in the driver's own line instead.
scan: true
pca9554:
- id: touch_expander
i2c_id: touch_bus
address: 0x18
pin_count: 8
output:
- platform: ledc
pin: GPIO2
@@ -533,12 +529,6 @@ touchscreen:
i2c_id: touch_bus
# The reset through the expander picks 0x5D; the driver tries 0x14 by itself when that does not answer.
address: 0x5D
reset_pin:
pca9554: touch_expander
number: 0
interrupt_pin:
pca9554: touch_expander
number: 1
display: my_display
update_interval: 20ms
transform: