CM4: Getting Started

Hey guys,
I’m working on this guide for myself and all new users.
From reading the forum I now, that many geniuses here developed/improved many tools and I try to summarise it to build something like an up-to-date best practice guide.

It’s a work in progress and I definitely don’t have a full overview. So, if you have infos on any of the listed things or have any other tips and links, that would be great.

Can you help me to understand the difference/current status with respect to the CM4 of these 3 threads:

What would be a good fit for the CM4 guide?

1 Like

The keyboard’s firmware is not related to the DevTerm’s main processor, so it’s not CM4 specific (or CM3, A04, A06, etc). The keyboard works just like any USB peripheral (you can plug it into your computer and use it).

I personally think the trackball is janky because of the firmware. I tried fixing it but got limited results. I intended to release my custom firmware as a binary, but I got busy with other things.

Please try reading my topic and feel free to contact me via DMs if you have any questions :slight_smile:

1 Like

There’s an antenna fix that seems to be needed.


Also, there is apparently no need for the python-based fan controller that also ships with A06, A04, R1. For Raspberry Pi CM4 it sounds like the built in fan control can be used, but the devterm package should be removed, and settings adjusted as mentioned here:

Edit: I tried this on mine, and while doing the test to toggle the gpio pin and check if the fan works, does work, the fan doesn’t seem to turn on when the CPU gets hotter than the value I set in the pi config. Not sure what, if anything, I’ve done wrong.

Maybe I just needed to reboot, but the fan actually does seem to be working now, when it gets above the temperature threshold.

1 Like

Overclocking is also an option. I’ve tried over_voltage=6 and arm_freq=2000 as described here, and it seems stable. Under heavy load (100% on all 4 CPUs) it never got above 74°C and I didn’t see any throttling.


Uh nice!
I will add it to the post!
Do you by any chance have the ability to measure the power consumption and compare it?

I would be interested to have a “performance switch”, where we can tune down the CPU to preserve power for longer battery or over clock for extra boost.

I don’t have a way to measure power consumption in terms of voltage, but I guess I could find some kind of battery monitor/logger and run it on battery until it runs dry. Doing that with different CPU frequency settings would provide a comparison. My batteries are not new, but they should be in pretty good shape and fairly representative.

Any suggestions for a battery monitor/logger, and I suppose something to run to keep the system busy until it drains the battery? :slight_smile:

Ok, for logging, I think I can use the excellent work done here. I just checked and the script works on devterm as well as gameshell, so I should be able to log voltage, battery capacity, and current over time. I just need to come up with something that taxes the CPU and drains power fairly quickly. Suggestions welcome!

1 Like

The antenna fix made it worse for me.
Wi-Fi reception was bad before, and this made it worse :smile:
I deleted the line again.

Can anyone confirm my experience?

1 Like

Measuring power draw is a constant headache for me.
I really which we can have a good tool for it.

Looking foreword for your results!

Just to clarify, your wifi still works, it’s just the reception that got worse with the “fix”, right? Mine doesn’t show up at all, which I suspect is due to the printer driver (which also doesn’t work). So I’m hoping when I roll it back and stop it from updating it might fix the wifi too, but I’ll also try toggling that fix off and see if it helps.

Right now, I’ve been running a battery drain test with the CPU at 2GHz. I used that script I linked to above, and set it to log every 5 minutes. I turned the screen brightness all the way up, and I ran a freshly compiled version of the latest MAME emulating Space Lords (just in the attract mode – I wasn’t playing). I turned the volume down in MAME shortly after starting the test though, as it was starting to get annoying. The only other thing I had plugged in was a USB ethernet dongle, and I had a putty terminal connected with btop running so I could easily check how it was doing. Anyhow, while it won’t be perfect, I figure this will be a reproducible and pretty similar test to run with different CPU frequencies. It just drained the battery a few minutes ago, so I’ll charge up and prepare for a second run with different CPU frequency settings.

It lasted slightly longer than 2 hours. Seemed like it ended pretty abruptly, going from 20% battery left to no power at the end, in less than 5 minutes.

I’m curious to see how it does at the default CPU frequency. It’s possible my batteries are starting to get old and not work as well too. I expected it to go longer than 2 hours, but it doesn’t mean much until I have something to compare.

Here’s the raw data. The format that script produces is voltage (which in my case ranged from 4.2 to 3.4), battery % capacity (100 → 20), battery current (I think the first reading might have still been plugged into USB power, oops!), and the time (which ran from 6:05pm to 8:15pm). My /boot/config.txt contained:


script collected data:

4222000 100     3000    18:05
3942000 98      1956000 18:10
3920000 96      1970000 18:15
3908000 95      1973000 18:20
3902000 94      1990000 18:25
3898000 93      1968000 18:30
3886000 93      2004000 18:35
3880000 92      1984000 18:40
3867000 90      2006000 18:45
3850000 89      2016000 18:50
3830000 86      2034000 18:55
3804000 84      2070000 19:00
3780000 80      2052000 19:05
3756000 77      2080000 19:10
3733000 73      2096000 19:15
3714000 70      2097000 19:20
3694000 67      2112000 19:25
3678000 64      2133000 19:30
3661000 62      2103000 19:35
3643000 58      2161000 19:40
3623000 54      2151000 19:45
3604000 50      2162000 19:50
3582000 46      2180000 19:55
3559000 39      2176000 20:00
3536000 33      2213000 20:05
3513000 27      2183000 20:10
3488000 20      2210000 20:15

