Display Parallel Interface (DPI)
An up-to-24-bit parallel RGB interface is available on all Raspberry Pi boards with the 40 way header and the Compute Modules. This interface allows parallel RGB displays to be attached to the Raspberry Pi GPIO either in RGB24 (8 bits for red, green and blue) or RGB666 (6 bits per colour) or RGB565 (5 bits red, 6 green, and 5 blue).
This interface is controlled by the GPU firmware and can be programmed by a user through special config.txt parameters and by enabling the correct Linux Device Tree overlay.
GPIO pins
One of the alternate functions selectable on Bank 0 of the Raspberry Pi GPIO is DPI (Display Parallel Interface) which is a simple clocked parallel interface (up to 8 bits of R, G and B; clock, enable, hsync, and vsync). This interface is available as alternate function 2 (ALT2) on GPIO Bank 0:
| GPIO | ALT2 |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
There are various ways that the colour values can be presented on the DPI output pins in either 565, 666, or 24-bit modes (see the following table and the output_format part of the dpi_output_format parameter below):
|
Mode |
RGB bits |
GPIO |
|||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
||
1 |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
2 |
565 |
- |
- |
- |
- |
- |
- |
- |
- |
7 |
6 |
5 |
4 |
3 |
7 |
6 |
5 |
4 |
3 |
2 |
7 |
6 |
5 |
4 |
3 |
3 |
565 |
- |
- |
- |
7 |
6 |
5 |
4 |
3 |
- |
- |
7 |
6 |
5 |
4 |
3 |
2 |
- |
- |
- |
7 |
6 |
5 |
4 |
3 |
4 |
565 |
- |
- |
7 |
6 |
5 |
4 |
3 |
- |
- |
- |
7 |
6 |
5 |
4 |
3 |
2 |
- |
- |
7 |
6 |
5 |
4 |
3 |
- |
5 |
666 |
- |
- |
- |
- |
- |
- |
7 |
6 |
5 |
4 |
3 |
2 |
7 |
6 |
5 |
4 |
3 |
2 |
7 |
6 |
5 |
4 |
3 |
2 |
6 |
666 |
- |
- |
7 |
6 |
5 |
4 |
3 |
2 |
- |
- |
7 |
6 |
5 |
4 |
3 |
2 |
- |
- |
7 |
6 |
5 |
4 |
3 |
2 |
7 |
888 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Disable other GPIO peripherals
All other peripheral overlays that use conflicting GPIO pins must be disabled. In config.txt, take care to comment out or invert any dtparams that enable I2C or SPI:
dtparam=i2c_arm=off
dtparam=spi=off
Configure a display
The Kernel Mode Setting (KMS) generic display interface enables output to arbitrary displays, as long as you have an appropriate driver.
Auto detect
Auto detect allows your Raspberry Pi to connect with a display without a manually configured device tree overlay.
Auto detection is enabled by default. You can enable display auto detect by adding the following line to config.txt:
display_auto_detect=1
Replace the 1 with a 0 to disable auto detect.
When you connect the official Raspberry Pi display with auto detect enabled, KMS determines the display model automatically and configures the appropriate display settings.
Manually configure a display
From Raspberry Pi OS Bookworm onwards, the dpi_output_format and dpi_timings entries in config.txt previously used to set up DPI have been superseded by the vc4-kms-dpi-generic overlay.
|
To use any display other than the official Raspberry Pi display, you must specify a dtoverlay entry in config.txt. The panel manufacturer should configure timings for your display in Linux kernel code and provide an overlay to enable those settings. See the Adafruit Kippah display entry for an example. The following example demonstrates how to set a dtoverlay entry for the Kippah display in your /boot/firmware/config.txt file:
dtoverlay=vc4-kms-kippah-7inch-overlay
Display timings are usually defined in the kernel, but you can also define them in the provided panel-dpi driver. If your panel lacks a defined overlay in kernel code, you can use the panel-dpi driver to define display timings as parameters. This enables you to manually configure a device tree entry for any display.
The following example demonstrates how you can define timings using device tree parameters:
dtoverlay=vc4-kms-v3d
dtoverlay=vc4-kms-dpi-generic,hactive=480,hfp=26,hsync=16,hbp=10
dtparam=vactive=640,vfp=25,vsync=10,vbp=16
dtparam=clock-frequency=32000000,rgb666-padhi
| Device tree line length must not exceed 80 characters. When a setting requires a line longer than 80 characters, split the assignment of that parameter across multiple lines. |
Parameter display tree definitions support the following options:
| Option | Description |
|---|---|
|
Display clock frequency (Hz) |
|
Horizontal active pixels |
|
Horizontal front porch |
|
Horizontal sync pulse width |
|
Horizontal back porch |
|
Vertical active lines |
|
Vertical front porch |
|
Vertical sync pulse width |
|
Vertical back porch |
|
Horizontal sync active low |
|
Vertical sync active low |
|
Data Enable active low |
|
Negative edge pixel clock |
|
Defines the screen width in millimetres |
|
Defines the screen height in millimetres |
|
Change to RGB565 output on GPIOs 0-19 |
|
Change to RGB666 output on GPIOs 0-9, 12-17, and 20-25 |
|
Change to RGB888 output on GPIOs 0-27 |
|
Override the bus format for a MEDIA_BUS_FMT_* value, also overridden by rgbXXX overrides |
|
Defines a GPIO to be used for backlight control (default value: none) |