diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-09-15 10:50:37 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-15 10:50:37 +0000 |
| commit | dfe5d1bd29969e786dedd5eb4c2c2bad3e467e4c (patch) | |
| tree | 7d72bc5369c23fc87944f5c25a7ab0a084b14845 /embassy-stm32 | |
| parent | 34370cc7df3e2c064af985ea7288ef74dfcd643a (diff) | |
| parent | 77d82516131ca37a706e1965e44fca40854931c5 (diff) | |
Merge pull request #4664 from phycrax/qspi_gpio_speed
embassy-stm32: Configurable gpio speed for QSPI
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/CHANGELOG.md | 1 | ||||
| -rw-r--r-- | embassy-stm32/src/qspi/mod.rs | 52 |
2 files changed, 29 insertions, 24 deletions
diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md index 93a1f4f64..eb48fd6fe 100644 --- a/embassy-stm32/CHANGELOG.md +++ b/embassy-stm32/CHANGELOG.md | |||
| @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 17 | - feat: Added support for more OctoSPI configurations (e.g. APS6408 RAM) ([#4581](https://github.com/embassy-rs/embassy/pull/4581)) | 17 | - feat: Added support for more OctoSPI configurations (e.g. APS6408 RAM) ([#4581](https://github.com/embassy-rs/embassy/pull/4581)) |
| 18 | - fix: stm32/usart: fix bug with blocking flush in buffered uart ([#4648](https://github.com/embassy-rs/embassy/pull/4648)) | 18 | - fix: stm32/usart: fix bug with blocking flush in buffered uart ([#4648](https://github.com/embassy-rs/embassy/pull/4648)) |
| 19 | - fix: stm32/(ospi/hspi/xspi): Fix the alternate bytes register config sticking around for subsequent writes | 19 | - fix: stm32/(ospi/hspi/xspi): Fix the alternate bytes register config sticking around for subsequent writes |
| 20 | - feat: Configurable gpio speed for QSPI | ||
| 20 | 21 | ||
| 21 | ## 0.4.0 - 2025-08-26 | 22 | ## 0.4.0 - 2025-08-26 |
| 22 | 23 | ||
diff --git a/embassy-stm32/src/qspi/mod.rs b/embassy-stm32/src/qspi/mod.rs index c0cd216f0..0644069a6 100644 --- a/embassy-stm32/src/qspi/mod.rs +++ b/embassy-stm32/src/qspi/mod.rs | |||
| @@ -48,6 +48,7 @@ impl Default for TransferConfig { | |||
| 48 | 48 | ||
| 49 | /// QSPI driver configuration. | 49 | /// QSPI driver configuration. |
| 50 | #[derive(Clone, Copy)] | 50 | #[derive(Clone, Copy)] |
| 51 | #[non_exhaustive] | ||
| 51 | pub struct Config { | 52 | pub struct Config { |
| 52 | /// Flash memory size representend as 2^[0-32], as reasonable minimum 1KiB(9) was chosen. | 53 | /// Flash memory size representend as 2^[0-32], as reasonable minimum 1KiB(9) was chosen. |
| 53 | /// If you need other value the whose predefined use `Other` variant. | 54 | /// If you need other value the whose predefined use `Other` variant. |
| @@ -62,6 +63,8 @@ pub struct Config { | |||
| 62 | pub cs_high_time: ChipSelectHighTime, | 63 | pub cs_high_time: ChipSelectHighTime, |
| 63 | /// Shift sampling point of input data (none, or half-cycle) | 64 | /// Shift sampling point of input data (none, or half-cycle) |
| 64 | pub sample_shifting: SampleShifting, | 65 | pub sample_shifting: SampleShifting, |
| 66 | /// GPIO Speed | ||
| 67 | pub gpio_speed: Speed, | ||
| 65 | } | 68 | } |
| 66 | 69 | ||
| 67 | impl Default for Config { | 70 | impl Default for Config { |
| @@ -73,6 +76,7 @@ impl Default for Config { | |||
| 73 | fifo_threshold: FIFOThresholdLevel::_17Bytes, | 76 | fifo_threshold: FIFOThresholdLevel::_17Bytes, |
| 74 | cs_high_time: ChipSelectHighTime::_5Cycle, | 77 | cs_high_time: ChipSelectHighTime::_5Cycle, |
| 75 | sample_shifting: SampleShifting::None, | 78 | sample_shifting: SampleShifting::None, |
| 79 | gpio_speed: Speed::VeryHigh, | ||
| 76 | } | 80 | } |
| 77 | } | 81 | } |
| 78 | } | 82 | } |
| @@ -286,14 +290,14 @@ impl<'d, T: Instance> Qspi<'d, T, Blocking> { | |||
| 286 | ) -> Self { | 290 | ) -> Self { |
| 287 | Self::new_inner( | 291 | Self::new_inner( |
| 288 | peri, | 292 | peri, |
| 289 | new_pin!(d0, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 293 | new_pin!(d0, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 290 | new_pin!(d1, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 294 | new_pin!(d1, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 291 | new_pin!(d2, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 295 | new_pin!(d2, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 292 | new_pin!(d3, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 296 | new_pin!(d3, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 293 | new_pin!(sck, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 297 | new_pin!(sck, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 294 | new_pin!( | 298 | new_pin!( |
| 295 | nss, | 299 | nss, |
| 296 | AfType::output_pull(OutputType::PushPull, Speed::VeryHigh, Pull::Up) | 300 | AfType::output_pull(OutputType::PushPull, config.gpio_speed, Pull::Up) |
| 297 | ), | 301 | ), |
| 298 | None, | 302 | None, |
| 299 | config, | 303 | config, |
| @@ -314,14 +318,14 @@ impl<'d, T: Instance> Qspi<'d, T, Blocking> { | |||
| 314 | ) -> Self { | 318 | ) -> Self { |
| 315 | Self::new_inner( | 319 | Self::new_inner( |
| 316 | peri, | 320 | peri, |
| 317 | new_pin!(d0, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 321 | new_pin!(d0, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 318 | new_pin!(d1, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 322 | new_pin!(d1, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 319 | new_pin!(d2, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 323 | new_pin!(d2, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 320 | new_pin!(d3, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 324 | new_pin!(d3, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 321 | new_pin!(sck, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 325 | new_pin!(sck, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 322 | new_pin!( | 326 | new_pin!( |
| 323 | nss, | 327 | nss, |
| 324 | AfType::output_pull(OutputType::PushPull, Speed::VeryHigh, Pull::Up) | 328 | AfType::output_pull(OutputType::PushPull, config.gpio_speed, Pull::Up) |
| 325 | ), | 329 | ), |
| 326 | None, | 330 | None, |
| 327 | config, | 331 | config, |
| @@ -345,14 +349,14 @@ impl<'d, T: Instance> Qspi<'d, T, Async> { | |||
| 345 | ) -> Self { | 349 | ) -> Self { |
| 346 | Self::new_inner( | 350 | Self::new_inner( |
| 347 | peri, | 351 | peri, |
| 348 | new_pin!(d0, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 352 | new_pin!(d0, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 349 | new_pin!(d1, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 353 | new_pin!(d1, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 350 | new_pin!(d2, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 354 | new_pin!(d2, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 351 | new_pin!(d3, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 355 | new_pin!(d3, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 352 | new_pin!(sck, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 356 | new_pin!(sck, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 353 | new_pin!( | 357 | new_pin!( |
| 354 | nss, | 358 | nss, |
| 355 | AfType::output_pull(OutputType::PushPull, Speed::VeryHigh, Pull::Up) | 359 | AfType::output_pull(OutputType::PushPull, config.gpio_speed, Pull::Up) |
| 356 | ), | 360 | ), |
| 357 | new_dma!(dma), | 361 | new_dma!(dma), |
| 358 | config, | 362 | config, |
| @@ -374,14 +378,14 @@ impl<'d, T: Instance> Qspi<'d, T, Async> { | |||
| 374 | ) -> Self { | 378 | ) -> Self { |
| 375 | Self::new_inner( | 379 | Self::new_inner( |
| 376 | peri, | 380 | peri, |
| 377 | new_pin!(d0, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 381 | new_pin!(d0, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 378 | new_pin!(d1, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 382 | new_pin!(d1, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 379 | new_pin!(d2, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 383 | new_pin!(d2, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 380 | new_pin!(d3, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 384 | new_pin!(d3, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 381 | new_pin!(sck, AfType::output(OutputType::PushPull, Speed::VeryHigh)), | 385 | new_pin!(sck, AfType::output(OutputType::PushPull, config.gpio_speed)), |
| 382 | new_pin!( | 386 | new_pin!( |
| 383 | nss, | 387 | nss, |
| 384 | AfType::output_pull(OutputType::PushPull, Speed::VeryHigh, Pull::Up) | 388 | AfType::output_pull(OutputType::PushPull, config.gpio_speed, Pull::Up) |
| 385 | ), | 389 | ), |
| 386 | new_dma!(dma), | 390 | new_dma!(dma), |
| 387 | config, | 391 | config, |
