Raspberry Pi Documentation - The Config
Raspberry Pi Documentation - The Config
html
What is config.txt?
Edit this on GitHub
The Raspberry Pi uses a con�guration �le instead of the BIOS you would expect to �nd on
a conventional PC. The system con�guration parameters, which would traditionally be
edited and stored using a BIOS, are stored instead in an optional text �le named
config.txt. This is read by the GPU before the ARM CPU and Linux are initialised. It must
therefore be located on the �rst (boot) partition of your SD card, alongside bootcode.bin
and start.elf. This �le is normally accessible as /boot/config.txt from Linux, and must
be edited as the root user. From Windows or OS X it is visible as a �le in the only
accessible part of the card. If you need to apply some of the con�g settings below, but you
don’t have a config.txt on your boot partition yet, simply create it as a new text �le.
Any changes will only take effect after you have rebooted your Raspberry Pi. After Linux
has booted, you can view the current active settings using the following commands:
• vcgencmd get_config <config>: this displays a speci�c con�g value, e.g. vcgencmd
get_config arm_freq.
• vcgencmd get_config int: this lists all the integer con�g options that are set (non-
zero).
• vcgencmd get_config str: this lists all the string con�g options that are set (non-
null).
NOTE
There are some con�g settings that cannot be retrieved using vcgencmd.
File Format
The config.txt �le is read by the early-stage boot �rmware, so it has a very simple �le
format. The format is a single property=value statement on each line, where value is
either an integer or a string. Comments may be added, or existing con�g values may be
There is a 98-character line length limit (previously 78) for entries - any characters past this
limit will be ignored.
Advanced Features
include
Causes the content of the speci�ed �le to be inserted into the current �le.
For example, adding the line include extraconfig.txt to config.txt will include the
content of extraconfig.txt �le in the config.txt �le.
Conditional Filtering
autoboot.txt
Edit this on GitHub
This can also be used in conjunction with the tryboot feature to implement A/B booting
for OS upgrades.
autoboot.txt is limited to 512 bytes and supports the [all], [none] and [tryboot]
conditional �lters.
boot_partition
Speci�es the partition number for booting unless the partition number was already
speci�ed as parameter to the reboot command (e.g. sudo reboot 2).
tryboot_a_b
Set this property to 1 to load the normal config.txt and boot.img �les instead of
tryboot.txt and tryboot.img when the tryboot �ag is set. This enables the tryboot
switch to be made at the partition level rather than the �le-level without having to modify
con�guration �les in the A/B partitions.
Initial autoboot.txt
[all]
tryboot_a_b=1
boot_partition=2
[tryboot]
boot_partition=3
• The update is tested by rebooting to tryboot mode reboot "0 tryboot" where 0
means the default partition.
• System boots from partition 3 because the [tryboot] �lter evaluates to true in
tryboot mode.
▪ The Update Service validates the system to verify that the update was
successful.
▪ Else
▪ End if
◦ End If
• End If
Updated autoboot.txt
[all]
tryboot_a_b=1
boot_partition=3
[tryboot]
boot_partition=2
Notes * It’s not mandatory to reboot after updating autoboot.txt. However, the Update
Service must be careful to avoid overwriting the current partition since autoboot.txt has
already been modi�ed to commit the last update.. * See also: Device-tree parameters.
Common Options
Edit this on GitHub
disable_overscan
The default value for disable_overscan is 0 which gives default values of overscan for the
left, right, top, and bottom edges of 48 for HD CEA modes, 32 for SD CEA modes, and 0 for
DMT modes.
Set disable_overscan to 1 to disable the default values of overscan that are set by the
�rmware.
By default, when connected to a 4K monitor, the Raspberry Pi 4B, 400 and CM4 will select
a 30Hz refresh rate. Use this option to allow selection of 60Hz refresh rates.
IMPORTANT
WARNING
camera_auto_detect
With this setting enabled (set to 1), the �rmware will automatically load overlays for
cameras that it recognises.
IMPORTANT
New Raspberry Pi OS images from Bullseye onwards come with this setting by default.
display_auto_detect
With this setting enabled (set to 1), the �rmware will automatically load overlays for
displays that it recognises.
IMPORTANT
New Raspberry Pi OS images from Bullseye onwards come with this setting by default.
dtoverlay
The dtoverlay option requests the �rmware to load a named Device Tree overlay - a
con�guration �le that can enable kernel support for built-in and external hardware. For
example, dtoverlay=vc4-kms-v3d loads an overlay that enables the kernel graphics driver.
As a special case, if called with no value - dtoverlay= - it marks the end of a list of overlay
parameters. If used before any other dtoverlay or dtparam setting it prevents the loading
of any HAT overlay.
dtparam
Device Tree con�guration �les for Raspberry Pis support a number of parameters for such
things as enabling I2C and SPI interfaces. Many DT overlays are con�gurable via the use of
parameters. Both types of parameters can be supplied using the dtparam setting. In
addition, overlay parameters can be appended to the dtoverlay option, separated by
commas, but beware the line length limit - previously 78 characters, now 98 characters.
All Raspberry Pi 400s and newer revisions of the Raspberry Pi 4B are equipped with a
second switch-mode power supply for the SoC voltage rail, and this allows the default
turbo-mode clock to be increased from 1.5GHz to 1.8GHz. This change should be safe for
all such boards, but to avoid unrequested changes for existing installations this change
must be accepted by setting arm_boost=1.
IMPORTANT
New Raspberry Pi OS images from Bullseye onwards come with this setting by default.
The onboard audio output uses con�g options to change the way the analogue audio is
driven, and whether some �rmware features are enabled or not.
audio_pwm_mode
audio_pwm_mode=1 selects legacy low-quality analogue audio from the 3.5mm AV jack.
audio_pwm_mode=2 (the default) selects high quality analogue audio using an advanced
modulation scheme.
NOTE
This option uses more GPU compute resources and can interfere with some use
cases.
disable_audio_dither
By default, a 1.0LSB dither is applied to the audio stream if it is routed to the analogue
audio output. This can create audible background "hiss" in some situations, for example
when the ALSA volume is set to a low level. Set disable_audio_dither to 1 to disable
dither application.
enable_audio_dither
Audio dither (see disable_audio_dither above) is normally disabled when the audio
samples are larger than 16 bits. Set this option to 1 to force the use of dithering for all bit
depths.
pwm_sample_bits
The pwm_sample_bits command adjusts the bit depth of the analogue audio output. The
default bit depth is 11. Selecting bit depths below 8 will result in nonfunctional audio, as
settings below 8 result in a PLL frequency too low to support. This is generally only useful
as a demonstration of how bit depth affects quantisation noise.
Boot Options
Edit this on GitHub
start_file, fixup_file
These options specify the �rmware �les transferred to the VideoCore GPU prior to booting.
start_file speci�es the VideoCore �rmware �le to use. fixup_file speci�es the �le used
to �x up memory locations used in the start_file to match the GPU memory split. Note
that the start_file and the fixup_file are a matched pair - using unmatched �les will
stop the board from booting. This is an advanced option, so we advise that you use
start_x and start_debug rather than this option.
start_x, start_debug
These provide a shortcut to some alternative start_file and fixup_file settings, and are
the recommended methods for selecting �rmware con�gurations.
start_x=1 implies
start_file=start_x.elf
fixup_file=fixup_x.dat
On the Raspberry Pi 4, if the �les start4x.elf and fixup4x.dat are present, these �les will
be used instead.
start_debug=1 implies
start_file=start_db.elf
fixup_file=fixup_db.dat
start_x=1 should be speci�ed when using the camera module. Enabling the camera via
raspi-config will set this automatically.
disable_commandline_tags
Set the disable_commandline_tags command to 1 to stop start.elf from �lling in ATAGS
(memory from 0x100) before launching the kernel.
cmdline
cmdline is the alternative �lename on the boot partition from which to read the kernel
command line string; the default value is cmdline.txt.
kernel
kernel is the alternative �lename on the boot partition to use when loading the kernel. The
default value on the Raspberry Pi 1, Zero and Zero W, and Raspberry Pi Compute Module 1
is kernel.img. The default value on the Raspberry Pi 2, 3, 3+ and Zero 2 W, and Raspberry
Pi Compute Modules 3 and 3+ is kernel7.img. The default value on the Raspberry Pi 4 and
400, and Raspberry Pi Compute Module 4 is kernel7l.img.
arm_64bit
If set to non-zero, forces the kernel loading system to assume a 64-bit kernel, starts the
processors up in 64-bit mode, and sets kernel8.img to be the kernel image loaded, unless
there is an explicit kernel option de�ned in which case that is used instead. Defaults to 0
on all platforms.
NOTE
64-bit kernels may be uncompressed image �les or a gzip archive of an image (which
can still be called kernel8.img; the bootloader will recognize the archive from the
signature bytes at the beginning).
NOTE
The 64-bit kernel will only work on the Raspberry Pi 3, 3+, 4, 400, Zero 2 W and 2B rev
1.2, and Raspberry Pi Compute Modules 3, 3+ and 4.
arm_control
WARNING
armstub
armstub is the �lename on the boot partition from which to load the ARM stub. The default
ARM stub is stored in �rmware and is selected automatically based on the Raspberry Pi
model and various settings.
The stub is a small piece of ARM code that is run before the kernel. Its job is to set up low-
level hardware like the interrupt controller before passing control to the kernel.
arm_peri_high
Set arm_peri_high to 1 to enable "High Peripheral" mode on the Raspberry Pi 4. It is set
automatically if a suitable DTB is loaded.
NOTE
Enabling "High Peripheral" mode without a compatible device tree will make your
system fail to boot. Currently ARM stub support is missing, so you will also need to
load a suitable �le using armstub.
kernel_address
kernel_address is the memory address to which the kernel image should be loaded. 32-bit
kernels are loaded to address 0x8000 by default, and 64-bit kernels to address 0x200000. If
kernel_old is set, kernels are loaded to the address 0x0.
kernel_old
Set kernel_old to 1 to load the kernel to the memory address 0x0.
ramfsfile
ramfsfile is the optional �lename on the boot partition of a ramfs to load.
NOTE
Newer �rmware supports the loading of multiple ramfs �les. You should separate the
multiple �le names with commas, taking care not to exceed the 80-character line
length limit. All the loaded �les are concatenated in memory and treated as a single
ramfs blob. More information is available on the forums.
ramfsaddr
ramfsaddr is the memory address to which the ramfsfile should be loaded.
initramfs
The initramfs command speci�es both the ramfs �lename and the memory address to
which to load it. It performs the actions of both ramfsfile and ramfsaddr in one parameter.
The address can also be followkernel (or 0) to place it in memory after the kernel image.
Example values are: initramfs initramf.gz 0x00800000 or initramfs init.gz
followkernel. As with ramfsfile, newer �rmwares allow the loading of multiple �les by
comma-separating their names.
NOTE
This option uses different syntax from all the other options, and you should not use a =
character here.
init_uart_baud
init_uart_baud is the initial UART baud rate. The default value is 115200.
init_uart_clock
init_uart_clock is the initial UART clock frequency. The default value is 48000000
(48MHz). Note that this clock only applies to UART0 (ttyAMA0 in Linux), and that the
maximum baudrate for the UART is limited to 1/16th of the clock. The default UART on the
Raspberry Pi 3 and Raspberry Pi Zero is UART1 (ttyS0 in Linux), and its clock is the core
VPU clock - at least 250MHz.
bootcode_delay
The bootcode_delay command delays for a given number of seconds in bootcode.bin
before loading start.elf: the default value is 0.
This is particularly useful to insert a delay before reading the EDID of the monitor, for
example if the Raspberry Pi and monitor are powered from the same source, but the
monitor takes longer to start up than the Raspberry Pi. Try setting this value if the display
detection is wrong on initial boot, but is correct if you soft-reboot the Raspberry Pi without
removing power from the monitor.
boot_delay
The boot_delay command instructs to wait for a given number of seconds in start.elf
before loading the kernel: the default value is 1. The total delay in milliseconds is calculated
as (1000 x boot_delay) + boot_delay_ms. This can be useful if your SD card needs a
while to get ready before Linux is able to boot from it.
boot_delay_ms
The boot_delay_ms command means wait for a given number of milliseconds in
start.elf, together with boot_delay, before loading the kernel. The default value is 0.
disable_poe_fan
By default, a probe on the I2C bus will happen at startup, even when a PoE HAT is not
attached. Setting this option to 1 disables control of a PoE HAT fan through I2C (on pins
ID_SD & ID_SC). If you are not intending to use a PoE HAT doing this is useful if you need to
minimise boot time.
disable_splash
If disable_splash is set to 1, the rainbow splash screen will not be shown on boot. The
default value is 0.
enable_uart
enable_uart=1 (in conjunction with console=serial0 in cmdline.txt) requests that the
kernel creates a serial console, accessible using GPIOs 14 and 15 (pins 8 and 10 on the 40-
pin header). Editing cmdline.txt to remove the line quiet enables boot messages from the
kernel to also appear there. See also uart_2ndstage.
force_eeprom_read
Set this option to 0 to prevent the �rmware from trying to read an I2C HAT EEPROM
(connected to pins ID_SD & ID_SC) at powerup. See also disable_poe_fan.
os_prefix
os_prefix is an optional setting that allows you to choose between multiple versions of
the kernel and Device Tree �les installed on the same card. Any value in os_prefix is
prepended to (stuck in front of) the name of any operating system �les loaded by the
�rmware, where "operating system �les" is de�ned to mean kernels, initramfs, cmdline.txt,
.dtbs and overlays. The pre�x would commonly be a directory name, but it could also be
part of the �lename such as "test-". For this reason, directory pre�xes must include the
trailing / character.
In an attempt to reduce the chance of a non-bootable system, the �rmware �rst tests the
supplied pre�x value for viability - unless the expected kernel and .dtb can be found at the
new location/name, the pre�x is ignored (set to ""). A special case of this viability test is
applied to overlays, which will only be loaded from ${os_prefix}${overlay_prefix} (where
the default value of overlay_prefix is "overlays/") if ${os_prefix}${overlay_prefix}README
exists, otherwise it ignores os_prefix and treats overlays as shared.
(The reason the �rmware checks for the existence of key �les rather than directories when
checking pre�xes is twofold - the pre�x may not be a directory, and not all boot methods
support testing for the existence of a directory.)
NOTE
Any user-speci�ed OS �le can bypass all pre�xes by using an absolute path (with
respect to the boot partition) - just start the �le path with a /, e.g.
kernel=/my_common_kernel.img.
Raspberry Pi 4B and Raspberry Pi 400 (not CM4 or CM4IO) add a high performance USB 3
controller, attached via PCIe, to drive the main USB ports. The legacy USB 2 controller is
still available on the USB-C power connector for use as a device (otg_mode=0, the default).
otg_mode=1 requests that a more capable XHCI USB 2 controller is used as another host
controller on that USB-C connector.
NOTE
Because CM4 and CM4IO don’t include the external USB 3 controller, Raspberry Pi OS
images set otg_mode=1 on CM4 for better performance.
overlay_prefix
Speci�es a subdirectory/pre�x from which to load overlays - defaults to overlays/ (note
the trailing /). If used in conjunction with os_prefix, the os_prefix comes before the
overlay_prefix, i.e. dtoverlay=disable-bt will attempt to load
${os_prefix}${overlay_prefix}disable-bt.dtbo.
NOTE
sha256
If set to non-zero, enables the logging of SHA256 hashes for loaded �les (the kernel,
initramfs, Device Tree .dtb �le and overlays), as generated by the sha256sum utility. The
logging output goes to the UART if enabled, and is also accessible via sudo vcdbg log msg.
This option may be useful when debugging booting problems, but at the cost of potentially
adding many seconds to the boot time. Defaults to 0 on all platforms.
uart_2ndstage
Setting uart_2ndstage=1 causes the second-stage loader (bootcode.bin on devices prior
to the Raspberry Pi 4, or the boot code in the EEPROM for Raspberry Pi 4 devices) and the
main �rmware (start*.elf) to output diagnostic information to UART0.
Be aware that output is likely to interfere with Bluetooth operation unless it is disabled
(dtoverlay=disable-bt) or switched to the other UART (dtoverlay=miniuart-bt), and if
the UART is accessed simultaneously to output from Linux then data loss can occur
leading to corrupted output. This feature should only be required when trying to diagnose
an early boot loading problem.
upstream_kernel
If upstream_kernel=1 is used, the �rmware sets os_prefix to "upstream/", unless it has
been explicitly set to something else, but like other os_prefix values it will be ignored if the
required kernel and .dtb �le can’t be found when using the pre�x.
The �rmware will also prefer upstream Linux names for DTBs (bcm2837-rpi-3-b.dtb
instead of bcm2710-rpi-3-b.dtb, for example). If the upstream �le isn’t found the �rmware
will load the downstream variant instead and automatically apply the "upstream" overlay to
make some adjustments. Note that this process happens after the os_prefix has been
�nalised.
GPIO Control
Edit this on GitHub
gpio
The gpio directive allows GPIO pins to be set to speci�c modes and values at boot time in
a way that would previously have needed a custom dt-blob.bin �le. Each line applies the
same settings (or at least makes the same changes) to a set of pins, either a single pin (3),
a range of pins (3-4), or a comma-separated list of either (3-4,6,8). The pin set is followed
by an = and one or more comma-separated attributes from this list:
• ip - Input
• op - Output
• a0-a5 - Alt0-Alt5
• pu - Pull up
• pd - Pull down
• pn/np - No pull
gpio settings are applied in order, so those appearing later override those appearing earlier.
Examples:
The gpio directive respects the "[…]" section headers in config.txt, so it is possible to use
different settings based on the model, serial number, and EDID.
GPIO changes made through this mechanism do not have any direct effect on the kernel
— they don’t cause GPIO pins to be exported to the sysfs interface, and they can be
overridden by pinctrl entries in the Device Tree as well as utilities like raspi-gpio.
Note also that there is a delay of a few seconds between power being applied and the
changes taking effect — longer if booting over the network or from a USB mass storage
device.
enable_jtag_gpio
Setting enable_jtag_gpio=1 selects Alt4 mode for GPIO pins 22-27, and sets up some
internal SoC connections, thus enabling the JTAG interface for the ARM CPU. It works on
all models of Raspberry Pi.
Pin # Function
GPIO22 ARM_TRST
GPIO23 ARM_RTCK
GPIO24 ARM_TDO
GPIO25 ARM_TCK
GPIO26 ARM_TDI
GPIO27 ARM_TMS
Overclocking Options
Edit this on GitHub
The kernel has a CPUFreq driver with the "powersave" governor enabled by default,
switched to "ondemand" during boot, when raspi-con�g is installed. With "ondemand"
governor, CPU frequency will vary with processor load. You can adjust the minimum values
with the *_min con�g options or disable dynamic clocking by applying a static scaling
governor ("powersave" or "performance") or with force_turbo=1.
Overclocking and overvoltage will be disabled at runtime when the SoC reaches
temp_limit (see below), which defaults to 85°C, in order to cool down the SoC. You should
not hit this limit with Raspberry Pi 1 and Raspberry Pi 2, but you are more likely to with
Raspberry Pi 3 and Raspberry Pi 4. Overclocking and overvoltage are also disabled when
an undervoltage situation is detected.
NOTE
For more information see the section on frequency management and thermal control.
WARNING
Setting any overclocking parameters to values other than those used by raspi-con�g
may set a permanent bit within the SoC, making it possible to detect that your
Raspberry Pi has been overclocked. The speci�c circumstances where the overclock
bit is set are if force_turbo is set to 1 and any of the over_voltage_* options are set to
a value > 0. See the blog post on Turbo Mode for more information.
Overclocking
Option Description
Option Description
core voltage, and specifying 8 will allow up to
1.55V (1.4V on Raspberry Pi 1). For defaults
see table below. Values above 6 are only
allowed when force_turbo=1 is speci�ed:
this sets the warranty bit if over_voltage_* >
0 is also set.
Option Description
This table gives the default values for the options on various Raspberry Pi models, all
frequencies are stated in MHz.
arm_freq 1000 700 900 1200 1400 1500 1500 or 1800 1000
1800 if
arm_boost=1
core_freq 400 250 250 400 400 500 500 500 400
h264_freq 300 250 250 400 400 500 500 500 300
isp_freq 300 250 250 400 400 500 500 500 300
v3d_freq 300 250 250 400 400 500 500 500 300
hevc_freq N/A N/A N/A N/A N/A 500 500 500 N/A
sdram_freq 450 400 450 450 500 3200 3200 3200 450
arm_freq_min 700 700 600 600 600 600 600 600 600
core_freq_min 250 250 250 250 250 200 200 200 250
gpu_freq_min 250 250 250 250 250 250 250 250 250
h264_freq_min 250 250 250 250 250 250 250 250 250
isp_freq_min 250 250 250 250 250 250 250 250 250
v3d_freq_min 250 250 250 250 250 250 250 250 250
sdram_freq_min 400 400 400 400 400 3200 3200 3200 400
This table gives defaults for options that are the same across all models.
Option Default
initial_turbo 0 (seconds)
temp_limit 85 (°C)
over_voltage_min 0 (1.2V)
over_voltage_sdram 0 (1.2V)
over_voltage_sdram_c 0 (1.2V)
over_voltage_sdram_i 0 (1.2V)
over_voltage_sdram_p 0 (1.2V)
The �rmware uses Adaptive Voltage Scaling (AVS) to determine the optimum CPU/GPU
core voltage in the range de�ned by over_voltage and over_voltage_min.
The minimum core frequency when the system is idle must be fast enough to support the
highest pixel clock (ignoring blanking) of the display(s). Consequently, core_freq will be
boosted above 500 MHz if the display mode is 4Kp60.
Default 500
hdmi_enable_4kp60 550
• The latest �rmware automatically scales up the voltage if the system is overclocked.
Manually setting over_voltage disables automatic voltage scaling for overclocking.
force_turbo
By default (force_turbo=0) the "On Demand" CPU frequency driver will raise clocks to their
maximum frequencies when the ARM cores are busy and will lower them to the minimum
frequencies when the ARM cores are idle.
force_turbo=1 overrides this behaviour and forces maximum frequencies even when the
ARM cores are not busy.
never_over_voltage
Sets a bit in the OTP memory (one time programmable) that prevents the device from
being overvoltaged. This is intended to lock the device down so the warranty bit cannot be
set either inadvertently or maliciously by using an invalid overvoltage.
disable_auto_turbo
On Raspberry Pi 2 / Raspberry Pi 3, setting this �ag will disable the GPU from moving into
turbo mode, which it can do in particular load cases.
Clocks Relationship
The GPU core, CPU, SDRAM and GPU each have their own PLLs and can have unrelated
frequencies. The h264, v3d and ISP blocks share a PLL.
To view the Raspberry Pi’s current frequency in KHz, type: cat /sys/devices/system
Whilst hitting the temperature limit is not harmful to the SoC, it will cause CPU throttling. A
heatsink can help to control the core temperature and therefore performance. This is
especially useful if the Raspberry Pi is running inside a case. Air�ow over the heatsink will
make cooling more e�cient.
With �rmware from 12th September 2016 or later, when the core temperature is between
80’C and 85’C, a warning icon showing a red half-�lled thermometer will be displayed, and
the ARM cores will be throttled back. If the temperature exceeds 85’C, an icon showing a
fully-�lled thermometer will be displayed, and both the ARM cores and the GPU will be
throttled back.
For the Raspberry Pi 3 Model B+, the PCB technology has been changed to provide better
heat dissipation and increased thermal mass. In addition, a soft temperature limit has
been introduced, with the goal of maximising the time for which a device can "sprint"
before reaching the hard limit at 85°C. When the soft limit is reached, the clock speed is
reduced from 1.4GHz to 1.2GHz, and the operating voltage is reduced slightly. This
reduces the rate of temperature increase: we trade a short period at 1.4GHz for a longer
period at 1.2GHz. By default, the soft limit is 60°C, and this can be changed via the
temp_soft_limit setting in con�g.txt.
Monitoring Voltage
It is essential to keep the supply voltage above 4.8V for reliable performance. Note that the
voltage from some USB chargers/power supplies can fall as low as 4.2V. This is because
they are usually designed to charge a 3.7V LiPo battery, not to supply 5V to a computer.
To monitor the Raspberry Pi’s PSU voltage, you will need to use a multimeter to measure
between the VCC and GND pins on the GPIO. More information is available in power.
If the voltage drops below 4.63V (+-5%), recent versions of the �rmware will show a yellow
lightning bolt symbol on the display to indicate a lack of power, and a message indicating
the low voltage state will be added to the kernel log.
Overclocking Problems
Most overclocking issues show up immediately with a failure to boot. If this occurs, hold
down the shift key during the next boot. This will temporarily disable all overclocking,
allowing you to boot successfully and then edit your settings.
Conditional Filters
Edit this on GitHub
When a single SD Card (or card image) is being used with one Raspberry Pi and one
monitor, it is easy to set config.txt as required for that speci�c combination and keep it
that way, amending it only when something changes.
However, if one Raspberry Pi is swapped between different monitors, or if the SD card (or
card image) is being swapped between multiple boards, a single set of settings may no
longer be su�cient. Conditional �lters allow you to de�ne certain sections of the con�g �le
to be used only in speci�c cases, allowing a single config.txt to create different
con�gurations when read by different hardware.
Model Filters
The conditional model �lters are applied according to the following table.
[pi400] Pi 400
[pi0w] Zero W
[pi02] Zero 2 W
These are particularly useful for de�ning different kernel, initramfs, and cmdline settings,
as the Raspberry Pi 1 and Raspberry Pi 2 require different kernels. They can also be useful
to de�ne different overclocking settings, as the Raspberry Pi 1 and Raspberry Pi 2 have
different default speeds. For example, to de�ne separate initramfs images for each:
[pi1]
initramfs initrd.img-3.18.7+ followkernel
[pi2]
initramfs initrd.img-3.18.7-v7+ followkernel
[all]
Remember to use the [all] �lter at the end, so that any subsequent settings aren’t limited
to Raspberry Pi 2 hardware only.
It is important to note that the Raspberry Pi Zero W will see the contents of [pi0w] AND
[pi0]. Likewise, a Raspberry Pi 3B+ sees [pi3+] AND [pi3], and a Raspberry Pi 400 sees
[pi400] AND [pi4]. If you want a setting to apply only to Raspberry Pi Zero, Raspberry Pi
3B or Raspberry Pi 4B, you need to follow it (order is important) with a setting in the
[pi0w], [pi3+] or [pi400] section that reverts it.
To view the EDID name of an attached monitor, run the following command:
tvservice -n
device_name=VSC-TD2220
You can then specify settings that apply only to this monitor:
[EDID=VSC-TD2220]
hdmi_group=2
hdmi_mode=82
[all]
This forces 1920x1080 DVT mode for the speci�ed monitor, without affecting any other
monitors.
Note that these settings apply only at boot, so the monitor must be connected at boot time
and the Raspberry Pi must be able to read its EDID information to �nd the correct name.
Hotplugging a different monitor into the Raspberry Pi after boot will not select different
settings.
On the Raspberry Pi 4, if both HDMI ports are in use, then the EDID will be checked against
both of them, and subsequent con�guration applied only to the �rst matching device. You
can determine the EDID names for both ports by �rst running tvservice -l in a terminal
window to list all attached devices and then using the returned numerical IDs in tvservice
-v <id> -n to �nd the EDID name for a speci�c display ID.
To view the serial number of your Raspberry Pi, run the following command:
cat /proc/cpuinfo
The serial will be shown as a 16-digit hex value at the bottom. For example, if you see:
Serial : 0000000012345678
then you can de�ne settings that will only be applied to this speci�c Raspberry Pi:
[0x12345678]
# settings here are applied only to the Raspberry Pi with this serial
[all]
# settings here are applied to all hardware
[gpio4=1]
[gpio2=0]
# Settings here are applied if GPIO 2 is low
[all]
# settings here are applied to all hardware
The Raspberry Pi 4 has two HDMI ports, and for many config.txt commands related to
HDMI, it is necessary to specify which HDMI port is being referred to. The HDMI
conditional �lters subsequent HDMI con�gurations to the speci�c port.
[HDMI:0]
hdmi_group=2
hdmi_mode=45
[HDMI:1]
hdmi_group=2
hdmi_mode=67
hdmi_group:0=2
hdmi_mode:0=45
hdmi_group:1=2
hdmi_mode:1=67
Filters of different types can be combined simply by listing them one after the other, for
example:
Use the [all] �lter to reset all previous �lters and avoid unintentionally combining different
�lter types.
Legacy Options
Edit this on GitHub
The remaining groups of config.txt options are considered legacy settings, either
because they relate to older software such as the �rmware graphics driver, or because
they have been deprecated or removed altogether.
Memory Options
Edit this on GitHub
gpu_mem
Speci�es how much memory, in megabytes, to reserve for the exclusive use of the GPU:
the remaining memory is allocated to the ARM CPU for use by the OS. For Raspberry Pis
with less than 1GB of memory, the default is 64; for Raspberry Pis with 1GB or more of
memory the default is 76.
IMPORTANT
Unlike GPUs found on x86 machines, where increasing memory can improve 3D
performance, the architecture of the VideoCore means there is no performance
advantage from specifying values larger than is necessary, and in fact it can harm
performance.
To ensure the best performance of Linux, you should set gpu_mem to the lowest possible
value. If a particular graphics feature is not working correctly, try increasing the value of
gpu_mem, being mindful of the recommended maximums shown below.
On the Raspberry Pi 4 the 3D component of the GPU has its own memory management
unit (MMU), and does not use memory from the gpu_mem allocation. Instead memory is
allocated dynamically within Linux. This allows a smaller value to be speci�ed for gpu_mem
On legacy kernels, the memory allocated to the GPU is used for display, 3D, Codec and
camera purposes as well as some basic �rmware housekeeping. The maximums speci�ed
below assume you are using all these features. If you are not, then smaller values of
gpu_mem should be used.
256MB 128
512MB 384
IMPORTANT
The default camera stack (libcamera2) on Raspberry Pi OS - Bullseye uses Linux CMA
memory to allocate buffers instead of GPU memory so there is no bene�t in increasing
the GPU memory size.
It is possible to set gpu_mem to larger values, however this should be avoided since it can
cause problems, such as preventing Linux from booting. The minimum value is 16,
however this disables certain GPU features.
You can also use gpu_mem_256, gpu_mem_512, and gpu_mem_1024 to allow swapping the
same SD card between Raspberry Pis with different amounts of RAM without having to
edit config.txt each time:
gpu_mem_256
The gpu_mem_256 command sets the GPU memory in megabytes for Raspberry Pis with
256MB of memory. (It is ignored if memory size is not 256MB). This overrides gpu_mem.
gpu_mem_512
The gpu_mem_512 command sets the GPU memory in megabytes for Raspberry Pis with
512MB of memory. (It is ignored if memory size is not 512MB). This overrides gpu_mem.
gpu_mem_1024
The gpu_mem_1024 command sets the GPU memory in megabytes for Raspberry Pis with
1GB or more of memory. (It is ignored if memory size is smaller than 1GB). This overrides
gpu_mem.
total_mem
This parameter can be used to force a Raspberry Pi to limit its memory capacity: specify
the total amount of RAM, in megabytes, you wish the Raspberry Pi to use. For example, to
make a 4GB Raspberry Pi 4B behave as though it were a 1GB model, use the following:
total_mem=1024
This value will be clamped between a minimum of 128MB, and a maximum of the total
memory installed on the board.
disable_l2cache
Setting this to 1 disables the CPU’s access to the GPU’s L2 cache and requires a
corresponding L2 disabled kernel. Default value on BCM2835 is 0. On BCM2836,
BCM2837, and BCM2711, the ARMs have their own L2 cache and therefore the default is 1.
The standard Raspberry Pi kernel.img and kernel7.img builds re�ect this difference in
cache setting.
Hardware decoding of additional codecs on the Raspberry Pi 3 and earlier models can be
enabled by purchasing a licence that is locked to the CPU serial number of your Raspberry
Pi.
On the Raspberry Pi 4, the hardware codecs for MPEG2 or VC1 are permanently disabled
and cannot be enabled even with a licence key; on the Raspberry Pi 4, thanks to its
increased processing power compared to earlier models, MPEG2 and VC1 can be decoded
in software via applications such as VLC. Therefore, a hardware codec licence key is not
needed if you’re using a Raspberry Pi 4.
decode_MPG2
decode_WVC1
decode_WVC1 is a licence key to allow hardware VC-1 decoding, e.g.
decode_WVC1=0x12345678.
If you have multiple Raspberry Pis and you’ve bought a codec licence for each of them, you
can list up to eight licence keys in a single config.txt, for example
decode_MPG2=0x12345678,0xabcdabcd,0x87654321. This enables you to swap the same SD
card between the different Raspberry Pis without having to edit config.txt each time.
Video Options
Edit this on GitHub
HDMI Mode
NOTE
Because the Raspberry Pi 4 and Raspberry Pi 400 have two HDMI ports, some HDMI
commands can be applied to either port. You can use the syntax <command>:<port>,
where port is 0 or 1, to specify which port the setting should apply to. If no port is
speci�ed, the default is 0. If you specify a port number on a command that does not
require a port number, the port is ignored. Further details on the syntax and alternatives
mechanisms can be found in the HDMI sub-section of the conditionals section of the
documentation.
In order to support dual 4k displays, the Raspberry Pi 4 has updated video hardware, which
imposes minor restrictions on the modes supported.
hdmi_safe
Setting hdmi_safe to 1 will lead to "safe mode" settings being used to try to boot with
maximum HDMI compatibility. This is the same as setting the following parameters:
hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
config_hdmi_boost=4
hdmi_group=2
hdmi_mode=4
disable_overscan=0
overscan_left=24
overscan_right=24
overscan_top=24
overscan_bottom=24
hdmi_ignore_edid
hdmi_edid_file
Setting hdmi_edid_file to 1 will cause the GPU to read EDID data from the edid.dat �le,
located in the boot partition, instead of reading it from the monitor. More information is
available on the forums.
hdmi_edid_filename
On the Raspberry Pi 4B, you can use the hdmi_edid_filename command to specify the
�lename of the EDID �le to use, and also to specify which port the �le is to be applied to.
This also requires hdmi_edid_file=1 to enable EDID �les.
For example:
hdmi_edid_file=1
hdmi_edid_filename:0=FileForPortZero.edid
hdmi_edid_filename:1=FileForPortOne.edid
hdmi_force_edid_audio
Setting hdmi_force_edid_audio to 1 pretends that all audio formats are supported by the
display, allowing passthrough of DTS/AC3 even when this is not reported as supported.
hdmi_ignore_edid_audio
hdmi_force_edid_3d
Setting hdmi_force_edid_3d to 1 pretends that all CEA modes support 3D, even when the
EDID does not indicate support for this.
hdmi_ignore_cec_init
Setting hdmi_ignore_cec_init to 1 will stop the initial active source message being sent
during bootup. This prevents a CEC-enabled TV from coming out of standby and channel-
switching when you are rebooting your Raspberry Pi.
hdmi_ignore_cec
Setting hdmi_ignore_cec to 1 pretends that CEC is not supported at all by the TV. No CEC
functions will be supported.
cec_osd_name
The cec_osd_name command sets the initial CEC name of the device. The default is
Raspberry Pi.
hdmi_pixel_encoding
The hdmi_pixel_encoding command forces the pixel encoding mode. By default, it will use
the mode requested from the EDID, so you shouldn’t need to change it.
hdmi_pixel_encoding result
hdmi_max_pixel_freq
The pixel frequency is used by the �rmware and KMS to �lter HDMI modes. Note, this is
not the same as the frame rate. It speci�es the maximum frequency that a valid mode can
have, thereby culling out higher frequency modes. So for example, if you wish to disable all
4K modes, you could specify a maximum frequency of 200000000, since all 4K modes
have frequencies greater than this.
hdmi_blanking
The hdmi_blanking command controls what happens when the operating system asks for
the display to be put into standby mode, using DPMS, to save power. If this option is not
set or set to 0, the HDMI output is blanked but not switched off. In order to mimic the
behaviour of other computers, you can set the HDMI output to switch off as well by setting
this option to 1: the attached display will go into a low power standby mode.
NOTE
On the Raspberry Pi 4, setting hdmi_blanking=1 will not cause the HDMI output to be
switched off, since this feature has not yet been implemented. This feature may cause
issues when using applications which don’t use the framebuffer, such as omxplayer.
hdmi_blanking result
hdmi_drive
The hdmi_drive command allows you to choose between HDMI and DVI output modes.
hdmi_drive result
config_hdmi_boost
Con�gures the signal strength of the HDMI interface. The minimum value is 0 and the
maximum is 11.
The default value for the original Model B and A is 2. The default value for the Model B+
and all later models is 5.
If you are seeing HDMI issues (speckling, interference) then try 7. Very long HDMI cables
may need up to 11, but values this high should not be used unless absolutely necessary.
hdmi_group
The hdmi_group command de�nes the HDMI output group to be either CEA (Consumer
Electronics Association, the standard typically used by TVs) or DMT (Display Monitor
Timings, the standard typically used by monitors). This setting should be used in
conjunction with hdmi_mode.
hdmi_group result
1 CEA
2 DMT
hdmi_mode
Together with hdmi_group, hdmi_mode de�nes the HDMI output format. Format mode
numbers are derived from the CTA speci�cation.
To set a custom display mode not listed here, see more information on the forums.
NOTE
65 Custom
Pixel doubling and quadrupling indicates a higher clock rate, with each pixel repeated two
or four times respectively.
1 640x350 85Hz
3 720x400 85Hz
NOTE
There is a pixel clock limit. The highest supported mode on models prior to the
Raspberry Pi 4 is 1920x1200 at 60Hz with reduced blanking, whilst the Raspberry Pi 4
can support up to 4096x2160 (known as 4k) at 60Hz. Also note that if you are using
both HDMI ports of the Raspberry Pi 4 for 4k output, then you are limited to 30Hz on
both.
hdmi_timings
This allows setting of raw HDMI timing values for a custom mode, selected using
hdmi_group=2 and hdmi_mode=87.
* The aspect ratio can be set to one of eight values (choose the closest for your screen):
HDMI_ASPECT_4_3 = 1
HDMI_ASPECT_14_9 = 2
HDMI_ASPECT_16_9 = 3
HDMI_ASPECT_5_4 = 4
HDMI_ASPECT_16_10 = 5
HDMI_ASPECT_15_9 = 6
HDMI_ASPECT_21_9 = 7
HDMI_ASPECT_64_27 = 8
hdmi_force_mode
Setting to 1 will remove all other modes except the ones speci�ed by hdmi_mode and
hdmi_group from the internal list, meaning they will not appear in any enumerated lists of
modes. This option may help if a display seems to be ignoring the hdmi_mode and
hdmi_group settings.
edid_content_type
1. Set the output format to VGA 60Hz (hdmi_group=1 and hdmi_mode=1) and boot up
your Raspberry Pi
5. Enter the following commands to dump more detailed information from your
monitor: /opt/vc/bin/tvservice -d edid.dat; /opt/vc/bin/edidparser edid.dat
The edid.dat should also be provided when troubleshooting problems with the default
HDMI mode.
Custom Mode
If your monitor requires a mode that is not in one of the tables above, then it’s possible to
de�ne a custom CVT mode for it instead:
rb 0 0=normal, 1=reduced
blanking
Note that this simply creates the mode (group 2 mode 87). In order to make the Raspberry
Pi use this by default, you must add some additional settings. For example, the following
selects an 800 × 480 resolution and enables audio drive:
hdmi_cvt=800 480 60 6
hdmi_group=2
hdmi_mode=87
hdmi_drive=2
This may not work if your monitor does not support standard CVT timings.
NOTE
sdtv_mode
The sdtv_mode command de�nes the TV standard used for composite video output:
sdtv_mode result
2 Normal PAL
sdtv_aspect
The sdtv_aspect command de�nes the aspect ratio for composite video output. The
default value is 1.
sdtv_aspect result
1 4:3
2 14:9
3 16:9
sdtv_disable_colourburst
enable_tvout
On all models except Raspberry Pi 4 and Raspberry Pi 400, composite output will be
enabled if HDMI output is disabled. HDMI output is disabled when no HDMI display is
detected, or hdmi_ignore_hotplug=1 is set. Set enable_tvout=0 to prevent composite being
enabled when HDMI is disabled.
Model Default
Pi 4 and 400 0
ignore_lcd
By default the Raspberry Pi Touch Display is used when it is detected on the I2C bus.
ignore_lcd=1 will skip this detection phase, and therefore the LCD display will not be used.
display_default_lcd
If a Raspberry Pi Touch Display is detected it will be used as the default display and will
show the framebuffer. Setting display_default_lcd=0 will ensure the LCD is not the
default display, which usually implies the HDMI output will be the default. The LCD can still
be used by choosing its display number from supported applications, for example,
omxplayer.
lcd_framerate
Specify the framerate of the Raspberry Pi Touch Display, in Hertz/fps. Defaults to 60Hz.
lcd_rotate
This �ips the display using the LCD’s inbuilt �ip functionality, which is a cheaper operation
that using the GPU-based rotate operation.
disable_touchscreen
enable_dpi_lcd
Enable LCD displays attached to the DPI GPIOs. This is to allow the use of third-party LCD
displays using the parallel display interface.
The dpi_group and dpi_mode config.txt parameters are used to set either predetermined
modes (DMT or CEA modes as used by HDMI above). A user can generate custom modes
in much the same way as for HDMI (see dpi_timings section).
dpi_timings
This allows setting of raw DPI timing values for a custom mode, selected using
dpi_group=2 and dpi_mode=87.
* The aspect ratio can be set to one of eight values (choose the closest for your screen):
HDMI_ASPECT_4_3 = 1
HDMI_ASPECT_14_9 = 2
HDMI_ASPECT_16_9 = 3
HDMI_ASPECT_5_4 = 4
HDMI_ASPECT_16_10 = 5
HDMI_ASPECT_15_9 = 6
HDMI_ASPECT_21_9 = 7
HDMI_ASPECT_64_27 = 8
hdmi_force_hotplug
hdmi_ignore_hotplug
Setting hdmi_ignore_hotplug to 1 pretends that the HDMI hotplug signal is not asserted,
so it appears that a HDMI display is not attached. HDMI output will therefore be disabled,
even if a monitor is connected.
overscan_left
The overscan_left command speci�es the number of pixels to add to the �rmware default
value of overscan on the left edge of the screen. The default value is 0.
Increase this value if the text �ows off the left edge of the screen; decrease it if there is a
black border between the left edge of the screen and the text.
overscan_right
The overscan_right command speci�es the number of pixels to add to the �rmware
default value of overscan on the right edge of the screen. The default value is 0.
Increase this value if the text �ows off the right edge of the screen; decrease it if there is a
black border between the right edge of the screen and the text.
overscan_top
The overscan_top command speci�es the number of pixels to add to the �rmware default
value of overscan on the top edge of the screen. The default value is 0.
Increase this value if the text �ows off the top edge of the screen; decrease it if there is a
black border between the top edge of the screen and the text.
overscan_bottom
The overscan_bottom command speci�es the number of pixels to add to the �rmware
default value of overscan on the bottom edge of the screen. The default value is 0.
Increase this value if the text �ows off the bottom edge of the screen; decrease it if there is
a black border between the bottom edge of the screen and the text.
overscan_scale
NOTE: this feature is generally not recommended: it can reduce image quality because all
layers on the display will be scaled by the GPU. Disabling overscan on the display itself is
the recommended option to avoid images being scaled twice (by the GPU and the display).
framebuffer_width
The framebuffer_width command speci�es the console framebuffer width in pixels. The
default is the display width minus the total horizontal overscan.
framebuffer_height
The framebuffer_height command speci�es the console framebuffer height in pixels. The
default is the display height minus the total vertical overscan.
max_framebuffer_height, max_framebuffer_width
Speci�es the maximum dimensions that the internal frame buffer is allowed to be.
framebuffer_depth
Use framebuffer_depth to specify the console framebuffer depth in bits per pixel. The
default value is 16.
16 16-bit framebuffer
framebuffer_ignore_alpha
Set framebuffer_ignore_alpha to 1 to disable the alpha channel. Can help with the display
of a 32-bit framebuffer_depth.
framebuffer_priority
In a system with multiple displays, using the legacy (pre-KMS) graphics driver, this forces a
speci�c internal display device to be the �rst Linux framebuffer (i.e. /dev/fb0).
Display ID
Main LCD 0
Secondary LCD 1
HDMI 0 2
Composite 3
HDMI 1 7
max_framebuffers
This con�guration entry sets the maximum number of �rmware framebuffers that can be
created. Valid options are 0, 1, and 2. By default on devices before the Raspberry Pi 4 this
is set to 1, so will need to be increased to 2 when using more than one display, for example
HDMI and a DSI or DPI display. The Raspberry Pi 4 con�guration sets this to 2 by default
Generally in most cases it is safe to set this to 2, as framebuffers will only be created when
an attached device is actually detected.
Setting this value to 0 can be used to reduce memory requirements when used in headless
mode as it will prevent any framebuffers from being allocated.
test_mode
The test_mode command displays a test image and sound during boot (over the
composite video and analogue audio outputs only) for the given number of seconds,
before continuing to boot the OS as normal. This is used as a manufacturing test; the
default value is 0.
display_hdmi_rotate
Use display_hdmi_rotate to rotate or �ip the HDMI display orientation. The default value is
0.
display_hdmi_rotate result
0 no rotation
Note that the 90 and 270 degree rotation options require additional memory on the GPU,
so these will not work with the 16MB GPU split.
If using the VC4 FKMS V3D driver (this is the default on the Raspberry Pi 4), then 90 and
270 degree rotations are not supported. The Screen Con�guration utility provides display
rotations for this driver.
display_lcd_rotate
For the legacy graphics driver (default on models prior to the Raspberry Pi 4), use
display_lcd_rotate to rotate or �ip the LCD orientation. Parameters are the same as
display_hdmi_rotate. See also lcd_rotate.
display_rotate
display_rotate is deprecated in the latest �rmware but has been retained for backwards
compatibility. Please use display_lcd_rotate and display_hdmi_rotate instead.
Use display_rotate to rotate or �ip the screen orientation. Parameters are the same as
display_hdmi_rotate.
disable_fw_kms_setup
By default, the �rmware parses the EDID of any HDMI attached display, picks an
appropriate video mode, then passes the resolution and frame rate of the mode, along with
overscan parameters, to the Linux kernel via settings on the kernel command line. In rare
circumstances, this can have the effect of choosing a mode that is not in the EDID, and
may be incompatible with the device. You can use disable_fw_kms_setup=1 to disable the
passing of these parameters and avoid this problem. The Linux video mode system (KMS)
will then parse the EDID itself and pick an appropriate mode.
Other Options
dispmanx_offline
Forces dispmanx composition to be done o�ine in two offscreen framebuffers. This can
allow more dispmanx elements to be composited, but is slower and may limit screen
framerate to typically 30fps.
IMPORTANT
When using the VC4 KMS graphics driver, the complete display pipeline is managed by
Linux - this includes the HDMI outputs. These settings only apply to the legacy FKMS
and �rmware-based graphics driver.
In order to support dual displays, and modes up to 4k60, the Raspberry Pi 4 has updated
the HDMI composition pipeline hardware in a number of ways. One of the major changes
is that it generates 2 output pixels for every clock cycle.
Every HDMI mode has a list of timings that control all the parameters around sync pulse
durations. These are typically de�ned via a pixel clock, and then a number of active pixels,
a front porch, sync pulse, and back porch for each of the horizontal and vertical directions.
Running everything at 2 pixels per clock means that the Raspberry Pi 4 can not support a
timing where any of the horizontal timings are not divisible by 2. The �rmware and Linux
kernel will �lter out any mode that does not ful�ll this criteria.
There is only one mode in the CEA and DMT standards that falls into this category - DMT
mode 81, which is 1366x768 @ 60Hz. This mode has odd values for the horizontal sync
and back porch timings. It’s also an unusual mode for having a width that isn’t divisible by
8.
If your monitor is of this resolution, then the Raspberry Pi 4 will automatically drop down to
the next mode that is advertised by the monitor; this is typically 1280x720.
On some monitors it is possible to con�gure them to use 1360x768 @ 60Hz. They typically
do not advertise this mode via their EDID so the selection can’t be made automatically, but
it can be manually chosen by adding
hdmi_group=2
hdmi_mode=87
hdmi_cvt=1360 768 60
to con�g.txt.
Timings speci�ed manually via a hdmi_timings= line in config.txt will also need to comply
with the restriction of all horizontal timing parameters being divisible by 2.
dpi_timings= are not restricted in the same way as that pipeline still only runs at a single
pixel per clock cycle.
Raspberry Pi documentation is copyright © 2012-2023 Raspberry Pi Ltd and is licensed under a Creative Commons
Camera Settings
Attribution-ShareAlike 4.0 International (CC BY-SA) licence.
Some content originates from the eLinux wiki, and is licensed under a Creative Commons Attribution-ShareAlike 3.0
Edit this on GitHub
Unported licence.
disable_camera_led
Setting disable_camera_led to 1 prevents the red camera LED from turning on when
recording video or taking a still picture. This is useful for preventing re�ections when the
camera is facing a window, for example.
awb_auto_is_greyworld
Miscellaneous Options
Edit this on GitHub
avoid_warnings
The warning symbols can be disabled using this option, although this is not
advised.
logging_level
Sets the VideoCore logging level. The value is a VideoCore-speci�c bitmask.
max_usb_current
WARNING