Regarding the Wi-Fi, yes that is correct.

For the rest:
You are amazing!
This is super super cool!
And a nice benchmark procedure indeed.

The battery drop off can be explained by the overall status of the battery, as you said.
The cell can’t hold the necessary voltage on the lower end as well as on the upper end, which is why it plummeted increasingly.

If we want to be truly scientific I guess this can impact the benchmark negatively, since a clocked down benchmark won’t stress the BAT that much and thereby might not trigger this “landslide” that much, but that’s very much nitpicking.
I have fresh batteries. Maybe I will try to verify your results.

1 Like

So, overclocked, I had 130 minutes of power. And at the default speed I had 170 minutes. I’m considering trying an underclocked speed too, I guess 1.0 Ghz? Let me know, and I can use the same setup.

Here’s a chart for both overclocked (2.0) and default (1.5). I’m not sure why there is a faster dropoff at the start for the default speed. The only difference in my test was I turned the volume down immediately for the default, and I waited 5-10min for the overclock because I didn’t realize how annoying it was going to be. :slight_smile: Otherwise, the task should have been the same.

And here’s the data. I converted the timestamps to minutes, for graphing purposes.

1 Like

So cool!

1 GHz is good.
I also would be interested in 800 MHz.
But I have no idea where the limits are reached of the RPi

wut cm4 has no cpufreq support?

I’m not sure what you mean. But yeah, my A06 core will change frequency on the fly based on the scheduler, and I can check it and verify with command line tools, or see it in htop/btop, etc.

But with the stock OS install, before I changed anything, on CM4 it always holds steady at whatever frequency it’s set at. So by default it was always showing 1.5Ghz, even if it was idling or not doing much. When I made the change mentioned above to test 2Ghz, it remained at that, regardless of what it was doing.

@jan-peter, regarding 1GHz or 800MHz, I looked around online and I didn’t see any solid or trustworthy examples of anyone actually underclocking their Pi 4 by changing arm_freq and over_voltage as everyone seems to do (and as I did) for overclocking. So far, this is the best info I’ve seen, but it seems rather trial and error driven and I’m not sure if changing the values could lead to damage, or other weirdness if things don’t match up properly. The weird thing is, they appear to keep the default arm_freq of 1.5 and just change a bunch of other frequency settings. It also appears that the GPU pulls a decent amount of power, perhaps even when it’s not being used much. So perhaps for CPU intensive tasks that aren’t dependent on graphics, my previous test runs might have lasted longer if I had tweaked the GPU settings (and maybe some of these other things?)

I felt more confident with overclocking, as there were plenty of examples of other people doing it online, and a consistent way to accomplish it. I’m much less confident about this. If anyone knows how to properly underclock and optimize battery life on a Pi 4, I’m open to suggestions, hopefully with proven examples. :wink: I might still try these settings I linked to, especially since it sounds like it worked, and they were able to still run web browsers with youtube, etc. So their device was still usable. Hmm.

1 Like

wow thanks for the heads up, I’ll see if I can fix that when my uConsole+cm4 arrives.

I ran the same test using the values I found at that link above. Note that CPU speed was still the default 1.5Ghz though. I’m not sure what the appropriate undervoltage value would be to go along with 1GHz, or 800MHz, so I decided not to risk it. (If I knew for sure it wouldn’t hurt anything, I guess I could use these values with 1000 or 800 and see how it goes.)

The values I added to config.txt were:


The result was an additional 20min of power beyond the defaults. So the results of the three tests (running MAME, Space Lords, with full display brightness, wifi off, and a USB ethernet dongle, with btop running in a putty terminal):
2.0GHz at 2 hours 10 minutes
1.5GHz at 2 hours 50 minutes (default)
1.5GHz with adjustments at 3 hours 10 minutes

I wish I had brand new batteries to test on, as I’m sure all these test would have gone longer. But hopefully they at least scaled appropriately since I was using the same batteries.

1 Like

That’s just so cool!

Maybe we can come up with a good, solid test script or something else easily reproduce able and I can run it on my set up with fresh batteries.
I sadly can’t find any details about my batteries, other than their name: samsung sdi 8 151 LJ1T

Ok, final results for this test. I went ahead and ran it again with the CPU set to 1.0GHz, and the same low power settings I used before. So the settings looked like this:


It only managed to add another 5 minutes to the time. So I don’t think there’s much point in trying 800Mhz, since I imagine at most it would give another 5 minutes. :wink:

Seems like those low power settings I found on that other thread and used for both the 1.5GHz and 1.0GHz tests might be worth considering since they gave the biggest savings compared to the default. I’m sure they could probably be tweaked and improved, but I don’t really know what I’m doing so I’ll leave that to someone else!

You’re right though, it would be good to come up with a standard test that is easy to setup and run. I looked around and there are some CPU, memory, and GPU stress test packages like sysbench, stress-ng, and other things like this made for the Pi GitHub - nschloe/stressberry: Stress tests for the Raspberry Pi and cpu-burn Whats a good way to stress test the processor on my pi 4? Looking to test the cpu fan - Raspberry Pi Forums
A few others are mentioned here:
performance - How can I stress test my Raspberry Pi - Raspberry Pi Stack Exchange
But all of those are assuming you want to test for stability and also test to make sure the device isn’t overheating, so they are burst tests to max things out for 10 minutes or less and then stop. They aren’t really designed to run a battery down, and I’m not sure it would be wise to run them as long as necessary for that.