CPU Scaling Governor

Issue: Cpu Scaling Governor

We have seen some issues with the scaling cpu governor on the Raspberry PI interfere with the i2c bus. This sometimes causes the ZYMKEY to be put into a odd state or return failures from operations that get optimized out by the governor.

Workaround Solution We Recommend:

The PI sets the scaling governor to be ondemand by default. We recommend switching this mode to performance to get the best out of the ZYMKEY.

Note: Switching to performance will use more battery power.

Set to performance for current boot; not persistent on reboot:

  1. Run as root: sudo su echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor

Set performance to be persistent on reboot with a systemd service:

  1. Create a .service file in /etc/systemd/system/. You can name it whatever you wish. We will use cpu-governor.service.
  2. Write this code to /etc/systemd/system/cpu-governor.service file:
[Unit]

Description=Set scaling governor to performance

After=multi-user.target

Before=zkbootrtc.service

[Service]

Type=oneshot

ExecStart=/bin/sh -c "echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor"

[Install]

WantedBy=multi-user.target
  1. Enable the service: sudo systemctl enable cpu-governor
  2. Start the service: sudo systemctl start cpu-governor

Verifying the setting

You can use cat to verify the current setting. It should return performance. sudo cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor