Keep the Elecrow's touch bus free of the USB PHY after Wi-Fi starts (0.2.94, firmware 0.2.80)
The GT911 of the CrowPanel 7.0" sits on GPIO 19 and 20, the ESP32-S3's USB pins. Firmware 0.2.79 freed them once, in a static constructor; the Wi-Fi PHY library then kept the USB PHY on (CONFIG_ESP_PHY_ENABLE_USB, on by default on an ESP32-S3) and the touch went quiet once Wi-Fi came up. The board file turns that option off, frees the pins again in BOOT_TOUCH after Wi-Fi started, and a one-second watchdog frees them whenever anything takes them, with a log line.
This commit is contained in:
+9
-3
@@ -55,9 +55,15 @@ touchscreen:
|
||||
|
||||
**GPIO 19 and 20, the touch I2C, are the ESP32-S3's USB D- and D+.** The ROM leaves the USB PHY on those pads and
|
||||
ESP-IDF's I2C driver cannot take them back: the bus reads as `I2C software timeout` and the touch never answers
|
||||
(esphome/esphome#15356, ESPHome 2026.3+). `elecrow_usb_phy.h` runs before any component, as a static constructor,
|
||||
and lets the pads go; it is behind the build flag `ESP_SCREENS_FREE_USB_PADS`, which only this board file sets, because
|
||||
ESPHome includes every header of the component in every build and the Guition, an ESP32-S3 too, keeps its USB. The board's USB-C port is a CH340 on UART0, so flashing and the log are unaffected; the
|
||||
(esphome/esphome#15356, ESPHome 2026.3+). `elecrow_usb_phy.h` lets the pads go, three times, because three things hand
|
||||
them back (firmware 0.2.80): a static constructor before any component runs (after the ROM); the board's `BOOT_TOUCH`
|
||||
hook after Wi-Fi started, because the Wi-Fi PHY library keeps the USB PHY on by default on an ESP32-S3
|
||||
(`CONFIG_ESP_PHY_ENABLE_USB`, which the board file turns off as well); and a one-second watchdog that reads the pad bit
|
||||
and releases the pads again when anything took them, logging `USB PHY took GPIO19/20 back; released again` once per
|
||||
event, so the log says whether it ever had to. The code is behind the build flag `ESP_SCREENS_FREE_USB_PADS`, which
|
||||
only this board file sets, because ESPHome includes every header of the component in every build and the Guition, an
|
||||
ESP32-S3 too, keeps its USB. ESPHome's logger keeps the USB-Serial-JTAG secondary console on, so ESP-IDF's own
|
||||
pad-release at startup (`clk.c`, only without that console) never runs here. The board's USB-C port is a CH340 on UART0, so flashing and the log are unaffected; the
|
||||
`GPIO19 is used by the USB-Serial-JTAG interface` warnings at build time are expected.
|
||||
|
||||
### Rotation
|
||||
|
||||
Reference in New Issue
Block a user