Hi guys,
Some issue here that I need to report, and find a way out ASAP as I'm currently stuck. ESP32-P4-PC purchase was made primarily to drive a display, however this currently fails.
ESP32-P4-PC Rev.D: RGB888 pixel bytes slip on the HDMI output (also with the official board demo)
Summary
On our ESP32-P4-PC Rev.D board, every picture that the DSI bridge reads from memory reaches the screen with its RGB888 bytes shifted: the colours are wrong while white and black stay correct.
- 40 MHz pixel clock and above: the shift changes from line to line and moves all the time, which shows as lines of wrong colours and moving "waves".
- 24 MHz (640x480): the picture is stable, but the whole frame is shifted by 0, 1 or 2 bytes, picked at random at each boot. Orange shows as orange, turquoise or purple.
The same happens with your `p4_board_demo` built from source with ESP-IDF v5.5.5. Its only change is DVI mode, which our monitor needs. The colour bars of HDMI test 1/5 come out scrambled.
The DSI host's own pattern generator, which reads no memory, shows clean colour bars at 80 MHz. The LT8912B, the cable and the monitor are therefore fine. The fault lies between the frame buffer and the DSI host: the DMA, the DSI bridge and the bridge-to-host DPI interface.
Your README says the demo was validated on chip revision v1.3 with ESP-IDF v5.5.5 at 1280x720 60 Hz, which is our setup. The repository documents board revisions B and C only. What changed in Rev.D, and has the HDMI test passed on Rev.D boards?
## Setup
| | |
|---|---|
| Board | Olimex ESP32-P4-PC **Rev.D** (silkscreen), 16 MB flash, 32 MB PSRAM |
| Chip | ESP32-P4 revision **v1.3**, eFuse block v0.3 |
| PSRAM | AP hex, 200 MHz (also tried 80 MHz) |
| ESP-IDF | v5.5.5 and v5.5.6 (same result) |
| HDMI | onboard LT8912B, 2 DSI lanes, RGB888, `disable_lp = true` |
| Monitor | 2560x666 bar display, Realtek "RTK FHD HDR" scaler. Its EDID has no CEA extension (DVI only): DTD 2560x666@60, established 640x480@60 and 800x600@60, standard 1280x720@60. It works fine from a PC with the same cable. |
- Test 1: your demo on this board
Steps to reproduce:
1. In `p4_board_demo`, `components/esp-bsp/components/lcd/esp_lcd_lt8912b/esp_lcd_lt8912b.c`, change
`{0xB2, 0x01}` to `{0xB2, 0x00}` (DVI mode).
2. Build with ESP-IDF v5.5.5 and flash.
Result: the black screen with white text is blurry. After a short press on BOOT, the colour bars are scrambled: every line has a different wrong colour, and the pattern moves.
The log is normal (`HDMI configuration for 1280x720@60HZ`, `Display resolution 1280x720`, no underrun message).
Separate small issue: the driver always sets HDMI mode (`0xB2 = 0x01`) and sends AVI and audio packets.
On this DVI-only monitor that gives no picture at all (blue "no signal" screen). With our firmware in HDMI mode, the picture faded out after a few seconds. Choosing DVI when the EDID has no CEA extension fixes both.
- Test 2: our firmware, isolating the stages
Our firmware drives the same hardware in the same way: the same `esp_lcd_lt8912b` driver (identical to yours apart from formatting), the same timings and the same LDO, DSI bus and DPI setup.
| Test | Result |
|---|---|
| 8 colour bars written by the CPU straight into the RGB888 DPI frame buffer (no PPA, no RGB565), 1280x720 | scrambled: each line a different colour, moving; white and black bars clean |
| DSI host pattern generator (`esp_lcd_dpi_panel_set_pattern(MIPI_DSI_PATTERN_BAR_VERTICAL)`), 1280x720 at 80 MHz | **clean** |
| Same CPU bars, 640x480 at 24 MHz | uniform bars, no moving lines |
| Orange DMD picture (RGB565 converted to RGB888 by the PPA), 640x480 at 24 MHz | stable, but a random 0/1/2-byte offset at each boot: orange shown as orange, turquoise or purple. 5 boots in a row gave turquoise, orange, orange, turquoise, turquoise. Restarting the bridge DPI output after start-up does not help. |
| Same CPU bars, 800x600 at 40 MHz | scrambled, larger moving "waves" |
| DSI lane rate 1500, 960, 720 (= pclk x 12) and 480 Mb/s | no change |
| 1280x720 at 60 MHz from PLL_F240M with the lane rate at exactly 12 x pclk (720 Mb/s), timing 1350x741 as in [issue #1](https://github.com/OLIMEX/ESP32-P4-PC/issues/1) | still scrambled |
| ESP-IDF v5.5.6 instead of v5.5.5 | no change |
| One DPI frame buffer instead of two; code and rodata in flash instead of PSRAM (no XIP); DW-GDMA outstanding reads limited to 1 | no change |
| PSRAM at 80 MHz | underrun messages (expected), and the lines that do come through still have wrong colours |
| All other firmware tasks stopped (only the DPI scan-out running) | no change |
Measurements made on the board during the scrambled 1280x720 picture:
- DSI bridge FIFO (`MIPI_DSI_BRIDGE.fifo_flow_status.raw_buf_depth`, sampled 240,000 times over 200 ms): minimum 766, maximum 1020 words out of 1024. The bridge never runs short of data, and the underrun interrupt never fires.
- Frame rate of the bridge (refresh-done callbacks over 3 s against `esp_timer`): 59.9790 Hz, as expected (+0.000 %). The DPI clock is exact.
- LT8912B input measurement (registers 0x9C–0x9F): line period and 741 lines exactly as configured; the DDS settles at the expected pixel clock. The DSI host's timing is exact.
- Pixel data in memory: the CPU bars are written as B, G, R. The PPA RGB565-to-RGB888 conversion was checked byte by byte and also gives B, G, R. That is the order that displays correctly whenever the offset happens to be 0.
What we think is happening
The memory contents are right, the bridge FIFO is full, and both sides keep exact time. Yet the bytes of each pixel slip between the bridge FIFO and the DSI host. The slip is random per boot at 24 MHz and per line from about 40 MHz upwards.
This points to the bridge's RGB888 unpacking or the bridge-to-host DPI path on this chip or board, rather than to software. Signal integrity or core supply could also matter, since the core regulator changed in Rev.C. We cannot measure that ourselves.
Note:
We also built your p4_production_test (committed sdkconfig, same one-line DVI change). With its older 720p setting (64 MHz requested from PLL_F240M, so 60 MHz in fact; 1440x741 total; 1000 Mb/s lanes) the monitor flashes briefly and stays black. That refresh rate (56.2 Hz) is probably rejected by the monitor's scaler, so this test says nothing about the board.
Questions
1. What changed in Rev.D compared with Rev.C?
2. Has the HDMI colour-bar test of `p4_board_demo` passed on Rev.D boards?
3. Is this a known issue with these board or chip lots? Can you test a Rev.D board on your side, or exchange ours?
We can provide photos, logs, and the test firmware (CPU colour bars, DSI pattern generator, FIFO and frame-rate measurements).
I've added latest hardware revision at the GitHub of the board, along with hardware revision changes log. The revision changes have nothing to do with the HDMI, the main change was SD card improvement.
About the issue. I can't reproduce it, my test was done at 1280×720, about 59.98 Hz refresh, with an 80 MHz pixel clock. It is either an issue with your code or your display. Find my test in the archive at the FTP link below, there is readme.txt inside with details of my tests and instructions on how to test:
https://ftp.olimex.com/TEMP/ESP32-P4-PC-HDMI-tests/ESP32-P4-PC-RevD-HDMI-Customer-Test.zip
If the issue remains with this code - then try another shorter HDMI cable and another HDMI monitor or display. Try better and shorter USB cable too, sometimes power can be insufficient or unstable, maybe disconnect extra peripherals from the PC for simple test in case the keyboard or mouse draw too much.
By the way here is a short video of the ESP32-P4-PC board, revision D running BMDS project and FreeDoom:
https://www.youtube.com/watch?v=6CrJ6jKviYc
BMDS project can be found here:
https://github.com/jthwho/bmds