Overclocking Raspberry Pi4 on Ubuntu 20.10

This guide shows you the basics of configuring overclocking of the Raspberry Pi4 on Ubuntu Server 20.10.

Table of Contents

    Background

    Warning: Setting any overclocking parameters to values other than those used by raspi-config may set a permanent bit within the SoC, making it possible to detect that your Pi has been overclocked.

    The standard CPU max frequency is 1500 MHz. Based on various test results that I have read it appears that the Raspberry Pi4 will be fairly stable up to 1950 MHz. Above this frequency you likely will experience failures. For my use I am going to be a bit safer and just set a max frequency of 1850 MHz.
    NOTE: When overclocking you should absolutely have a good cooling system(heatsinks/fan) and a good quality 3.5A power supply.

    Configure Clockrate

    1. open configuration file
      sudo nano /boot/firmware/config.txt
    2. add the following lines at the end of the file.
      #overclocking
      over_voltage=4
      arm_freq=1850
    3. reboot

    Install userland vcgencmd tools.

    We need this utility for some of the measurement scripts we are going to run.

    1. install vcgencmd
      sudo apt install libraspberrypi-bin
    2. add user to video group. If you don’t do this you will get “VCHI initialization failed” error. Replace username below with the current user.
      sudo usermod -aG video username
    3. reboot

    CPU Monitor Script #1

    This script will continually display the CPU temperature and clockrate.
    https://gist.github.com/PhillipJacobsen/b829bdcd8f345431479ac2aa1f0de8da

    1. download script
      wget https://gist.githubusercontent.com/PhillipJacobsen/b829bdcd8f345431479ac2aa1f0de8da/raw/e2046285bac6d4b0f95cd65b093d3d17755c479a/cpumonitor.sh
    2. Make script executable
      chmod +x cpumonitor.sh
    3. run script
      ./cpumonitor.sh

    CPU Monitor Script #2

    https://gist.github.com/TheRemote/10bda1ac790f959210db5789f5241436

    1. download script
      wget https://gist.githubusercontent.com/TheRemote/10bda1ac790f959210db5789f5241436/raw/179f57bee535eadcf1d56e28d587e5d9fc3460bb/measurepi.sh
    2. Make script executable
      chmod +x measurepi.sh
    3. run script
      ./measurepi.sh

    Simple CPU Speed Monitor

    This will print the current CPU speed every 1 second.
    watch -n 1 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

    Read the max CPU setting you configured in config.txt

    vcgencmd get_config arm_freq

    Get the current CPU frequency along with the minimum and maximum frequencies.

    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

    References

    https://qengineering.eu/overclocking-the-raspberry-pi-4.html

    https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md

    https://www.seeedstudio.com/blog/2020/02/12/how-to-safely-overclock-your-raspberry-pi-4-to-2-147ghz/