Skip to main content

Custom HDMI Settings on Raspberry Pi

by MidasDisplays

At Midas Displays we provide a large selection of displays that work great with Raspberry Pi. We offer a range of sizes and resolutions for our HDMI and LVDs displays. To adjust the resolution of the Raspberry Pi to support a selection of our displays. Our (020-4608) and (020-4616) interface board's offer a plug in and play connection between the display and Raspberry Pi. Some displays will need an alteration of the resolutions which can changed using our interface boards.

mceclip0_8473e9b65bdaea45e30c63950630977b6d3d4b8d.png

Raspberry Pi settings

Open the command line on the Pi and enter the following command to open the config.txt file:

Bullseye: sudo nano /boot/config.txt

Bookworm: sudo nano /boot/firmware/config.txt //New location in Bookworm, but currently untested. May also require using X11 to be enabled.

Scroll to the bottom to the [all]*1 section and add the following:

hdmi_group=2 //Sets the Pi to use Display Monitor Timings

hdmi_mode=87 //Sets the Pi to use custom resolutions

hdmi_timings=320 0 20 5 38 240 0 4 3 15 0 0 0 75 0 6500000 1 //Example, see below

Timings

The hdmi_timings section is the one you will need to change manually. Each number represents the following:

hdmi_timings=<h_active_pixels> <h_sync_polarity> <h_front_porch> <h_sync_pulse> <h_back_porch> <v_active_lines> <v_sync_polarity> <v_front_porch> <v_sync_pulse> <v_back_porch> <v_sync_offset_a> <v_sync_offset_b> <pixel_rep> <frame_rate> <interlaced> <pixel_freq> <aspect_ratio>

You will need to use the display’s datasheet to get the relevant information regarding each of these sections. Table 1 includes a description of each of these parts to help find them.

The following settings may also be needed:

config_hdmi_boost=4 //HDMI signal boost, used for longer cables. Higher values needed for longer cables.

disable_overscan=1 //Disables Overscan, image cropping and stretching

hdmi_force_hotplug=1 //Forces the HDMI to run in hotplug mode

hdmi_ignore_edid=0xa5000080 //Forces the HDMI to output 1920x1080p

*1 This can also be either put in the [HDMI 1] or [HDMI 2] if specific ports are needed.

Table 1:

Section Description
h_active_pixels Horizontal pixels (width/rows/X)
h_sync_polarity Invert HSYNC polarity
h_front_porch Horizontal padding from DE active edge
h_sync_pulse HSYNC pulse width in pixel clocks
h_back_porch Vertical back padding from DE active edge
v_active_lines Vertical Pixel height (lines/columns/Y)
v_sync_polarity Invert VSYNC polarity
v_front_porch Vertical forward padding from DE active edge
V_sync_pulse VSYNC pulse width in pixel clocks
V_back_porch Vertical back padding from DE active edge
V_sync_offset_a Leave at zero
V_sync_offset_b Leave at zero
Pixel_rep Leave at zero
Frame_rate Screen refresh rate in Hz
interlaced Leave at zero
pixel_freq clock frequency (h_active_pixels + h_front_porch + h_sync_pulse + h_back_porch)* (v_active_lines + v_front_porch + v_sync_pulse + v_back_porch)* framerate
aspect_ratio Use Table 2 and use the closest aspect ratio to your application

Table 2:

aspect_ratio Aspect Ratio Value
HDMI_ASPECT_4_3 4:3 1
HDMI_ASPECT_14_9 14:9 2
HDMI_ASPECT_16_9 16:9 3
HDMI_ASPECT_5_4 5:4 4
HDMI_ASPECT_16_10 16:10 5
HDMI_ASPECT_15_9 15:9 6
HDMI_ASPECT_21_9 21:9 7
HDMI_ASPECT_64_27 64:27 8

Once the code has been added, you can save it with CTRL+O, then CTRL+Y. Use CTRL+X to exit.

Source: Raspberry Pi

Established in 2000, Midas is a UK based displays specialist, designing, manufacturing, and supplying high-quality display products and accessories. We cover a broad range of applications and markets with our display offering, and we also offer a range of sensor products. Our goal is to provide our customers with a display solution which is ideal for their application and are committed to working with them through the process from initial design-in, through to product production and aftercare.
DesignSpark Logo

Enjoying DesignSpark?

Create an account to unlock powerful PCB and 3D Mechanical design software, collaborate in our forums, and download over a million free 3D models, schematics, and footprints.
Create an account

Already a DesignSpark member? Log In

Comments