RetroPie is a bundle of software aimed at allowing you to run many “retro” games on an otherwise very innocent little Raspberry Pi.
I recently had a yearning to play “The Legend of Zelda: Ocarina of Time”, one of my all time favourites, but to my dismay after eventually finding and connecting my ancient N64, it turned out it was no longer functional…
So, I figured it would be fun to see if I could get it up and running on an emulator, and I had a couple of Pi4 kicking around for another project (which is requiring a bit of a rethink).
There are a few ways you can install RetroPie, and it’s well documented across the interweb, so I won’t repeat all that here. At the time of writing RetroPie 4.6 has recently been released and you can download an entire Raspbian image with most necessaries pre-installed, and there is even a very new Pi 4 image. I did this. It was very straight-forward and worked immediately.
Adding ROMs (the games) is also very well documented so I was quickly “up and running” with Zelda… except… it really didn’t perform that well at first… the video and the sound was all a bit broken up.
Adding a controller was easy, I had a PS3 SixAxis to hand and just plugged it in (USB). Apparently it can connect using bluetooth too (another day). First time run walked me through mapping the controller. It was very straightforward. As a side note, it’s a bit of a pain using a PS3 controller with N64 games (but you do adapt); I have ordered a USB version of the N64 controller from Amazon.
The Nintendo 64 really was a cracking bit of hardware (for the time) and this has meant that emulation on small board computers like the Pi has always been a bit of challenge. The rumour has it though that the Pi 4 has a significantly better GPU (Video Core VI) and so in theory really should be up to the job. That said, linux driver support is still “early days” so it seems that we are at the “work in progress” stage.
After a fair bit of googling, and some reasonably unsuccessful attempts at messing around with emulator settings, I decided I might try my hand at over-clocking the Pi. I should add at this point that for the most part there is not much of a load on the quad core CPU in the Pi 4 running the N64 emulators; really the focus is the GPU.
On digging into overclocking on Pi 4 I found a fair bit of misinformation about overclocking, but based on the official docs, my overclocking entries in /boot/config.txt look like this:
…
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
# I added the following…
# Overclock – 1500Mhz is default for Pi4
# over_voltage 6 is the max for “normal” overclocking
over_voltage=6
# the base CPU clock – this can go higher
# but there is no point in my case
arm_freq=2000
# Single HDMI, so run it as well as possible
# The following actually enables 60Hz 4k, but also set the GPU core
# frequency to 550 Mhz
hdmi_enable_4kp60=1
# gpu_freq tuning should be avoided on Pi4 as it sets
# core_freq which can’t be changed
# the 4kp60 sets core_freq to 550
# So we overclock each GPU element seperately
# Frequency of the hardware video block in MHz
# This isn’t really used much for emulation
h264_freq=550
# Frequency of the image sensor pipeline block in MHz
# Not really relevant for emulation
isp_freq=550
# Frequency of the 3D block in MHz
# This really is the key component as far as I can tell
# I managed to get it up to 850MHz and it appears stable for me
v3d_freq=850
# Frequency of the High Efficiency Video Codec block in MHz
# Again not especially relevant for the emulators
hevc_freq=550
This appears to have done the trick…
I’ve been using the opening credits of Zelda for testing, as they appear to be quite demanding. The measures is: video and sound smooth, and that now seems to be working fine using the default lr-mupen64plus-next emulator, with default settings, with the base N64 configuration set to run 640×480 resolution which is appropriate for the platform.
You can see the measured frequencies below, after running the above for just under and hour. With regards to temperature, the Pi 4 is in an aluminium case, with a small fan sitting on top.
[arm] frequency(48)=2000478464 [core] frequency(1)=550006336 [v3d] frequency(46)=849999040 temp=34.0'C volt=1.0125V throttled=0x0
So, it does look a bit clunky on a large modern 4k TV… but I believe there are further things I can do to help with this. The first one, which is very effective, is to sit further away. I will give the game a bit of play this evening and maybe mess around with some emulator settings and optimisations and see what can be done.
I’ll also see if I can find out how to add the frame rate to the screen, to be a little more scientific about this.