Overclocking the Raspberry Pi 4 - Q-engineering
Q-engineering
Q-engineering
Go to content
images/empty-GT_imagea-1-.png
Overclocking the Raspberry Pi 4

Safe overclocking of the Raspberry Pi 4 to 2 GHz

Introduction.

In this tutorial save overclocking of the Raspberry Pi 4 will be discussed.
The first part offers a simple electronic background so that you get a good idea of what is actually happening and what precautions you need to take. After a few important preparations, we end with the practical instructions.
Theory.
The BCM2711 chip on the Raspberry Pi 4 consists of millions of transistors, they are the digital building bricks. Most elements have two complementary transistors at the output. If transistor A is 'on' the output is drawn to the supply voltage Vcc, giving the output a status '1'. On the other hand, if transistor B is 'on', A is 'off', the output is pulled to Vdd, and a '0' appears at the output.

MOSFET spikes

Although the switching happens very fast, there is a moment when both transistors conduct some current. These small peaks have the frequency of the clock used. As the clock speed increases, the number of peaks follows proportionally and with for that matter the amount of heat.
In addition to the current peaks through the output transistors, there is another point that needs our attention. That is the transistor itself. All modern transistors are MOSFET (metal-oxide-semiconductor field-effect transistor).
Overclocking MOSFET
When a positive voltage is applied to the gate, negatively charged electrons inside the body are drawn just under the gate insulator, thereby forming a conductive tunnel between the source and the drain. The state is 'on'. Removing the voltage on the gate and the MOSFET switches off again. The insulator between the gate and the body ensures that almost no current is needed to control the transistor. That explains why, for instance, pocket calculators can work years on a single battery.
Overvoltage.
To switch on, a positive electrical charge is routed to the gate through the previous MOSFET A output. The same applies to switch off when this charge is to be drained by MOSFET B. This sourcing and the draining of electrical charge generates a small current peak. It is clear that the faster the clock runs, the more energy is transferred and then the more heat the chip will generate.
The MOSFET transistor starts to conduct when an electrical charge is injected into the gate. This process takes a while and is called the rising time in electronics. During this rising the output is neither '0' or '1', the state is undefined. The same situation occurs during the falling time when the MOSFET turns off. Again, there is a short interval in which the output is undefined. In the graph shown above, it's the yellow band. Note also that one output drives many inputs, all wanting their charge as quickly as possible.
When the rise plus fall time is larger than the clock intervals, the output never hits the stable 1 or 0 bands but remains swinging in the undefined region. That's the moment your Raspberry Pi becomes unstable. It is no longer able to run programs flawless and chances are that it will crash.
Now overvoltage comes into play. When the power supply is increased, there is more energy available for charging and draining gates. Subsequently, the rise and fall times decrease. Although the increase in power also increases the undefined area proportionally, the overall result is nevertheless faster. The second graph above illustrates this behaviour. Mostly, overclocking goes hand in hand with overvoltage.

MOSFET gate thickness

When you start increasing the power supply of the CPU ARM cores, precautions are needed. The great bottleneck is the insulator of the MOSFET, an extremely thin layer of metal-oxide. In modern 28 nm chips, such as the BCM2711 of the Raspberry Pi 4, the layer is only a few dozen atoms thick. Such a thin layer can not withstand large potential differentials. The tension inside the material becomes too large. The layer will breakdown, a current will flood from the gate to the body and destroying your transistor forever along with your Rpi. Overvoltage up to 6 is safe, above that number, you have your own adventure without any warranty.
Heat.
Either way, heat remains your worst enemy. As explained, by increasing both the supply voltage and the clock frequency, your Raspberry Pi generates considerably more heat than normal. Active cooling of the BCM2711 is now imperative. Some sample graphs are shown at the bottom of this page. For those interested, the following formula applies to heat development:

  
P = Power, Cdyn = dynamic capacitance, V = voltage, f = frequency. Dynamic capacitance is created by the insulation layer of the MOSFET.

