Raspberry Pi Zero 2 W Overview and Emulation Performance Boost – Retropie on the Pi Zero 2
1st November 2021Get RetroPie running On The Raspberry Pi Zero 2 W at 1.4 GHz
5th November 2021Overclock Your Raspberry Pi Zero 2 W – RetroPie at 1.4 GHz
The Raspberry Pi Zero 2 already gives a substantial performance boost over the original Raspberry Pi Zero W. But we can squeeze even more processing power out of it using overclocking.
What Is Overclocking?
Overclocking is where we run the processor, graphics card and memory at a faster clock rate than on the standard device. Doing this makes all the devices on the board run faster giving us a performance boost.
How to Overclock a Raspberry Pi
Overclocking a Raspberry Pi is very easy. We only have to edit the config.txt file stored in the root folder of the boot partition.
If you already understand how to do this, please check the video description for links that let you jump forward in the video to the settings I used to get the desktop running at 1.3 GHz and Retropie running at 1.4 GHz.
If you’re not familiar with overclocking, I’ll now take you through the whole process.
Before we make a start on overclocking, we first need to set up a few things.
Setting up for Overclocking
The processor on a Raspberry Pi doesn’t always run at full speed. When the device is not doing very much, for example when you are just looking at the desktop, it turns down the processor speed to save energy. So, we need a way of seeing how fast the processor is running so that we can tell when our overclocking is working.
We can easily do this by adding a plug-in to the taskbar panel.
If you right click on a blank area on the taskbar and then select add panel items you’ll see the panel preferences dialogue box open up. Make sure that the panel applets tab is selected and then click the add button to add a new plug-in. Scroll down until you find the CPUFreq frontend plug-in and then click the add button.
Overheating
When we overclock a processor, it needs more energy to run. This extra energy gets dissipated as extra heat inside the chips on the board, so they start to get hotter. The processor chip has built-in thermal protection so when it reaches its maximum operating temperature it will automatically slow the processor down. So, we need to monitor this temperature to make sure that we don’t hit the thermal limit otherwise all our overclocking settings will simply be turned off.
Again, we can add the CPU Temperature Monitor plug-in to our taskbar panel.
Monitoring Processor Speed and Temperature
Now that we’ve added these panel items you’ll see two extra icons in the taskbar.
The processor temperature is always on display but to see the processor speed you need to hover over the processor icon.
As you can see at the moment because the computer isn’t doing anything the processor speed has been turned down to 600 MHz.
However, if we start the browser application, we put a processing load on the Raspberry Pi and it responds by turning the processor speed up to its maximum which is currently the default 1000 MHz or 1 GHz.
Measuring Performance with Benchmarks
The whole point of overclocking is to make the Raspberry Pi run our software faster than the default settings. So, we need a way of measuring how fast our board is running. We can do this by eye and just see if our programs are working better, but it’s much easier to use benchmarking programs which will put an actual number to the speed of our system. As we adjust our overclocking settings will then be able to see any small changes in the overall performance.
To install the benchmarking software, you need to open a terminal window.
Updating the System
First, we need to make sure that the whole system is fully up-to-date. We first need to update our database by using the
sudo apt-get update
command. Once that’s finished running, we can run a full system update using the
sudo apt-get-full-upgrade
command. This can take a while to complete but just leave it running until you get back to the normal system prompt.
Installing the Benchmark Software
Now that the operating system is fully updated we can install the benchmarking software.
The first package we’ll install is Sysbench
sudo apt-get install sysbench
Sysbench lets us run tests to measure our processor and memory speed.
To measure the graphic performance, we’ll use the glxgears software which is part of the mesa-utils package.
sudo apt-get install mesa-utils
Running the Benchmark Software
We’ll be using Sysbench to measure the speed of our processor and memory.
The processor speed is measured by getting to calculate prime numbers. If we use the command
sysbench --test=cpu --cpu-max-prime=10000 --num-threads=4 run
it will calculate the first 10,000 prime numbers using all four processing cores and report back to us how long this process took. The less time it takes to complete the faster processor of running. If we change the number of threads option to 1 we’ll be able to measure the speed of a single core.
To measure the memory speed, we use the command
sysbench --test=memory --memory-block-size=1K --memory-total-size=2G --num-threads=4 run
This will continually access 1K blocks of memory until the total amount of memory it’s accessed reaches 2 GB. Again the performance will be measured in how long it takes to complete the task.
Our GPU benchmark is run with the following command
glxgears
This will open up a window with some rotating gears. The software tries to draw each frame in the animation as fast as possible and report back to us how many frames per second it’s managing to complete. The more frames per second we get the faster our GPU is running.
Adding in the Overclocking Settings
As I said earlier to over clock a Raspberry Pi we simply need to edit it’s config.txt file. I find the uses way to do this is in the terminal. The command
sudo nano /boot/config.txt
will open up the file for editing. If you scroll down, you will come to a commented out section with one of the basic overclocking parameters. All we need to do is type in our new settings, save the file and reboot the computer.
The settings below are the default speeds for the Raspberry Pi Zero 2. We’ll then start altering them to get the board running faster.
# default settings # ARM and GPU settings arm_freq=1000 core_freq=400 over_voltage=0 gpu_freq=400 # RAM settings sdram_freq=450 over_voltage_sdram=0
The settings really work in pairs, and it is best to adjust one pair at a time so you can see what effect your changes have.
We’ll start with the main processor core speeds which is adjusted using the arm_freq parameter. The number specified will set the processor clock speed in megahertz. So 1200 will set the clock speed to 1.2 GHz. The over_voltage parameter can be used to help with instability as we increase the clock speed. I’ve explained this in more detail in a previous overclocking video and put a link to that in the description below. But basically, as we increase the clock speed the shape of the electronic clock signal can cause the processor to crash. Increasing the processor voltage can tighten this shape allowing the processor to continue working.
For now, we’ll just change the frequency and see what happens.
# default settings # ARM and GPU settings arm_freq=1200 core_freq=400 over_voltage=0 gpu_freq=400 # RAM settings sdram_freq=450 over_voltage_sdram=0
To save this file press control X, Y to save and enter to save it with the same file name. You then need to reboot the Raspberry Pi and run the benchmark tests to see if we made any improvements.
System Crashes
Sometimes, actually quite often, we’ll either find that the system won’t boot at all, or it will crash while we run our stress tests. This is normal as we’re trying to find the best overclocking settings by trial and error. If the system crashes, we need to re-edit the config.txt file to try new set of values.
If the Raspberry Pi is able to boot you can edit the config.txt file using nano and the terminal. If you can’t get the computer to boot, simply take the SD card and put it into a normal PC. You’ll find a disk drive labelled boot and inside that you’ll see the config.txt file which you can then edit with a text editor such as notepad or Atom.
Variability
One thing to bear in mind is that what’s possible with overclocking does rely on individual device properties. When chips are fabricated, they have slight variations. The quoted speeds for a device are guaranteed to work, but naturally the absolute maximum speed any one chip can run at depends on how these random manufacturing variations came together. My Raspberry Pi Zero 2 will be different to yours. You might be able to get more speed, or you might crash with my settings. It’s just down to luck.
What Order to Adjust the Overclocking Settings
I always start with the processor frequency. Gradually increase it and gradually increase the overvoltage setting if the system crashes.
Once you got a good processor speed you can adjust the core_freq and gpu_freq to increase the speed of the graphics processor. Start by increasing both together and once you hit the limit for the core frequency you can try increasing the GPU frequency even higher. For GPU testing don’t forget you need to use the glxgears benchmark.
The RAM frequency and RAM overvoltage work in the same way as the processor frequency. Increase the frequency and then try to pull it back into proper timing using overvoltage.
Final Desktop Settings
After a bit of playing about I ended up with the following set of settings for running the Raspberry Pi Zero 2 with the Raspberry Pi OS.
# ARM and GPU settings arm_freq=1300 core_freq=550 over_voltage=6 gpu_freq=700 # RAM settings sdram_freq=550 over_voltage_sdram=1
Overall this gave around a 25% increase in performance as you can see from these benchmark scores.
RetroPie Settings
My main aim however is to increase the performance of the Raspberry Pi Zero 2 when running Retropie to emulate retro gaming systems. To edit the config.txt file in a Retropie setup you can either plug the SD card into your main PC or call up the EmulationStation menu, select quit and then exit EmulationStation. This will then drop you back into the Raspberry Pi terminal.
I find that Retropie really doesn’t like you playing with the GPU settings. Anything above the default setup seems to crash the system after a few minutes playing. So I simply deleted the settings and played with the processor frequency and RAM frequency.
Doing this I was able to get a stable 1.4 GHz for the processor.
# RetroPie Settings arm_freq=1400 over_voltage=8 sdram_freq=533 over_voltage_sdram=1
As you can see from these performance figures it actually gives better performance than a 1.3 GHz processor with GPU tuning, even on the GPU benchmarks. But unfortunately I couldn’t get a stable 1.4 GHz when the Raspberry Pi was running the Raspberry Pi OS desktop. It did run for a few minutes, long enough for me to run the benchmark tests, but always eventually crashed.
Overheating
At the very start we said that overheating could be a problem. If I run the GPU test in the desktop with the processor set to 1.3 GHz you can see that the temperature is starting to get very high. To combat this you really need to add some cooling to the processor chip.
You can buy stick-on heatsinks that will help to keep the processor cool. Some metal casings also have hit dissipation built into them. Or you can see if I blow air across one of the stick-on heatsinks it greatly improves the heatsinks ability to cool the processor cores.
You’ll also have to take this temperature increase into account depending on what you want to do with the Raspberry Pi. I intend to put this Raspberry Pi into a handheld gaming device so I may not have enough room for a heatsink, and even if I do that isn’t going to be a lot of moving air around to take the heat away. Even though I can run at 1.4 GHz I might not be able to use all that power safely.
Retropie Gaming Tests
As I said earlier my ultimate goal is to improve the performance of retro gaming emulators. So let’s have a look at how a 1.4 GHz Raspberry Pi Zero 2 compares to the stock board.
Arcade Games
In my previous overview video, which I’ll link to in the description down below, we saw how the new Raspberry Pi allowed the MAME emulator to run at full speed. Overclocking simply gives the Raspberry Pi extra performance in reserve.
Mega Drive / Genesis Performance
Hard to emulate games on the Sega Mega Drive ran at close to full speed on the stock Raspberry Pi Zero 2. Running at 1.4 GHz we can now get a steady 60 frames per second in every game that I’ve tried.
VectorMan was dipping down to the mid to low 50s but now runs a constant 60 frames per second.
Gunstar Heroes was dropping down below 50 frames per second but now also runs a constant 60 frames per second.
Nintendo 64
I had hoped that with a bit of tuning the Raspberry Pi Zero 2 would be able to run some of the less intensive Nintendo 64 games. Super Mario 64 does run better but it’s still not really a playable game. Maybe with some extra tweaks to the emulator it will run better but I think we really are at the limits of what this little Raspberry Pi can do.
PSP
Play Station Portable games are going to be very hit and miss. Some of the very low power games will run but as soon as you start to put a bit more stress on the emulator the Raspberry Pi isn’t going to be able to keep up. Little Big Planet isn’t a particularly processor heavy game, and the Raspberry Pi does cope very well with the first level. But as soon as more objects need to be modelled on the screen it very quickly runs out of umph.
PlayStation 1
PlayStation emulation was good on the stock Raspberry Pi but again, with a bit of overclocking, we get very stable full speed emulation. All the games I’ve tested ran perfectly with.
Conclusion
So getting the new Raspberry Pi Zero 2 to run at 1.3 GHz or even up to 1.4 GHz is fairly easy to achieve. You do need to watch the temperature but it does seem to be very stable at these clock speeds.
Overall you’re going to get a good 25% performance increase across the board.
From a retro gaming point of view this doesn’t unlock any of the slightly more modern gaming consoles, but it does consolidate pretty much everything up to the original PlayStation with smooth, full speed emulation. I haven’t yet tried increasingly emulators resolution, but again this is probably somewhere where we could make use of the extra processing power.
I hope you find this video useful and please do click that like button and subscribe to my channel if you want to see more of my videos. Don’t forget to check out my website, link in the description below, for more information, all of the code and settings using this video, and many more gaming, coding and making projects.
Have fun playing with your new Raspberry Pi Zero 2 W and I look forward to seeing you again very soon.