Raspberry Pi Overclocking Guide

raspberry pi overclock

We overclock the Raspberry Pi single-board computer to 700 MHz. I originally published this overclocking guide on hwbot.org.

Raspberry Pi: Introduction

It took a while for me to jump on board of the Raspberry Pi wagon. For one, I am not a software guy and have very little understanding of Linux. Two, the Raspberry Pi is so small that overclocking almost seems impossible. However, because Frederik – RichBa5tard, owner of HWBOT – is so enthusiastic about the Raspberry Pi and the overclocking fun it brings along, I decided to go ahead and try it out anyway. With the HWBOT Prime application ready for cross-platform performance comparison, I already had a tool to benchmark the Raspberry Pi and see the performance scaling when overclocking.

In the end, the Raspberry Pi went up from about 160PPS (“Primes per Second”) at stock frequency to the current high of 568PPS. Of course, the process of performance increase does not only involve hardware tweaking – “Overclocking” – but also software tweaking. In this editorial, I will describe my Raspberry Pi experience and provide a basic guide for those who want to get involved in Raspberry Pi and ARM overclocking!

Raspberry Pi: Gathering all components.

This step is not too difficult. The following components are necessary to get started with Raspberry Pi overclocking:

  • Raspberry Pi unit
  • SD-Card, preferably Class10 grade
  • USB keyboard
  • USB mouse
  • HDMI-cable
  • Micro-USB cable
  • Optional: LAN-connection and external PSU

You can buy the Raspberry Pi through a couple of resellers. I found one in the local Guang Hua computer department store. The official price is USD $25 for Model A and USD $35 for Model B, but this excludes shipping and reseller charges. Model A has 256MB RAM, one USB port and no Ethernet (network connection), whereas Model B has 512MB RAM, two USB ports and an Ethernet port. I would definitely recommend acquiring Model B as it makes the entire overclocking process a lot easier. I did not buy an external PSU because I am using a nearby PC system as power source via USB. This seems to work very well and since I am not planning to use the Raspberry Pi for anything else than overclocking, I figured I do not need a separate power source.

Once you found all the components, it is easy to assemble. Plug in all the connectors and you are done!

Raspberry Pi: Installing the software.

When I first assembled the Raspberry Pi, I figured this would be the most difficult part of getting started. It turns out it’s actually quite simple as long as you follow the instructions and are not scared of doing a little bit of debugging work. Even though Frederik argued otherwise, Linux is not as easy as Windows to get started with. There are many ways to get your RPi up and running, but I will just stick to what worked for me. You know, this is just a guide to get started.

The Operating System: Raspbian “wheezy”

Following the instructions at the official Raspberry Pi website (http://www.raspberrypi.org/downloads), I opted for the recommended Linux distribution Raspbian Wheezy. As the site states, “It is a reference root filesystem from Alex and Dom, based on the Raspbian optimised version of Debian, and containing LXDE, Midori, development tools and example source code for multimedia functions.” Honestly speaking, I have no idea what that all means. Here are the tools necessary to install the operating system:

  • Raw image file of the Raspbian Wheezy (download)
  • Win32DiskImager (download)
  • A Windows PC with SD-Card reader

Once you have everything downloaded, do the following.

  1. Insert the SD-Card
  2. Open Win32DiskImager
  3. Load the .IMG from the downloaded .ZIP file into Win32DiskImager
  4. Select the correct device (!)
  5. Press Write

The image will now be written onto the SD Card. Depending on the speed of your system and the SD Card, this can take a couple of minutes. Note that you can also read an SD Card. This is a particularly handy feature to save your overclocking configuration and software installation when you found the magic settings. I have made an image file of the operating system I achieved my highest score with.

For more information on the SD Card preparation, refer to this page: http://elinux.org/RPi_Easy_SD_Card_Setup. Their guide helped me figure it out the first time.

Once the flash has finished, you are ready to boot up the Raspberry Pi!

Setting up the operating system

When booting up the Raspberry Pi for the first time, a very basic looking configuration setup awaits you. If you are not interested in configuring the Raspberry Pi at this moment, you can skip this by pressing Escape. I would recommend doing the following adjustments:

  • Expand Filesystem – this option will make the entire SD Card storage space available to Raspberry Pi. I forgot this once and ran out of storage when installing other software.
  • Enable Boot To Desktop – No. I find the command line to be much easier to use when overclocking the RPi. Not only is it easier to configure the overclock, it also seems more efficient and thus better for benchmark scores.
raspberry pi configuration

You will also find an overclocking section with pre-defined overclocking profiles. There is no need to choose any of those profiles, as we will be doing the overclocking manually later. Just select finish and reboot. After the reboot, enter the credentials to log into your Raspberry Pi. The default credentials are:

  • User: Pi
  • Password: Raspberry

Once you logged in, you can start installing the software for benchmarking. Before we continue, I would like to give you a couple of commands that might be useful throughout the guide.

  • sudo su: enables superuser rights
  • shutdown -r now: command to reboot the Raspberry Pi if Super User mode enabled. You can also reboot with CTRL+ALT+DEL.
  • startx: starts the GUI operating system that comes with the Raspbian Wheezy
  • wget [x]: command to download the file from the URL [x]

As mentioned earlier, for overclocking and benchmarking we will be using the command line. For uploading the result later on, we can use the GUI mode. I will explain how to later on. First, let us install all the software we need for overclocking.

HWBOT Prime and Java installation

As you know from our regular overclocking, there are three things needed when benchmarking: a benchmark, drivers, and an overclocking tool. For our day-to-day overclocking endeavours, that can be: SuperPI, Intel chipset drivers and the BIOS. For this particular guide, we will need these tools:

  • HWBOT Prime V0.8.3
  • Java JDK
  • Config.txt

First things first, let us install the HWBOT Prime. It is very easy. Just type the following command: wget http://downloads.hwbot.org/hwbotprime.jar

Once finished, you can type ‘dir’ and press enter to check if the file was actually downloaded in the folder. Next up is the Java JDK for Linux. To make it easy, let us start with installing the official version first. This is V1.7. To download and install this version, use the following command: sudo apt-get install openjdk-7-jre

Do not forget to confirm the download by pressing ‘Y’. The total size is about 47MB, so it will take a bit longer to install than HWBOT Prime. Once downloaded, confirm that the Java JDK has been installed correctly with the following command: java

If the command is not recognised, try the update command, followed by another install command: sudo apt-get update and sudo apt-get install openjdk-7-jre

Once again, try if Java has been installed correctly. Everything should be working now. For your convenience, I have uploaded a Raw image of the Raspbian Wheezy operating system with HWBOT Prime 0.8.3 and Java JDK7 pre-installed. You can download it here. I would recommend trying the manual way first, if not out of pride at least to familiarize yourself with the Linux environment and commands.

Since everything is working, it is time to start benchmarking. To get the first reference benchmark score at default frequencies, run the following command: java -jar hwbotprime.jar. Once the benchmark is finished, you will see your score

How to save and submit with HWBOT Prime?

HWBOT Prime is an internal benchmark we prepared to demonstrate our new open API for benchmark applications. The central idea of the open API is to allow benchmark developers to submit benchmark data files securely to HWBOT. Not only do they have easy rankings for their benchmarks, the secured data file prevents easy tampering with screenshots. As data file submission is central in this approach, the only way to submit an HWBOT Prime benchmark result is via data file. We do this by either saving a file and uploading it manually later, or submitting directly from the application. Both can be done from the command line.

When submitting from the command line, you can obviously not open a browser. So HWBOT Prime will give you a link you can enter in your browser to retrieve your score. Honestly speaking, this is not too user-friendly and it is very likely that we will update this feature in the future. When overclocking via the command line mode, it is easier to submit via the GUI operating system. Just save your benchmark to a file, press ‘q’ and open the GUI with this command: startx.

The operating system comes with a browser called ‘Midori’. This browser allows you to submit a result to HWBOT in the way you know all too well. When selecting the data file, make sure to browse to the right folder. If you followed the instructions of this guide, the file is saved under /home/pi. Select, upload, and enjoy your new benchmark score! We are now ready to start overclocking and really push this little thing.

Raspberry Pi: Overclocking and benching.

For a hardware guy, it seems the difficult part of overclocking the Raspberry Pi is over. That is true for the most part. The actual overclocking part of RPi is nothing more than adjusting a little config file – more details on that later in this article. This would not be overclocking if there were not a little twist, however. Before we start increasing the frequencies, we should have a look at the overall architecture and the various components on the Raspberry Pi.

The Hardware

A good starting point to study the components and the architecture of the Raspberry Pi is the hardware section at eLinux (link). The heart of the RPi is the Broadcom BCM2835 System-on-a-chip (“SoC”) and a 256 or 512MB SDRAM memory chip. The SDRAM is stacked on top of the Broadcom SoC – a so-called Package-on-package design (“PoP”) – and therefore it is impossible to measure the temperature of both ICs independently. The biggest advantage of using a stacked design is that it saves a lot of space on the PCB.

We do not have to spend too much time on the SDRAM as it is a very simple Low Power DDR2 (“LPDDR2″) IC used in cell phones, tablets, smartphones and other mobile devices. There are two variants of the SDRAM in circulation: Hynix and Samsung. My particular unit was equipped with the 30nm Samsung K4P4G324EB IC (link). Reading the product page, we see it is rated up to DDR2-1066, which would be 533MHz. The default memory clock for the Raspberry Pi is 500MHz. It operates at 1.8V VDD / 1.2V VDDQ voltages. A more detailed datasheet is currently not available as the SDRAM IC is still in production.

The Broadcom BCM2835 is a more interesting topic. This one IC includes not only the CPU core (ARM1176JZF-S ARM11) clocked at 700MHz, but also a GPU core (VideoCore IV GPU) and a DSP core. Unlike with for example Haswell, the L2 cache is not located on the processor core. It is part of the GPU core. Overclocking the GPU core will thus have an effect on the RPi performance. There are a couple of datasheets available on the Broadcom BCM2835 but so far, none was useful for my overclocking adventures.

The Clock Domains and Functions

What follows is a list of the various clock domains we can tune when overclocking. I have listed them by their name in the configuration file.

arm_freq – ARM frequency, default = 700MHz
gpu_freq – GPU frequency, default = 250MHz
dram_freq – SDRAM frequency, default = 500MHz

Each of these components has their own PLL and can be clocked independently. The GPU frequency can be further split up into:

core_freq – GPU core frequency, has an impact on ARM performance since it drives L2 cache
h264_freq – frequency of the hardware video block
isp_freq – frequency of the image sensor pipeline block
v3d_freq – frequency of the 3D block

The default frequency of the four parts of the GPU is the same as the general GPU frequency, 250MHz. Since they are part of the GPU, all four share the same PLL and can therefore not be clocked independently. This does not mean it is impossible to have the four at different frequencies, it just means that adjusting the one will automatically adjust the other. Each of the four parts has to run at an integer divisor of the PLL frequency. The PLL frequency can be calculated as follows:

f(PLL) = [floor(2400/2*f(Core)) * (2*f(Core)]

The frequency of the GPU parts is calculated as follows

f(GPU) = f(PLL) / [integer]

Let us have a look at the practical example. Let us say we want to overclock the Core containing the L2 cache to 550MHz and leave the GPU frequency slightly above default.

f(Core) = 550 MHz

f(PLL) = [floor(2400/2*550) * (2*550)]
=> fPLL = 2*1100 = 2200

f(GPU) >= 250 MHz => 2200 / 250 = 8,8
=> Integer for fGPU >= 250 MHz = 8
=> f(GPU) = 2200/8 = 275 MHz

When overclocking the Core frequency to 550 MHz and leaving the GPU (with H264, V3D and ISP) frequency at default or higher, results in a GPU frequency of 275 MHz. Easy!

There are two notes to make to this section. One, it is not necessary to manually set the GPU frequency when overclocking the Core frequency. The Raspberry Pi will automatically calculate the closest integer and set program the PLL accordingly. Note that in our example the RPi would have chosen 9 instead of 8, resulting in a GPU frequency of 244MHz. Two, the Raspberry Pi development team acknowledged it might be easier to have the option to independently clock the Core frequency without having to worry about the other parts of the GPU. As this requires a fourth PLL, they added the option not dedicate a PLL to PWM audio and instead use it for the Core frequency. This will reduce analogue audio quality. How you can use this functionality, you will find out in a bit.

The Voltages

The RPi does not come with an external voltage regulator. The 5V VIN goes straight to the BCM2835 SoC and splits off from there. It seems impossible to fine-tune the voltages manually as we do on graphics cards with VRs. The configuration file does allow voltage tweaking, but we are limited to the voltages provided by the developers. There are five voltage options available. The default voltage for all is 1.2V.

over_voltage – ARM and GPU core voltage adjustment, default
over_voltage_sdram – sets all other SDRAM voltages together
over_voltage_sdram_c – SDRAM controller voltage adjustment
over_voltage_sdram_i – SDRAM I/O voltage adjustment
over_voltage_sdram_p – SDRAM phy voltage adjustment

The voltages are adjustable with a single integer input, ranging from -16 to +8. The granularity is 0.025V, meaning you can overclock in steps of 0.025V. The default value is 0. So, if you set an overvoltage of 2, you will increase the voltage with 0.05V, resulting in an effective voltage of 1.25V. Very easy, very simple. Consequently, the highest voltage selectable for ARM, GPU, or SDRAM is 1.4V by setting 8. I have tried higher than 8, but that did not result in a higher voltage level.

To measure the effective voltage levels, refer to image below.

raspberry pi voltage readout

Currently, we are looking for solutions to set higher voltages. One idea is to increase the VIN from 5V to something higher. Another idea is to hack the kernel and see if we can find additional options. These are currently nothing more than ideas, though.

Miscellaneous

In the configuration file, you will find a couple of other settings that are relevant to the overclocking experience as well. The most important ones are:

disable_l2cache – disables L2 cache for ARM, default is 0
force_turbo – disables dynamic clocking so all frequencies and voltages stay high, enables h264/v3d/isp overclocking, enables over_voltage to 8, default is 1
temp_limit – sets the temperature threshold limit, default is 85
avoid_pwm_pll – enable PLL for Core frequency so it can overclocked independently from the GPU, default=0
current_limit_override – disables SMPS current limit protection when set to “0×5A000020″, can help if you are currently hitting a reboot failure when overclocking too high.

There are plenty of extra settings to be fine-tuned, which do not relate to overclocking. You can find a good overview at http://elinux.org/RPiconfig.

Overclocking (finally!)

After about 3,500 words of introductory jibber-jabber, we can finally start overclocking. As I mentioned earlier in this editorial, overclocking is actually very easy with the Raspberry Pi. We can do everything via the config.txt file in the boot folder. The frequencies of the RPi cannot be adjusted real-time, so the overclock is set at boot. There are two ways to adjust the frequency and voltage settings. One, you can mount your RPi SD Card into a secondary system, open the config.txt file, adjust the values and save it back on the SD Card. Mount the SD Card on your RPi and the overclock will be set on next boot. Two, via command line. To access the config.tx file from command line, use the following command: sudo nano /boot/config.txt

This will open the config file. To change settings, simply move the cursor to the field you want to change and adjust the value. Then press CTRL+X to exit, confirm the changes by pressing ‘Y’ and save the file as config.txt. Reboot to see the effect of the changes. That is all!

The configuration file is a bit like the bios you would find on any of your Haswell or Ivy Bridge configuration. Instead of relying on a 3rd party (for example Gigabyte, MSI, ASRock) to provide all the settings in an orderly structured fashion, you can easily do it yourself! For example, I made my personal configuration file with all the overclocking related options at the top and the elaborate explanation at the bottom. This allows me to oversee the settings more easily. I have uploaded it for your convenience. You can download it here. Do not forget to rename the file! Note that I have different files with different overclock settings, just to make it easier to swap back in case things go wrong.

raspberry pi overclock configuration

The rest of the story is quite simple. Just like any other platform, it is a matter of testing the relation between voltage and frequency, and checking stability with the benchmark. In my experience, with a single fan targeted at the PoP ICs, the temperature will not exceed 45°C even if the voltage is set at the maximum of 1.4V.

Software tweaking – Java JDK8

At this point, we have talked about most of the aspects of overclocking the Raspberry Pi. The last topic that rests us is the part of software tweaking. For a complete Linux nitwit as me, it is quite difficult talk about tweaking the operating system. After all, I do not have much experience with the operating system, let alone the knowledge to find out what settings could provide a performance enhancement. This is something I will have to learn by testing.
One tweak I am familiar with is changing the Java JDK version. This is not that different from installing the latest Nvidia beta driver, so it is quite difficult to call it a tweak. However, it is software and it gives a performance boost, so I take the liberty to call it tweaking!

For ARM users and specifically Raspberry Pi owners, Oracle released a beta version of the latest Java VM JDK8, optimised for embedded ARM CPUs. For HWBOT Prime benchers, the performance increases significantly from about 180PPS to about 540PPS. That is a 300% performance increase. To install this version – I assume you all want this – simply take the following steps (found at stackexchange.

Note: if you currently have the JDK7 installed, remove it with the command: sudo apt-get remove openjre-7-jdk

First, download Oracle Java 8: http://jdk8.java.net/fxarmpreview/index.html. To install, issue the following commands

sudo tar zxvf jdk-8-ea-b36e-linux-arm-hflt-*.tar.gz –C /opt
sudo update-alternatives –install “/usr/bin/java” “java” “/opt/jdk1.8.0/bin/java” 1
java –version

Now the latest JDK is installed.

Raspberry Pi: Conclusive lines

Ending this article with the conclusive lines and an opening sentence of this paragraph that has zero informative value, I hope this guide can help getting started with the Raspberry Pi. This guide does not nearly include all the information of the RPi, and there is still heaps of information out on the internet. I had never used Linux before, and getting started was not easy. Most of the time I had a notebook on my lap to Google commands, files, and other information needed to resolve problems. Chances are you will have to do the same. Honestly speaking, for me this was a very nice and interesting experience. It is something else than just loading Windows and using sliders to increase the frequency. It is cheap, it is fun, it is tweakable and it can be overclocked – I do not need more to entertain myself for a couple of weeks.

If you have any questions or remarks, feel free to post in the forum. Good luck, all!

Leave A Comment