File tree 2 files changed +8
-6
lines changed
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){
150
150
//Make the frequency change
151
151
rtc_clk_cpu_freq_set_config_fast (& conf );
152
152
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
+ //}
158
157
//Update APB Freq REG
159
158
rtc_clk_apb_freq_update (apb );
160
159
//Update esp_timer divisor
Original file line number Diff line number Diff line change 27
27
#include <sys/time.h>
28
28
#include "soc/rtc.h"
29
29
#include "soc/rtc_cntl_reg.h"
30
+ #include "soc/apb_ctrl_reg.h"
30
31
#include "rom/rtc.h"
31
32
#include "esp_task_wdt.h"
32
33
#include "esp32-hal.h"
@@ -145,8 +146,10 @@ bool btInUse(){ return false; }
145
146
146
147
void initArduino ()
147
148
{
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;
148
151
#ifdef F_CPU
149
- setCpuFrequency (F_CPU /1000000L );
152
+ setCpuFrequency (F_CPU /1000000 );
150
153
#endif
151
154
#if CONFIG_SPIRAM_SUPPORT
152
155
psramInit ();
You can’t perform that action at this time.
0 commit comments