The Raspberry Pi 4 can drive up to two displays, with a resolution up to 1080p at a 60Hz refresh rate. At 4K resolution, if you connect two displays then you are limited to a 30Hz refresh rate. You can also drive a single display at 4K with a 60Hz refresh rate: this requires that the display is attached to the HDMI port adjacent to the USB-C power input (labelled HDMI0). You must also enable 4Kp60 output by setting the
hdmi_enable_4kp60=1
flag in config.txt. This flag can also be set using the 'Raspberry Pi Configuration' tool within the desktop environment.What modes does my device support?
You can use the
tvservice
application on the command line to determine which modes are supported by your device, along with other useful data:tvservice -s
displays the current HDMI status, including mode and resolutiontvservice -m CEA
lists all supported CEA modestvservice -m DMT
lists all supported DMT modes
If you are using a Pi 4 with more than one display attached, then
tvservice
needs to be told which device to ask for information. You can get display IDs for all attached devices by using:tvservice -l
You can specify which display
tvservice
uses by adding -v
to the tvservice
command, e.g:tvservice -v 7 -m CEA
, lists all supported CEA modes for display ID 7
Setting a specific HDMI mode
Setting a specific mode is done using the
hdmi_group
and hdmi_mode
config.txt entries. The group entry selects between CEA or DMT, and the mode selects the resolution and frame rate. You can find tables of modes on the config.txt Video Configuration page, but you should use the tvservice
command described above to find out exactly which modes your device supports.
On the Pi 4, to specify the HDMI port, add an index identifier to the
hdmi_group
or hdmi_mode
entry in config.txt, e.g. hdmi_mode:0
or hdmi_group:1
.Setting a custom HDMI mode
There are two options for setting a custom mode:
hdmi_cvt
and hdmi_timings
.hdmi_cvt
sets a custom Coordinated Video Timing entry, which is described fully here: Video Configuration
In certain rare cases it may be necessary to define the exact clock requirements of the HDMI signal. This is a fully custom mode, and it is activated by setting
hdmi_group=2
and hdmi_mode=87
. You can then use the hdmi_timings
config.txt command to set the specific parameters for your display. hdmi_timings
specifies all the timings that an HDMI signal needs to use. These timings are usually found in the datasheet of the display being used.hdmi_timings= v_front_porch>
Timing | Purpose |
---|---|
h_active_pixels | The horizontal resolution |
h_sync_polarity | 0 or 1 to define the horizontal sync polarity |
h_front_porch | Number of horizontal front porch pixels |
h_sync_pulse | Width of horizontal sync pulse |
h_back_porch | Number of horizontal back porch pixels |
v_active_lines | The vertical resolution |
v_sync_polarity | 0 or 1 to define the vertical sync polarity |
v_front_porch | Number of vertical front porch pixels |
v_sync_pulse | Width of vertical sync pulse |
v_back_porch | Number of vertical back porch pixels |
v_sync_offset_a | Leave at 0 |
v_sync_offset_b | Leave at 0 |
pixel_rep | Leave at 0 |
frame_rate | Frame rate of mode |
interlaced | 0 for non-interlaced, 1 for interlaced |
pixel_freq | The mode pixel frequency |
aspect_ratio | The aspect ratio required |
aspect_ratio
should be one of the following:Ratio | aspect_ratio ID |
---|---|
4:3 | 1 |
14:9 | 2 |
16:9 | 3 |
5:4 | 4 |
16:10 | 5 |
15:9 | 6 |
21:9 | 7 |
64:27 | 8 |
For the Pi4, to specify the HDMI port, you can add an index identifier to the config.txt. e.g.
hdmi_cvt:0=...
or hdmi_timings:1=...
. If no port identifier is specified, the settings are applied to port 0.Display Rotation
Please see the Display Rotation Page for details.
HDMI not working properly?
In some rare cases you may need to increase the HDMI drive strength, for example when there is speckling on the display or when you are using very long cables. There is a config.txt item to do this,
config_hdmi_boost
, which is documented on the config.txt video page.
The Raspberry Pi 4B does not yet support
config_hdmi_boost
, support for this option will be added in a future software update.
没有评论:
发表评论