File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -150,11 +150,10 @@ bool setCpuFrequency(uint32_t cpu_freq_mhz){
150150 //Make the frequency change
151151 rtc_clk_cpu_freq_set_config_fast (& conf );
152152 if (capb != apb ){
153- //Update REF_TICK
154- uint32_t xtal_mhz = rtc_clk_xtal_freq_get ();
155- uint32_t tick_freq_mhz = (conf .freq_mhz >= xtal_mhz )?xtal_mhz :conf .freq_mhz ;
156- uint32_t tick_conf = tick_freq_mhz / (REF_CLK_FREQ / MHZ ) - 1 ;
157- ESP_REG (APB_CTRL_XTAL_TICK_CONF_REG ) = tick_conf ;
153+ //Update REF_TICK (uncomment if REF_TICK is different than 1MHz)
154+ //if(conf.freq_mhz < 80){
155+ // ESP_REG(APB_CTRL_XTAL_TICK_CONF_REG) = conf.freq_mhz / (REF_CLK_FREQ / MHZ) - 1;
156+ //}
158157 //Update APB Freq REG
159158 rtc_clk_apb_freq_update (apb );
160159 //Update esp_timer divisor
Original file line number Diff line number Diff line change 2727#include <sys/time.h>
2828#include "soc/rtc.h"
2929#include "soc/rtc_cntl_reg.h"
30+ #include "soc/apb_ctrl_reg.h"
3031#include "rom/rtc.h"
3132#include "esp_task_wdt.h"
3233#include "esp32-hal.h"
@@ -145,8 +146,10 @@ bool btInUse(){ return false; }
145146
146147void initArduino ()
147148{
149+ //init proper ref tick value for PLL (uncomment if REF_TICK is different than 1MHz)
150+ //ESP_REG(APB_CTRL_PLL_TICK_CONF_REG) = APB_CLK_FREQ / REF_CLK_FREQ - 1;
148151#ifdef F_CPU
149- setCpuFrequency (F_CPU /1000000L );
152+ setCpuFrequency (F_CPU /1000000 );
150153#endif
151154#if CONFIG_SPIRAM_SUPPORT
152155 psramInit ();
You can’t perform that action at this time.
0 commit comments