Heat not only increases the chance of destroying the insulator of the transistor, but it also shortens the life span of the Raspberry Pi. Rule of the thumb, every 10°C will half the lifetime of the CPU. When your Raspberry Pi has a lifespan of 20 years continuous running at 25 °C, it will run only 4 months at 85 °C. Six decades (85-25) gives 240 * 0.5 * 0.5 * 0.5 * 0.5 * 0.5 * 0.5 = ± 4 month. The formula used is the Arrhenius equation:
Arrthenius formula
Af = acceleration factor,
Ea = activation energy in electron-volts (eV), 0.622V for the BCM2711 CPU
k = Boltzmann's constant (8.617 x 10-5),
Tu = reference junction temperature, in °K (°K=°C+273),
Tt = junction temperature during overclocking, in °K,
e=2.71828 (base of natural logarithms)
Dynamic clock frequency.
This may come as a surprise, but the Raspberry Pi is constantly changing its clock frequency. When the processor has little to nothing to do, it drops its frequency as low as 600 MHz. On the other hand, if heavy calculations are required, it boosts the clock to its full speed at 1500 MHz. The same applies to the core voltage. When idle, the Raspberry lowers the voltage to 0.81 V. If the clock is running at high frequencies, it will increase the core voltage to a maximum of 0.8625 V. This mechanism guarantees the lowest power consumption. The heat generation is now also minimized. All modern cell phones use this same technique by the way. Besides the calculation burden, there are other factors like the temperature or low power voltage who influences the clock frequency. All these mechanisms protect the CPU against potentially harmful situations. The dynamically switching of clock frequency can be turned off by the line force_turbo=1 in the /boot/config.txt file. The Raspberry Pi will now run at maximum speed (turbo) no matter what the conditions are. We strongly advise you not to set this flag. This will not only violate the warranty, but it also has never given us any benefit.
Throttle.
There is one exception on the dynamic clock switching that can not be turned off. That is the so-called throttling. The Raspberry Pi monitor the temperature continuously. Above 82 ° C (180 ° F), the clock frequency is automatically lowered, regardless of which flag is set. This action will reduce heat development. Once cooled down, the clock is restored to its original frequency. During throttling, an icon is shown on your display.
Temp
In a normal situation, it may be sufficient to rely on the throttling to prevent overheating of the chip. However, this is not wise in the case of overclocking. Due to the overvoltage, stress on the insulators inside the transistors is already above normal, heat will only enlarge it even more. The upper-temperature limit must, therefore, decrease depending on your overvoltage. The recommended temperatures are shown in the table. Prolonged exposure of your Raspberry above these limits can be harmful.

Preparations.

First of all, you need an emergency door so that you can undo the overclocking if something goes wrong. If Raspbian is installed by NOOBS (New Out Of Box Software) you have the option to hold down the Shift key during startup. You are lead to the original installation screen where you can modify config.txt, the file used for overclocking. If you do not have NOOBS, you should back up your SD card before you start overclocking. With a program like Win32 Disk Imager it is a piece of cake.

Recover Raspbian

As mentioned earlier, you must control the heat generated. That's why you have to monitor it. We like to use two applets on the status panel, the CPU Usage Monitor and the CPU Temperature Monitor. You know exactly how healthy your system is at a glance.


EEPROM.
Another preparation is the installation of the latest EEPROM firmware (electrically erasable programmable read-only memory). The Raspberry Pi 3 had all the operating software on the SD card. The Raspberry Pi 4, on the other hand, is also partially booted from two EEPROM. These EEPROMs are programmed after PCB assembly in the factory.  Updating the firmware in both EEPROMs, with improvements made recently by the Raspberry team, will not immediately increase the clock speed, but will decrease the heat due to reduced power consumption. The update involves the installation of the rpi-eeprom loader. The new EEPROM software is of course not mandatory. More information about the installation can be found here. And this is a good article testing the heat production of various firmware versions.  
$ sudo apt-get update
$ sudo apt-get full-upgrade
$ sudo apt-get install rpi-eeprom
# to get the current status
$ sudo rpi-eeprom-update
# to update the firmware
$ sudo rpi-eeprom-update -a
$ reboot
EEPROM firmware
Beta version software.
In your regular Raspbian operating software, overclocking is limited to 1850 MHz. Above this frequency, the PLL's don't lock any more and the clock become unstable.
The highest stable frequency during our experiments was 1950 MHz. To reach this speed, you have to install the latest Raspbian beta firmware, as the limits have been removed in this version. Please note, there may be minor problems with this version, as it is still in the testing phase and has not yet been released. If you are satisfied with 1850 MHz, still an increase of 23% speed, leave your Raspbian as it is. On the other hand, if you want to get the maximum and you have active cooling on your Raspberry Pi, you can take the risk and install the latest version with the following commands.
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo rpi-update

