File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 23
23
#include "soc/rtc_cntl_reg.h"
24
24
#include "rom/rtc.h"
25
25
#include "soc/apb_ctrl_reg.h"
26
+ #include "soc/efuse_reg.h"
26
27
#include "esp32-hal.h"
27
28
#include "esp32-hal-cpu.h"
28
29
@@ -150,6 +151,15 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz){
150
151
}
151
152
return false;
152
153
}
154
+ //check if cpu supports the frequency
155
+ if (cpu_freq_mhz == 240 ){
156
+ //Check if ESP32 is rated for a CPU frequency of 160MHz only
157
+ if (REG_GET_BIT (EFUSE_BLK0_RDATA3_REG , EFUSE_RD_CHIP_CPU_FREQ_RATED ) &&
158
+ REG_GET_BIT (EFUSE_BLK0_RDATA3_REG , EFUSE_RD_CHIP_CPU_FREQ_LOW )) {
159
+ log_e ("Can not switch to 240 MHz! Chip CPU frequency rated for 160MHz." );
160
+ cpu_freq_mhz = 160 ;
161
+ }
162
+ }
153
163
//Get current CPU clock configuration
154
164
rtc_clk_cpu_freq_get_config (& cconf );
155
165
//return if frequency has not changed
You can’t perform that action at this time.
0 commit comments