diff options
| author | 1-rafael-1 <[email protected]> | 2025-05-01 00:11:56 +0200 |
|---|---|---|
| committer | 1-rafael-1 <[email protected]> | 2025-05-01 00:11:56 +0200 |
| commit | 22b5f73811a7cc0dbca920e02b5d001d252d344c (patch) | |
| tree | d3fd2d801ffddc74a43f04c7892c953356647904 /examples/rp/src/bin/overclock.rs | |
| parent | d44b94523576d3f8c1f586811f600eb3ba223606 (diff) | |
add manual overclock example, finalize API, cleanup
Diffstat (limited to 'examples/rp/src/bin/overclock.rs')
| -rw-r--r-- | examples/rp/src/bin/overclock.rs | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/examples/rp/src/bin/overclock.rs b/examples/rp/src/bin/overclock.rs index 9027f1516..e3ac77340 100644 --- a/examples/rp/src/bin/overclock.rs +++ b/examples/rp/src/bin/overclock.rs | |||
| @@ -1,9 +1,13 @@ | |||
| 1 | //! # Overclocking the RP2040 to 200 MHz | ||
| 2 | //! | ||
| 3 | //! This example demonstrates how to configure the RP2040 to run at 200 MHz using a higher level API. | ||
| 4 | |||
| 1 | #![no_std] | 5 | #![no_std] |
| 2 | #![no_main] | 6 | #![no_main] |
| 3 | 7 | ||
| 4 | use defmt::*; | 8 | use defmt::*; |
| 5 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 6 | use embassy_rp::clocks::{clk_sys_freq, ClockConfig, VoltageScale}; | 10 | use embassy_rp::clocks::{clk_sys_freq, ClockConfig}; |
| 7 | use embassy_rp::config::Config; | 11 | use embassy_rp::config::Config; |
| 8 | use embassy_rp::gpio::{Level, Output}; | 12 | use embassy_rp::gpio::{Level, Output}; |
| 9 | use embassy_time::{Duration, Instant, Timer}; | 13 | use embassy_time::{Duration, Instant, Timer}; |
| @@ -15,15 +19,10 @@ const COUNT_TO: i64 = 10_000_000; | |||
| 15 | async fn main(_spawner: Spawner) -> ! { | 19 | async fn main(_spawner: Spawner) -> ! { |
| 16 | // Set up for clock frequency of 200 MHz | 20 | // Set up for clock frequency of 200 MHz |
| 17 | // This will set all the necessary defaults including slightly raised voltage | 21 | // This will set all the necessary defaults including slightly raised voltage |
| 18 | // See embassy_rp::clocks::ClockConfig for more options, including full manual control | ||
| 19 | let config = Config::new(ClockConfig::at_sys_frequency_mhz(200)); | 22 | let config = Config::new(ClockConfig::at_sys_frequency_mhz(200)); |
| 20 | 23 | ||
| 21 | // Show the voltage scale and brownout-detection for verification | 24 | // Show the voltage scale for verification |
| 22 | info!("System core voltage: {}", Debug2Format(&config.clocks.voltage_scale)); | 25 | info!("System core voltage: {}", Debug2Format(&config.clocks.voltage_scale)); |
| 23 | // info!( | ||
| 24 | // "Brownout detection: {}", | ||
| 25 | // Debug2Format(&config.clocks.brownout_detection) | ||
| 26 | // ); | ||
| 27 | 26 | ||
| 28 | // Initialize the peripherals | 27 | // Initialize the peripherals |
| 29 | let p = embassy_rp::init(config); | 28 | let p = embassy_rp::init(config); |
| @@ -64,14 +63,3 @@ async fn main(_spawner: Spawner) -> ! { | |||
| 64 | Timer::after(Duration::from_secs(2)).await; | 63 | Timer::after(Duration::from_secs(2)).await; |
| 65 | } | 64 | } |
| 66 | } | 65 | } |
| 67 | |||
| 68 | // let config = Config::new(ClockConfig::with_speed_mhz_test_voltage(125, Some(VoltageScale::V1_10))); | ||
| 69 | // let config = Config::default(); | ||
| 70 | // let config = Config::new(ClockConfig::with_speed_mhz_test_voltage_extended_delay( | ||
| 71 | // 200, // Standard 125MHz clock | ||
| 72 | // Some(VoltageScale::V1_15), // 1.15V voltage | ||
| 73 | // Some(1000), // 1000μs (1ms) stabilization delay - significantly longer than default | ||
| 74 | // )); | ||
| 75 | // Initialize the peripherals | ||
| 76 | |||
| 77 | // let p = embassy_rp::init(Default::default()); //testing the bog standard | ||
