# Pi Zero CPU Frequency



## cuqer (Nov 18, 2020)

Hi, how can I change my Pi Zero's CPU frequency?


----------



## George (Nov 19, 2020)

Aren't there sysctl(8)s for that?

```
dev.cpu.0.freq_levels: CPU frequency levels
dev.cpu.0.freq: Current CPU frequency
```


----------



## cuqer (Nov 19, 2020)

Elazar said:


> Aren't there sysctl(8)s for that?
> 
> ```
> dev.cpu.0.freq_levels: CPU frequency levels
> ...


Hi,

`sysctl -a | grep freq` returns:

```
kern.timecounter.tc.BCM2835-3.frequency: 1000000
kern.eventtimer.et.BCM2835-3.frequency: 1000000
kern.acct_chkfreq: 15
net.inet.sctp.sack_freq: 2
debug.cpufreq.verbose: 0
debug.cpufreq.lowest: 0
debug.uart_poll_freq: 50
```

`sysctl -a | grep cpu` returns:

```
kern.smp.cpus: 1
kern.smp.maxcpus: 1
kern.ccpu: 1948
kern.sched.cpusetsize: 4
kern.pin_pcpu_swi: 0
kern.vt.splash_cpu_duration: 10
kern.vt.splash_cpu_style: 2
kern.vt.splash_ncpu: 0
kern.vt.splash_cpu: 0
vfs.ncpurgeminvnodes: 128
net.inet.tcp.per_cpu_timers: 0
debug.cpufreq.verbose: 0
debug.cpufreq.lowest: 0
hw.ncpu: 1
hw.cpu.quirks.actlr_set: 0
hw.cpu.quirks.actlr_mask: 0
security.jail.param.cpuset.id: 0
```


----------



## George (Nov 20, 2020)

It might be that the cpufreq(4) driver works differently or not at all on armv6.

Maybe `dmesg |grep cpu` leads somewhere.

In case you ask on the arm mailing list, please also tell them which installation image you used.


----------



## SirDice (Nov 20, 2020)

If you're looking for config.txt you can find it in /boot/msdos/.


----------



## acheron (Nov 20, 2020)

Can you test this: https://forums.freebsd.org/threads/...ebsd-12-1-stable-over-rpi-b.72799/post-443765


----------



## cuqer (Nov 20, 2020)

Elazar said:


> It might be that the cpufreq(4) driver works differently or not at all on armv6.
> 
> Maybe `dmesg |grep cpu` leads somewhere.
> 
> In case you ask on the arm mailing list, please also tell them which installation image you used.


It returns nothing :/


----------



## cuqer (Nov 20, 2020)

SirDice said:


> If you're looking for config.txt you can find it in /boot/msdos/.


Hi, `cat` command returns:

```
init_uart_clock=3000000                                                           
enable_uart=1                                                                     
kernel=u-boot.bin                                                                 
kernel7=u-boot.bin                                                               
dtoverlay=mmc
```


----------



## SirDice (Nov 20, 2020)

I guessed you were looking for it as you need to adjust it in order to overclock the Pi. 









						Raspberry Pi Documentation - Configuration
					

The official documentation for Raspberry Pi computers and microcontrollers



					www.raspberrypi.org


----------



## cuqer (Nov 20, 2020)

acheron said:


> Can you test this: https://forums.freebsd.org/threads/...ebsd-12-1-stable-over-rpi-b.72799/post-443765


Checking now, thanks.
Edit: I didn't understand much from this link.


----------



## cuqer (Nov 20, 2020)

SirDice said:


> I guessed you were looking for it as you need to adjust it in order to overclock the Pi.
> 
> 
> 
> ...


I am not trying to overclock it but I saw that it was running slower than other OS. So I think it's CPU frequency is set to lower in order to prevent heating.

Edit: I checked the link. I think `init_uart_clock=3000000` is the CPU clock (am I right?). But I can't find uart_clock on the link you posted.


----------



## cuqer (Nov 20, 2020)

Now trying to do this: https://forums.FreeBSD.org/threads/...ebsd-12-1-stable-over-rpi-b.72799/post-443765
Edit: This solved the issue. Thanks!


----------



## SirDice (Nov 20, 2020)

cuqer said:


> I think `init_uart_clock=3000000` is the CPU clock (am I right?).


No, a UART is a serial port. It needs a clock to move data through a shift register at a specific rate. Better not mess around with that one or you may not be able to correctly send/receive data through its serial port. 









						Universal asynchronous receiver-transmitter - Wikipedia
					






					en.wikipedia.org


----------



## cuqer (Nov 20, 2020)

SirDice said:


> No, a UART is a serial port.
> 
> 
> 
> ...


Okay, thank you!

Now I think I need to enable powerd, is it done by adding `powerd_enable="YES"` to rc.conf?

And I have one more question that is not related to this topic: How can I know what I can add to rc.conf as `x_enable="YES"` or `if_x_enable="YES"`, I don't think that we can add vi_enable="YES" to start vi at the boot time. I searched net for how to enable powerd in freebsd and a few results show up. None of them directly saying it is `powerd_enable="YES"`, I feel like I need to learn what I can add to rc.conf.

-Thank you so much!


----------



## SirDice (Nov 20, 2020)

The `ifconfig_*` variables are for *I*nter*F*aces, like the ethernet or wireless interfaces, it directly translates to the ifconfig(8) command. `foo_enable` is generally used to enable services, the command `service -e` will show you which services have been enabled. Services are started with scripts in /etc/rc.d and /usr/local/etc/rc.d. Those `*_enable` variables just tells the system which ones to activate.

For example, `sshd_enable="YES"` causes /etc/rc.d/sshd to be executed during boot which starts the sshd(8) daemon.


----------



## cuqer (Nov 20, 2020)

SirDice said:


> The `ifconfig_*` variables are for *I*nter*F*aces, like the ethernet or wireless interfaces, it directly translates to the ifconfig(8) command. `foo_enable` is generally used to enable services, the command `service -e` will show you which services have been enabled. Services are started with scripts in /etc/rc.d and /usr/local/etc/rc.d. Those `*_enable` variables just tells the system which ones to activate.
> 
> For example, `sshd_enable="YES"` causes /etc/rc.d/sshd to be executed during boot which starts the sshd(8) daemon.


Thank you so much!


----------

