Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8026

General • Re: LCD Timing Question

$
0
0
A few updates:
  • I had to switch displays - had gotten a 2" based on an ST7789 and a 4" based on an ST7796S. The breakout for the former didn't expose the pin to read, only to write. Thankfully, the 7796S seems virtually identical to the 7789. Thus, my display is actually 480x320x16 now. Flickering was consistent on the new display.
  • I implemented a 480x320x16 framebuffer per the suggestions. It helped immensely - even without doing anything with the refresh timing, the flickering is down to an acceptable level. Appreciate the palette pointer - will explore that as I'm trying to get the RAM usage down later.
  • I bumped my SPI clock up to 75 MHz. My setup is a rat's nest of jumper wire and protoboard, so I'm surprised it works ... but MOSI seems to be solid! MISO, on the other hand, seems to start acting weird above around 10 MHz - not sure if that's my code, the wiring, a limitation of the display, or some combination. Specific symptom was that reading the value of a register started yielding different results once the SPI clock exceeded a specific threshold.
After making the changes, I ran a quick test to see where time was going. I implemented a UART shell command that lets me run a a full screen clear with a fixed color N times, recording elapsed time to let me estimate frames per second. "Rendered" measures the time to both make the updates to the framebuffer and push the frame. "Cleared" measures the overhead associated with filling the framebuffer with a color. "Updated" measures only the time taken to push frames over SPI - no updates are made to frame contents.

Thus, looks like I spend about 21% of my time manipulating the framebuffer in this test, and the other 79% or so pushing frames over SPI:

Code:

UART configuration complete ... starting up!Configuring SPI: 75.000 MHzInitializing joystick.Initializing display.All good.  Launching shell - type 'help' for help.u-shell> fps 120Rendered 120 frames in 5.90 seconds (20.34 FPS)Cleared 120 frames in 1.23 seconds (97.64 FPS)Updated 120 frames in 4.67 seconds (25.70 FPS)
Thanks for the pointers to DMA and PIO - those are likely to be my next stop. Mostly just documenting this here in case someone else stumbles across it later and finds it useful.

Also, thank you all for the quick (and educational) replies!

Statistics: Posted by quintric — Sat Oct 11, 2025 1:11 am



Viewing all articles
Browse latest Browse all 8026

Trending Articles