Practice.

The actual overclocking is surprisingly simple. Two lines of text, over_voltage = x and arm_freq = xxxx, in the /boot/config.txt will do. The table below, some frequencies are given with the corresponding overvoltage. Up to 2140 MHz, the Raspberry Pi 4 still works, but it can crash when all four cores are used simultaneous during demanding tasks.
We also observe no improvements with overvoltage stage 7 or 8. Our advice: don't use them. It can only wear out your Raspberry Pi in the long run, even with proper cooling.
GPU overclocking.
Not only the CPU but also the GPU can be overclocked. One extra line of text, gpu_freq = xxx, in the /boot/config.txt will do. The GPU frequency may increase from standard 500 MHz to a maximum of 650 MHz. Overclocking the GPU needs also overvoltage and, of course, generates additional heat. Because we mostly use the CPU with its NEON-ARM instructions, we don't overclock the GPU. In our case, it would only need more cooling.
SDRAM overclocking.
In the previous Raspberry Pi 3, it was also possible to overclock the SDRAM. Increasing both sdram_freq and over_voltage_sdram gave you a faster data transfer rate from ram to CPU. However, overclocking the SDRAM on the Raspberry Pi 4 is not possible. Luckily the design team used the newest DDR4 memory with a clock of 3200 MHz, giving you a 52x faster transfer rate compared to the RPi 3. Overclocking this type of memory now only results in a negligible increase in performance.
Clock
(MHz)
Overvoltage
Vcore
Max temp.
(°C | °F)
Power
(Watt)
Preformance
increase
Remarks
1500
0
0.8625
82 | 180
7

Factory settings
1600
1
0.8875
80 | 1767.6
6.6 %

170020.912578 | 1728.313.3 %
180030.937577 | 1708.920 %
190040.962575 | 1679.526.6 %
Beta-level firmware
200061.012572 | 1621133.3 %Beta-level firmware
210061.012572 | 1621140 %
Beta-level firmware

71.037556 | 13211.7
no improvement

81.062550 | 12212.3
no improvement
Open the Nano text editor with the following command and place your lines at the end of the file. Close the session with the <Ctrl+X> key combination. With <Y> and <Enter> changes are being saved. Now reboot and your Raspberry Pi 4 runs at the new speed. Please note, the figures given are only examples. You can adjust them to your own good.
$ sudo nano /boot/config.txt
# Add your lines at the end.
over_voltage = x
arm_freq = y
gpu_freq = z
# Ctrl+X, Y, Enter to save the session
# Reboot to run at the new clock frequency
$ reboot
images/Nano.png
As mentioned earlier, keep an eye on your temperature when your Raspberry is running at high speed. Below are some graphs with different cooling options. We like to use this 'sandwich' heat sink because it also protects your electronics on the back against short circuits or other damage.
Raspberry Pi 4 plus fan

Raspberry Pi 4 passive cooling

Raspberry Pi 4 no cooling

When the Raspberry Pi gets too hot, it starts to throttle. Here is an example of this phenomenon. Running a deep learning model is an intensive task. All four cores are used here, each up to 86%. The temperature hits 82 °C (180 °F) and the frequency is lowered, as can be seen from the yellow color in the temperature monitor. Needless to say that this situation should not last too long.
images/Throttled.jpg

Final remarks.

There is a very powerfull tool which can be used when working with the Raspberry Pi hardware: vcgencmd (VideoCore General Command).
We use it all the time. A few examples. More info can be found here.
# to monitor your actual clock in a seperate terminal
$ watch -n1 vcgencmd measure_clock arm
# to monitor your actual Vcore in a seperate terminal
$ watch -n1 vcgencmd measure_volts core
# to get lots of information about the current status
$ vcgencmd get_config int
Raspberry and alt
Info
Raspberry Pi 4
Back to content