Skip to content

Board configs: nine ESP32 SPI panels use the bus's swap_bytes - #714

Merged
bdbarnett merged 3 commits into
mainfrom
board-configs-swap-bytes
Nov 19, 2026
Merged

bdbarnett merged 3 commits into
mainfrom
board-configs-swap-bytes

Conversation

@bdbarnett

@bdbarnett bdbarnett commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

On ESP32 firmware that has SPIBus(swap_bytes=True) (PyDevices/omnipython-builds#566), the bus swaps each colour as it copies the pixels into its DMA buffer, which saves a separate pass over every frame (a full 240 x 240 blit on the T-Watch S3 went from 28.8 to 24.0 ms). These configs now pass swap_bytes=True to the bus and reverse_bytes_in_word=False to the display driver: T-Watch S3, T-Embed, FunHouse, ESP32 Audio Kit, ESP32-P4X-EYE, the ESP32-P4's 1.8 inch panel on the Pico, and the three QT Py configs (ILI9341 EyeSPI on the ESP32 Pico and on the ESP32-S3, the round display on the ESP32-S3). The P4X-EYE config also switches on the screen's power line (GPIO 12, the camera enable) before it builds the display, and uses BGR colour order.

The configs need firmware with #566. On older firmware the bus raises TypeError: extra keyword arguments given when the config loads, and there is no fallback: update the firmware.

The three QT Py configs lose their miso pin. A bus with a miso pin is the blocking machine.SPI one, which has no send_color(), so it refuses the flag. Touch on those boards is I2C (an I2C scan finds the touch chip: 0x51 on the round display, 0x38 on the EyeSPI screen; no tap was done) and nothing else reads the bus. On the no-PSRAM QT Py ESP32-S3 the DMA bus needs a free block of internal RAM, so build it before Wi-Fi starts: after Wi-Fi was up the same constructor failed with ESP_ERR_NO_MEM.

The two configs for the 3.5" HX8357 FeatherWing (on the Feather ESP32 V2 and on the FeatherS3) are not changed. Their STMPE610 touch controller shares the SPI host through machine.SPI, which can't share a host that the DMA bus owns, so they keep the blocking bus until the DMA bus can share its host.

Seen on the panels with fills, blits and pixel() writes (with #713): the T-Watch S3 and the T-Embed show red, green, blue, white from left to right as four unbroken vertical stripes; the QT Py ESP32-S3's round display and the QT Py ESP32 Pico's 2.8" screen, drawn in the order blue, white, red, green, show that order left to right. libbuild.py check and installers --check are clean.

T-Watch S3, T-Embed, FunHouse, ESP32 Audio Kit, P4X-EYE and the P4 Pico's 1.8 inch panel build their SPIBus with swap_bytes=True and tell the display driver not to swap (reverse_bytes_in_word=False). Firmware without swap_bytes raises TypeError for the keyword, and the config then builds the bus as before and lets the driver swap, as the P4X-EYE config already did for the dma keyword.
…o fallback

The T-Watch S3, T-Embed, FunHouse, ESP32 Audio Kit, P4X-EYE, the P4 Pico's 1.8 inch panel and the three QT Py configs (ILI9341 EyeSPI on the ESP32 Pico and on the ESP32-S3, the Seeed round display on the ESP32-S3) pass swap_bytes=True and reverse_bytes_in_word=False. The QT Py configs lose their miso pin: touch is I2C and nothing reads the bus, and a bus with a miso pin is the machine.SPI one, which refuses the flag. Firmware without swap_bytes now stops with TypeError instead of quietly letting the driver swap.
@bdbarnett
bdbarnett force-pushed the board-configs-swap-bytes branch from 1377a66 to 1b595d3 Compare November 18, 2026 21:45
@bdbarnett bdbarnett changed the title Board configs: six ESP32 SPI panels use the bus's swap_bytes Board configs: nine ESP32 SPI panels use the bus's swap_bytes Nov 18, 2026
The panel stays dark until the camera enable (GPIO 12) is high, so a program
that opened the display without the camera showed only the backlight. The
config now raises it first, after board_peripherals has released the
deep-sleep hold. The panel's colour order is BGR: with bgr=False, red and blue
were exchanged.
@bdbarnett

Copy link
Copy Markdown
Contributor Author

ESP32-P4X-EYE, on a release-recipe build of omnipython-builds main (P4X_EYE, all,vision,tflite) with this branch's config: four stripes in the expected order on the panel, and the camera app and Home with correct colours, including after a deep-sleep wake. The screen needs the camera enable (GPIO 12) high, and the panel's order is BGR, which is what 4eb99cd adds. Without GPIO 12 the panel shows only its backlight.

@bdbarnett
bdbarnett merged commit c60bbfe into main Nov 19, 2026
4 checks passed
@bdbarnett
bdbarnett deleted the board-configs-swap-bytes branch November 19, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant