Raspberry Pi Overclocking

Element 14 Raspberry Pi

Like just like alot of other people as soon as the Model B Raspberry Pi went on sale in March I eagerly rushed out and ordered one from Element 14.

Due to production delays this didn’t arrive till the start of June.  But given its size, specs and price I was more than happy to see it finally arrive in the mail. Upon its arrival I rushed down to the store and brought a USB card reader, a couple of 16GB sdcards and a HDMI to DVI cable so I could use a standard LCD screen I had laying around as a display.

A couple of corrupted attempts at writing the images to the sdcard with dd later, and I was up and running the standard Debian Squeeze image. After a quick poke around the internals I took a quick peek at the CPU information with  “cat /proc/cpuinfo” and was presented with the following output:

Processor    : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS    : 697.95
Features    : swp half thumb fastmult vfp edsp java tls
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x0
CPU part    : 0xb76
CPU revision    : 7

Hardware    : BCM2708
Revision    : 0002
Serial        : 000000001e57390e

Using the BogoMIPS value as a very basic benchmark, 698 BogoMIPS puts the Raspberry Pi CPU at around the same level as a 350mhz Pentium 2 processor. From this point it didn’t take long to get me thinking what the chances were of benchmarking the system and trying to overclock.

Benchmarking the system
To measure any possible performance gains by overclocking, I am simply decided to measure the time to calculate the value of Pi (its makes sense as its a Raspberry Pi) to to 5000 digits using bc. The command looks like this:

time echo “scale=5000; 4*a(1)” | bc -l -q

On my Raspberry Pi with the default clock speeds using the the Debian image. This command took 3 minutes 43.980 seconds to execute. The default CPU speed of the Raspberry Pi is 700mhz so my plan was to increase the CPU clock speed and see what sort of gains I got in the execution time of my Pi calculation. Overclocking a Raspberry Pi couldn’t be easier I simply needed to create a config.txt file in /boot partition that contains the new CPU frequency with the arm_freq parameter.

sudo pico /boot/config.txt

In this file I am going to try a small jump first up to 750mhz and run the benchmark again.

arm_freq=750

After saving the new config.txt file I reboot and ran the benchmark again. This time around the calculation took 3 minutes 28.669 seconds, giving a reduction of 15.311 seconds which is not bad considering it was only a 50mhz jump!
Furthers tests gave me:

  • 800mhz – 3 minutes 17.670 secondsCalculation times for Pi to 5000 digits on a Raspberry Pi
  • 825mhz – 3 minutes 10.098 seconds
  • 850mhz – 3 minutes 3.84 seconds
  • 875mhz – 2 minutes 58.63 seconds
  • 900mhz – 2 minutes 58.520 seconds

For some point point of reference I performed this test on a quad core AMD Phenom 9550 and it took 42.310s, and on my i5-2500 work desktop it only took 20.304 sec. So while the Rasberry Pi is not exactly a processing power house by any stretch when compared to a standard desktop it stills packs a fairly hefty punch given its size and price. The board didn’t seem to heat up that much during testing and the system was stable at every frequency tested. Although I was a bit hesitant to try anything over 900mhz while it is still so hard to source a new Raspberry Pi.

The memory and GPU frequencies can also be tweaked by using the sdram_freq and gpu_freq parameters in the config.txt file although I am going to leave further experimentation with these settings until I have a bit more spare time.

More Reading:
The GNU bc page
Raspberry Pi homepage
Raspberry at Element 14
Command line calculations with bc