Skip to content

Conversation

@kilograham
Copy link
Contributor

Also adds vreg_get_voltage()

@P33M
Copy link
Contributor

P33M commented Feb 17, 2025

IMO SYS_CLK_VREG_VOLTAGE_MIN is misnamed - it's a frequency scaling operating point, not a minimum. If you're not wanting to boost clk_sys then the "minimum" shouldn't be applied, as it just wastes power. Such OPPs are usually referred to as turbo/boost settings.

@lurch
Copy link
Contributor

lurch commented Feb 17, 2025

There are a couple of small tweaks needed to stop tools/extract_configs.py getting upset...

diff --git a/src/rp2040/hardware_regs/include/hardware/platform_defs.h b/src/rp2040/hardware_regs/include/hardware/platform_defs.h
index e1d368e..9566e1f 100644
--- a/src/rp2040/hardware_regs/include/hardware/platform_defs.h
+++ b/src/rp2040/hardware_regs/include/hardware/platform_defs.h
@@ -69,6 +69,9 @@
 #define SYS_CLK_HZ ((SYS_CLK_MHZ) * _u(1000000))
 #else
 // PICO_CONFIG: PICO_USE_FASTEST_SUPPORTED_CLOCK, Use the fastest officially supported clock by default, type=bool, default=0, group=hardware_base
+#ifndef PICO_USE_FASTEST_SUPPORTED_CLOCK
+#define PICO_USE_FASTEST_SUPPORTED_CLOCK 0
+#endif
 #if PICO_USE_FASTEST_SUPPORTED_CLOCK
 #define SYS_CLK_HZ _u(200000000)
 #else
diff --git a/src/rp2_common/hardware_clocks/include/hardware/clocks.h b/src/rp2_common/hardware_clocks/include/hardware/clocks.h
index 217bb7d..1a598cf 100644
--- a/src/rp2_common/hardware_clocks/include/hardware/clocks.h
+++ b/src/rp2_common/hardware_clocks/include/hardware/clocks.h
@@ -225,6 +225,10 @@ extern "C" {
 #ifndef PLL_SYS_POSTDIV2
 #define PLL_SYS_POSTDIV2                    1
 #endif
+#else
+#ifndef SYS_CLK_VREG_VOLTAGE_AUTO_ADJUST
+#define SYS_CLK_VREG_VOLTAGE_AUTO_ADJUST 0
+#endif
 #endif // PICO_RP2040 && SYS_CLK_KHZ == 200000 && XOSC_KHZ == 12000 && PLL_COMMON_REFDIV == 1
 
 #if !defined(PLL_SYS_VCO_FREQ_HZ) || !defined(PLL_SYS_POSTDIV1) || !defined(PLL_SYS_POSTDIV2)

@kilograham
Copy link
Contributor Author

kilograham commented Feb 17, 2025

IMO SYS_CLK_VREG_VOLTAGE_MIN is misnamed - it's a frequency scaling operating point, not a minimum. If you're not wanting to boost clk_sys then the "minimum" shouldn't be applied, as it just wastes power. Such OPPs are usually referred to as turbo/boost settings.

It is the minimum voltage for the requested sys_clock; i.e. its value is dependent on the sys clock you choose, and the clock setup will increase the current voltage if it is less than this

@kilograham kilograham merged commit c757f36 into develop Feb 18, 2025
8 checks passed
@kilograham kilograham deleted the clock_voltage_and_speed branch February 18, 2025 15:51
will-v-pi pushed a commit to will-v-pi/pico-sdk that referenced this pull request Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants