Overclocking the Raspberry Pi 3 – Free Speed and Trade-offs
The Raspberry Pi 3, in common with the the older Pi 1 and Pi 2 models, can be overclocked – that is, the main processor, graphics chip, and memory, can be run faster than the default factory settings. Whilst more speed equals more processing power, there’s a trade-off to be considered with the new hardware that generally wasn’t an issue on the earlier systems.
Please Note: at time of writing overclocking the Pi 3 does not appear to be officially sanctioned. This is noted in a post on Gordons Projects, and can be seen in the overclocking entry in the Raspbian O/S’s raspi-config tool, which states ‘This Pi cannot be overclocked’. I do not know whether implementing any overclock options on the Pi 3 will set any internal flags and affect your warranty (early generation Pi’s do so if the Governor is bypassed). If in doubt, wait until the Raspberry Pi foundation makes a statement on the subject.
Nevertheless, the new Pi can certainly be overclocked. Whilst the process by which this is achieved remains the fundamentally the same, editing the config.txt file, overclocking is not quite as straightforward as it previously has been. The issue is one of thermodynamics, as the new model runs somewhat hotter than the those of the previous generations, at least in the case of the Pi which I took delivery of the day after the new model was released*
* The presence of high CPU temperatures on the new machine could be limited to a certain batch, or an example of the variations in CPU tolerances such as those resulting from lithographic techniques used to create the processors.
Introducing the Overclocking Stability Test Script
The Stability Test Script is a program from elinux.org, described on that site as:
…a script to stress-test the stability of the system, specifically the SD card. If this script runs to completion, without any errors showing in dmesg, then the Raspberry Pi is probably stable with these settings
Why Stability Test the Pi’s SD Storage?
As noted in Part One of this series, in the early days (and years) of the Pi’s existence there were apparently widespread issues whereby overclocked machines experienced corrupted SD card data. The official, definitive, information on this issue comes from elinux.org: SD Card Usage with Overclocking
Stability of SD card operations when using overclocking is independent of:
Filesystem type, ext4, NTFS or other.
SD card vendor.
The Raspberry Pi model.
SD card size – verified for 16 GB and up.
What does matter is when you under-power your Raspberry Pi (that is, less than the Raspberry Pi base setup specifications!).
There initially was an increased likelihood of SD card corruption when using overclocking. This is no longer an issue (with firmware from Nov 11 2013 or later).
The Memtester software package can be installed easily using the command line / shell via the Raspbian OS’s APT Package Management Tool.
The APT maintains a repository of available packages, and their dependencies (other packages which a given package requires). Before installing a new package it is good practice to first update the repository list to ensure that you obtain the latest version of whichever package you wish to install, and to avoid dependency issues.
To update the APT repository, at the command shell, type:
sudo apt-get update
To install the Memtester package, type:
sudo apt-get install memtester
Running the Memtester Script on a Single CPU Core
TO Run Memtester on a single core, at the command line specify the memtester program, along with two parameters:
1. The amount of memory to test, followed by a lowercase ‘m’ – do not leave a space between the two. The program will attempt to lock the required amount of RAM, but will use the nearest available amount if this is not possible.
Checking that the system is reliable after applying overclocking
Following on from Part 1 of this post on Overclocking, we turn our attention to stability testing the system; this process is crucial, as simply witnessing the Pi boot to the command shell, or a Graphical User Interface (GUI) isn’t proof that a given combination of overclock settings is stable.
Sometimes an instability will only become apparent after several hours of intensive activity on the system (which is highly likely if using the system for gaming with an installation such as RetroPie).
There are three tools / scripts which I have used in the stability testing processes. For each I will provide instructions on obtaining and installing (or running, as appropriate):
– Python script to search for prime numbers, which heavily loads the CPU
– User selectable numeric range to test
– User selectable number of cores to run upon simultaneously.
– Tests the stability of the RAM
– Natively runs on a single CPU core, but can be run on all cores using multiple remote SSH sessions, or the Screen tool
Stability Test Script
– Reads the entire SD card 10x. Tests RAM and I/O
– Writes 512 MB test file, 10x.
– Script can be easily updated to change the number of reads/writes etc.
This post covers the use of mprime. Subsequent posts covers the use of Memtester and the Stability Test Script. Please use the links in the above list to access the relevant information.
When using the Raspberry Pi 2 to run any sort of intensive software, which certainly includes emulating classic video games systems using RetroPie, you really need all the processing and graphical horsepower you can get. Luckily there’s more available under the bonnet of the Pi with a little tweaking.
Overclocking the Pi is supported by tools provided with standard operating system distributions, such as Raspbian, and sanctioned by the manufacturer (with some caveats, as discusssed below). That said, the following details only my own research and experiences with a single Raspberry Pi 2 device; as always, your mileage may vary.
Assistance for those new to Linux
Making changes to the Overclock settings on the Pi, and testing the changes for stability, requires a little knowledge of the Linux command shell.
Please see my related posts for a basic guide which should help those new to Linux and/or Raspbian get started:
When overclocking it is worth ensuring that your Pi is serviced by a good quality Power Supply Unit (PSU), as this is often a point of failure. Not all micro usb supplies, or cables, are up to the task.
Please see my earlier post covering this topic here.
The Raspberry Pi 2, as with the predecessor Pi, can be setup to run faster than the default system, effectively giving extra processing and graphical capabilities for free. For retro gaming this can be critical, and is especially true of the N64 emulators, as well as when running more demanding PlayStation releases such as Gran Turismo 2.
Raspberry Pi System Architecture
The Raspberry Pi 2 contains a System on a Chip (SoC), which integrates a quad-core ARM CPU and a Broadcom VideoCore IV Graphics processing unit (GPU), alongside 1GB of SDRAM memory.