Maix.freq
Frequency module, support program to modify cpu and kpu frequency
Method
freq.set(cpu, pll1, kpu_div)
Set cpu or kpu frequency, after setting it will automatically restart to take effect
Please note that the performance of some peripherals may change after the frequency is set
from Maix import freq
freq.set(cpu = 400, pll1 = 400, kpu_div=1)
The configuration file will be saved in the file system /flash/freq.conf, please do not modify this file, if the file does not exist, it will be created automatically
Parameters
Parameters that are not set will retain their previous values
Note: If the cpu frequency setting is less than 60MHz, the default REPL serial port baud rate will be set to 9600
cpu: The cpu frequency you want to set, the range is [26,600] (the chip is up to800but has voltage requirements. The series supported byMaixPydoes not support up to800, the default is400, different boards May behave differently, not too high for stabilitypll1: The output frequency ofpll1, the value range is [26,1200] (the chip is up to 1800, MaixPy is limited to 1200), the default is400kpu_div:kpuclock frequency division, value range [1,16], default1.kpufrequency =pll1/kpu_div, for example, if you want to set thekpufrequency to400, you only need to setpll1to400andkpu_divto1. Note thekpufrequency range: [26,600]
return value
If the frequency has not changed, it returns to null.
If the frequency changes, the machine will automatically restart. Before using this interface, please confirm whether the current situation can be restarted
freq.get()
Get the currently set frequency parameter
return value
cpu frequency and kpu frequency, returned as a tuple, such as (400,400)
freq.get_cpu()
Get the current frequency of cpu
return value
cpu frequency
freq.get_kpu()
Get the currently set kpu frequency
return value
Current kpu frequency