[Help Needed] FT81x Display Flicker / Glitches When Redrawing Frequently – Zephyr + SPI (nRF52840)
Setup:
-
Display Controller: FT810 (also applies to FT81x)
-
MCU: nRF52840 (Zephyr RTOS)
-
Display: 7-inch TFT 800x480, RGB565, capacitive touch
-
Interface: SPI
-
SPI Clock Speed: Tried both 8 MHz and 1 MHz
-
OS: Zephyr RTOS
-
Images: Loaded from SD card (via FATFS), split into chunks and written to RAMG
-
UI: Brightness & temperature sliders, circular color picker, buttons
-
Rendering: Using
ft8xx_copro_cmd_*
for all rendering (including full redraws) -
Touch: FT810 capacitive continuous tracking using
REG_TOUCH_SCREEN_XY
🎯 What I'm Trying to Achieve
-
Smooth UI rendering with:
-
Continuous visual feedback (sliders, color picker update as finger moves)
-
Buttons with
TAG()
touch detection
-
-
No visible glitches or flicker, even during frequent redraws or finger movement
❗️Problem
Whenever I redraw the screen frequently (e.g., when the finger moves across a slider or color picker), I notice:
-
Glitches / flickers on the screen
-
Black lines
-
Half-rendered frames
-
Artifacts flashing randomly
-
-
It becomes worse when:
-
I move my finger very fast across the screen
-
I probe the SPI clock line using an oscilloscope (signal quality drops)
-
-
Even when I disable touch and just refresh the UI in a loop, glitches still appear — so it's not a touch handling issue
What I Tried So Far
-
Reducing SPI clock speed from 8 MHz to 1 MHz — cleaner signals on scope, but flicker still exists
-
Ensuring every redraw frame is complete:
cCopyEditft8xx_copro_cmd_dlstart(); ft8xx_copro_cmd(FT8XX_CLEAR_COLOR_RGB(255,255,255)); ft8xx_copro_cmd(FT8XX_CLEAR(1,1,1)); // All UI draw functions here ft8xx_copro_cmd(FT8XX_DISPLAY()); ft8xx_copro_cmd_swap();
-
Using
TAG(0)
after every button to clear tag zone -
Adding
k_msleep(10)
after swap to allow frame time -
Monitoring redraw time with
k_uptime_get()
— under 10–15ms per frame
-
Observations
-
When SPI waveform is probed on clock line, glitches increase — maybe SPI signal integrity is marginal
-
If I stop all input and just keep looping redraw, glitches still appear
-
Sometimes the images don’t appear fully — a line or chunk appears "black"
🧩 Suspicions
-
Incomplete display list causes flicker? (DLSTART then SWAP without full commands?)
-
SD card read SPI interfering with FT81x SPI?
-
SPI bus signal quality issue? No level shifters used — direct 3.3V lines
-
FT81x memory bandwidth not fast enough to keep up with frequent chunked bitmap rendering?
-
Some co-processor commands are blocking/stalling?
🧱 Code Snippet Example (Loop Redraw)
while (1) {
ft8xx_copro_cmd_dlstart();
ft8xx_copro_cmd(FT8XX_CLEAR_COLOR_RGB(255,255,255));
ft8xx_copro_cmd(FT8XX_CLEAR(1,1,1));
draw_bitmap_from_ram(58, 30, 40, 420, 40, ADDR_BRIGHT); // Brightness Bar
draw_bitmap_from_ram(159, 30, 40, 420, 40, ADDR_COLOR); // Temp Bar
draw_bitmap_from_ram(235, 120, 330, 330, 330, ADDR_PICKER); // Color Picker
draw_ui_buttons(); // Draw buttons with TAG() and TAG(0)
ft8xx_copro_cmd(FT8XX_DISPLAY());
ft8xx_copro_cmd_swap();
k_msleep(10);
}
🙏 What I Need Help With
-
How to avoid flicker/artifacts during redraws?
-
Is there a "double buffering" or frame sync method for FT81x to avoid half-drawn frames?
-
Could the problem be SPI signal integrity, or just display list issues?
-
Anyone using CMD_APPEND or similar to cache static layout — how?
-
Any tricks to make redraws faster or smoother without full flicker?
-
Hi Adbullah,
It seems like the flickering and glitches you are seeing might be caused by the display list being swapped before it’s fully processed. Even though you're using DISPLAY() and swap(), the coprocessor might not be done with all the commands yet when the swap happens. Checking REG_CMD_READ and REG_CMD_WRITE to make sure the command buffer is empty before swapping could help avoid this.
I also suspect that redrawing the entire screen every frame might be exceeding what the SPI bus and FT810 can handle smoothly, especially if image data is being pulled from RAMG during each redraw. I believe CMD_APPEND can be used to cache static parts of the UI by writing the static display list to RAMG and then using CMD_APPEND each frame to include that block in your active display list. It’s also possible that you're writing to RAMG while it’s being drawn, which could explain some of the artifacts.
On the hardware side, I suspect SPI signal integrity might be part of the problem, especially since probing the clock line with a scope seems to make things worse. Consider shortening SPI lines, adding small series resistors to the clock and data lines, or separating the SD card onto its own SPI controller if possible. Finally, lowering your redraw rate to around 30 FPS can give the FT810 more processing time between frames.
Please let me know if any of these suggestions help.
0
Please sign in to leave a comment.
Comments
1 comment