File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 2323#include "soc/rtc_cntl_reg.h"
2424#include "rom/rtc.h"
2525#include "soc/apb_ctrl_reg.h"
26+ #include "soc/efuse_reg.h"
2627#include "esp32-hal.h"
2728#include "esp32-hal-cpu.h"
2829
@@ -150,6 +151,15 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz){
150151 }
151152 return false;
152153 }
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+ }
153163 //Get current CPU clock configuration
154164 rtc_clk_cpu_freq_get_config (& cconf );
155165 //return if frequency has not changed
You can’t perform that action at this time.
0 commit comments