aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusedhondacivic <[email protected]>2025-10-26 20:03:57 -0700
committerusedhondacivic <[email protected]>2025-10-26 20:33:39 -0700
commita863aadc643d84707815e5c0f4564f2195809fec (patch)
tree44b47b9dd7236a5807b960a84c7e59f9e500f5c6
parent4d869e69730b997ff6d7c162cf1f5f3ffa868caa (diff)
Fix build
-rw-r--r--cyw43-pio/CHANGELOG.md2
-rw-r--r--cyw43-pio/src/lib.rs7
2 files changed, 5 insertions, 4 deletions
diff --git a/cyw43-pio/CHANGELOG.md b/cyw43-pio/CHANGELOG.md
index 584df6689..c2d18919c 100644
--- a/cyw43-pio/CHANGELOG.md
+++ b/cyw43-pio/CHANGELOG.md
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7 7
8<!-- next-header --> 8<!-- next-header -->
9## Unreleased - ReleaseDate 9## Unreleased - ReleaseDate
10
10- Select pio program based on core clock speed #4792 11- Select pio program based on core clock speed #4792
12
11## 0.8.0 - 2025-08-28 13## 0.8.0 - 2025-08-28
12 14
13- Bump cyw43 version 15- Bump cyw43 version
diff --git a/cyw43-pio/src/lib.rs b/cyw43-pio/src/lib.rs
index 51d8ec3ae..c8715e662 100644
--- a/cyw43-pio/src/lib.rs
+++ b/cyw43-pio/src/lib.rs
@@ -13,7 +13,6 @@ use embassy_rp::gpio::{Drive, Level, Output, Pull, SlewRate};
13use embassy_rp::pio::program::pio_asm; 13use embassy_rp::pio::program::pio_asm;
14use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine}; 14use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine};
15use fixed::FixedU32; 15use fixed::FixedU32;
16use fixed::traits::LosslessTryInto;
17use fixed::types::extra::U8; 16use fixed::types::extra::U8;
18 17
19/// SPI comms driven by PIO. 18/// SPI comms driven by PIO.
@@ -64,7 +63,7 @@ where
64 let effective_pio_frequency = (clk_sys_freq() as f32 / clock_divider.to_num::<f32>()) as u32; 63 let effective_pio_frequency = (clk_sys_freq() as f32 / clock_divider.to_num::<f32>()) as u32;
65 64
66 #[cfg(feature = "defmt")] 65 #[cfg(feature = "defmt")]
67 defmt::trace!("Effective pio frequency: {}", effective_pio_frequency); 66 defmt::trace!("Effective pio frequency: {}Hz", effective_pio_frequency);
68 67
69 // Non-integer pio clock dividers are achieved by introducing clock jitter resulting in a 68 // Non-integer pio clock dividers are achieved by introducing clock jitter resulting in a
70 // combination of long and short cycles. The long and short cycles average to achieve the 69 // combination of long and short cycles. The long and short cycles average to achieve the
@@ -72,14 +71,14 @@ where
72 // This can be a problem for peripherals that expect a consistent clock / have a clock 71 // This can be a problem for peripherals that expect a consistent clock / have a clock
73 // speed upper bound that is violated by the short cycles. The cyw43 seems to handle the 72 // speed upper bound that is violated by the short cycles. The cyw43 seems to handle the
74 // jitter well, but we emit a warning to recommend an integer divider anyway. 73 // jitter well, but we emit a warning to recommend an integer divider anyway.
75 if let None = clock_divider.lossless_try_into<u32>() { 74 if clock_divider.frac() != FixedU32::<U8>::ZERO {
76 #[cfg(feature = "defmt")] 75 #[cfg(feature = "defmt")]
77 defmt::trace!( 76 defmt::trace!(
78 "Configured clock divider is not a whole number. Some clock cycles may violate the maximum recommended GSPI speed. Use at your own risk." 77 "Configured clock divider is not a whole number. Some clock cycles may violate the maximum recommended GSPI speed. Use at your own risk."
79 ); 78 );
80 } 79 }
81 80
82 // Different pio programs must be used for different pio clock speeds. 81 // Different pio programs must be used for different pio clock speeds.
83 // The programs used below are based on the pico SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_cyw43_driver/cyw43_bus_pio_spi.pio 82 // The programs used below are based on the pico SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_cyw43_driver/cyw43_bus_pio_spi.pio
84 // The clock speed cutoff for each program has been determined experimentally: 83 // The clock speed cutoff for each program has been determined experimentally:
85 // > 100Mhz -> Overclock program 84 // > 100Mhz -> Overclock program