In Part 1, I explained the mechanics behind adjusting the CPU frequency on LEGO MINDSTORMS EV3. In this post, I have a new insight to share and and a new way to try it yourself.
In the last post, we found out that we can run the CPU at 375MHz and still be completely within the datasheet specifications, therefore it should be quite safe to run the CPU at this speed. But the CPU is actually rated at 456MHz. I was reluctant to run it that fast though since we can’t control the voltage to the CPU and the datasheet says that we should increase the voltage from 1.2V to 1.3V when running at this frequency. Since then, though, I have learned that running a CPU is called undervolting. It is generally considered a safe thing to do. There is the possibility that the CPU won’t work correctly, but it will just cause crashes. You can just revert to a lower frequency and you are back in business.
So, I decided to try it out. And it appears that it works without crashing! I even let my EV3 run for a few days at 456MHz just to be sure and I haven’t had any noticeable problems yet.
I’ve made this super-easy to try out now. Starting with ev3dev-stretch images 2018-06-13 and later, there is a uEnv.txt in the EV3DEV_BOOT partition. You can edit this file by plugging the microSD card into a computer or you can run
sudo nano /boot/flash/uEnv.txt in a SSH terminal on your EV3.
Remove the comment (the
#) from the line that says
cpufreq=375. Then (re)boot your EV3 and see what happens. (You can actually use any number you want and the bootloader will choose the closest available rate up to 456MHz).
One the EV3 has started, you can verify that it is running faster in an SSH terminal like this:
$ lscpu | grep Bogo BogoMIPS: 227.32
BogoMIPS is short for Bogus Million Instructions Per Second. It is called bogus because this number is not actually a good indicator of how fast a processor is in general (i.e. as compared to other processors). But, we an use this number to compare a processor to itself. In the case of the EV3’s processor, it turns out that this number is approximately 1/2 of the CPU frequency. So, at the usual 300MHz, this number will be ~150. At 375MHz it will be ~187 and at 456MHz it will be ~228.
Also, if you are wondering if running at a higher speed uses more power, of course you are right. But the question of how much turns out to be: not much. From my measurements, it seems to only be using about 5mA more current (@8V) when running at 375MHz vs. 300MHz. For perspective, the four LEDs on the EV3 use around 20mA each.
Even at 456MHz the EV3 is still quite slow compared to a BeagleBone or Raspberry Pi. Nevertheless, it does make a noticeable difference for CPU-intensive tasks. It boots just a little bit faster, Python starts just a little faster, etc.