Copyright © 2020-2021 Shenzhen CDTech Electronics LTD. All rights reserved. Site Map Powered by iwonder.cn
A datasheet timing table and a DRM mode line describe the same waveform in different words. The table lists active pixels, porches and a clock; DRM wants start and end coordinates for every sync, and one arithmetic slip produces an image that is shifted, scaled or missing.
This guide converts one into the other for linux drm panel timing work and shows the three errors that account for most failures.
Start with the table for an 800x480 panel: 800 active pixels, 190 front porch, 20 hsync width, 46 back porch, 480 active lines, 12 vertical front porch, 10 vertical sync and 23 vertical back porch, with a 33.264 MHz clock.
The horizontal total is 800 + 190 + 20 + 46 = 1,056 and the vertical total is 480 + 12 + 10 + 23 = 525. Together they give 554,400 pixel clocks per frame, which at 33.264 MHz is 60.06 Hz.
DRM stores the clock in kHz and describes each sync as a start and an end. hsync_start is 990, hsync_end 1,010 and htotal 1,056; the vertical fields are 492, 502 and 525. A 480x272 panel follows the same pattern with 525 by 286 totals and a 9.009 MHz clock for 60 Hz.
A porch added twice, a sync omitted, or a clock rounded.
Each error moves the image in a different way, so the symptom points at the mistake before any logic analyser is connected to the board.
Omitting the sync width from htotal is the most common. A total of 800 + 190 + 46 misses the 20-clock sync, so the line runs 1,036 clocks instead of 1,056; the host finishes early, the image shifts left and a band of noise appears at the right edge.
Setting hsync_start to 800 rather than 990 is the second: every pixel lands 190 clocks late, so the image shifts right and the last columns wrap. Rounding the clock is the third. Entering 33 MHz instead of 33.264 MHz changes the frame rate by 0.8 percent, enough to blank a panel or produce a slowly rolling seam.
The sync width is the pulse; the back porch follows it.
Some tables fold the sync width into the back porch, so reading the column literally shortens the line by up to 50 clocks.
Definitions differ between vendors, and the difference is measurable. A table that lists HBP from sync start to active start includes the sync width; one that lists it from sync end to active start does not. The first is larger by exactly the sync width, so treating it as the second subtracts the pulse twice.
Read the timing diagram rather than the heading. It marks the active area, the front porch from active end to sync start, the pulse, and the back porch from pulse end to the next line. DRM's names follow that order: hsync_start where the pulse begins, hsync_end where it ends, htotal where the next line begins.
Polarity is not part of the mode arithmetic, which is why it is forgotten. A datasheet shows whether sync pulses are active high or low and whether the panel samples data on the rising or falling clock edge. In a device tree those become hsync-active, vsync-active, de-active and pixelclk-active, each written as 0 or 1.
The DRM mode flags carry the sync half of the same information, PHSYNC or NHSYNC and PVSYNC or NVSYNC, while the pixel clock edge lives in the connector bus flags. If driver and panel disagree, the result is a stable image with a horizontal offset, a jittering image, or no image at all.
Read the flags back rather than trusting the source. A mode dump shows what reached the kernel, and comparing it with the timing diagram takes less time than reflashing a guess. A bridge in the path may invert polarity again, so check both ends.
A panel datasheet states whether the interface uses a data enable signal or relies on sync alone. In DE mode the panel latches pixels while DE is asserted; in sync mode it counts clocks from the sync edges and DE is tied to its active level. A mode built for one produces a blank or torn image on the other.
The choice appears in the connector bus flags and the de-active property, while the panel driver decides which mode it supports. A quick check is the pin list: if a DE input exists, the mode should drive it, and if the pin is absent the driver must not set a DE flag.
| Signal set | Typical panel | Device tree setting | If mismatched |
|---|---|---|---|
| HSYNC, VSYNC, DE | Most RGB TFT modules | de-active = 1 or 0 | Blank or shifted image |
| HSYNC, VSYNC only | Older RGB panels | DE tied to active level | Torn or wrapped image |
| DE with embedded timing | Some bridge outputs | Bus flag set in the bridge | No sync lock |
The node layout and property names are set out in the Linux DRM KMS panel integration and device tree timing page, and a mode dump confirms which path the kernel took.
The frame rate moves by about one line per second.
A 36 kHz error on a 33.264 MHz clock shifts the refresh by 0.06 Hz, which advances a tear line about 31 lines every second.
DRM stores the pixel clock in kilohertz, so 33.264 MHz becomes 33,264. Entering the datasheet's headline 33.3 MHz as 33,300 is a 36 kHz error, or 0.11 percent, and the frame rate rises from 60.06 to 60.13 Hz.
That difference is small in frequency and large in appearance. Host and panel are now 0.06 frames per second apart, so the boundary between new and old content advances about 31 lines every second. On a 525-line frame the seam crosses the screen in roughly 17 seconds, which reads as a rolling bar rather than a static tear. Even a 1 kHz error leaves 0.9 lines per second of drift, visible over a minute. Groups such as the Society for Information Display publish the vocabulary for these artifacts.
Diagnosis starts with the kind of defect. A cable or connector fault is stochastic: sparkle, missing colours, occasional sync loss, or an image that changes when the cable moves. A porch error is deterministic, identical on every frame, and survives a cable swap.
Measure the offset in pixels. A shift of 190 px matches the front porch in the 800x480 example, pointing at hsync_start being set to hdisplay. A shift of 20 px matches the sync width, pointing at a total that omits the pulse. A shift that grows across the screen points at a clock error rather than an offset.
The same logic covers scaling. If the image fills the panel but is stretched, htotal or vtotal is wrong while the active size is right. If it is compressed with black bars, the mode is larger than the panel, and bars on one axis only mean the other axis is correct.
A bridge can accept a mode the panel supports and still refuse it. The link has its own limits: lane count, lane rate and bits per pixel, and a mode that fits the panel can exceed the link once blanking is included.
The arithmetic is a bandwidth check. For 800x480 at 60 Hz and 24 bits per pixel, 33.264 MHz times 24 is 798 Mbit/s; over four DSI lanes that is 200 Mbit/s each, well inside the first DSI generation. A 1920x720 mode at 60 Hz is 110.9 MHz times 24, or 2.66 Gbit/s, which needs four lanes at 665 Mbit/s and fits DSI 1.2.
The pass-through limits are separate: some bridges require an even htotal, some cannot generate DE, and some only accept fixed CEA modes. Test through the full chain, because a mode that works on a direct connector and fails behind a bridge is a link limit, not a panel fault. The MIPI DSI specification defines the lane budget.
The panel range, the PLL steps and the lane rate.
A mode can pass every porch calculation and still be rejected because its clock falls outside one of the three ranges that bound the link.
The panel lists a minimum and maximum DCLK. A 7 inch 800x480 module may specify 25 to 40 MHz with a 33.3 MHz typical, so a 29.2 MHz mode is legal while a 20 MHz mode is not. A 480x272 panel often lists a narrower range around 9 MHz, which is why a mode borrowed from a larger panel fails.
Then check the clock tree. If the PLL can only produce 33.0 or 33.3 MHz, the mode must accept that error and the frame rate moves with it. Finally check the link: a bridge rated for four lanes at 1 Gbit/s cannot carry 2.66 Gbit/s of RGB888, and dropping to RGB666 saves 25 percent. VESA timing notation is the reference for the totals, and oscillator tolerance is usually qualified to JEDEC practice.
Validation is a sequence of comparisons, each cheap enough to run before the next. Prove the numbers before judging the image, because a correct mode still looks wrong if the backlight is late or the bridge is configured after the timing.
The last step is often skipped. An underrun message says the mode is valid but the system cannot feed it, which is a different fault from a timing error. The interfaces and controllers guide covers the link, the panel technology guide covers the glass, the download library holds the timing tables, and IEC methods are the usual basis for the EMC checks that follow.
Numbers that survive a mode dump are easier to defend than numbers copied from a headline. CDTech can provide the timing table, DCLK range and connector drawing for a candidate panel so the mode is derived from one source. Write to [email protected] or use the contact page to request them.
How is pixel clock calculated from timing?
Multiply the horizontal total by the vertical total, then by the refresh rate. The horizontal total is the active width plus the front porch, the sync width and the back porch; the vertical total is built the same way from the active height and the three vertical intervals. For 800x480 with totals of 1,056 and 525 at 60 Hz, the result is 33.264 MHz. Compare that figure with the datasheet's DCLK range and typical value before writing the mode, because a mode that misses the range is rejected however correct its porches are.
What is the difference between hsync and hbp?
hsync is the pulse that marks the start of a line, and hbp is the blanking interval between the end of that pulse and the first active pixel. The front porch sits before the pulse. In DRM terms hsync_start is where the pulse begins, hsync_end is where it ends, and the back porch fills the gap from hsync_end to the start of the next line. Some datasheets fold the pulse width into the back porch, so always confirm the definition against the timing diagram before converting.
Why does my panel show a black border?
A border means the mode is larger than the active area, or the framework is letterboxing rather than the panel. If the border appears on every source, including a test pattern, the mode's active width or height exceeds the panel and the extra pixels fall outside the glass. If the border appears only in one application, the app is declaring a smaller aspect ratio and the compositor is padding it. Compare the mode in a dump with the panel's active area first, then check the application.
Are DE-mode and sync-mode panels different?
They differ in how the panel decides which pixels are active. A DE-mode panel latches data while the data enable signal is asserted and ignores the blanking intervals, so the timing of DE matters as much as the syncs. A sync-mode panel counts clocks from the sync edges and expects DE tied to its active level. The glass can be identical, which is why the same panel family may appear in both variants. The device tree must match the variant, and a mode dump will show which bus flags the kernel applied.
By continuing to use the site you agree to our privacy policy Terms and Conditions.