diff options
| -rw-r--r-- | embassy-stm32/CHANGELOG.md | 1 | ||||
| -rw-r--r-- | embassy-stm32/src/hspi/mod.rs | 17 | ||||
| -rw-r--r-- | embassy-stm32/src/ospi/mod.rs | 19 | ||||
| -rw-r--r-- | embassy-stm32/src/xspi/mod.rs | 17 |
4 files changed, 26 insertions, 28 deletions
diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md index 4ea11b664..93a1f4f64 100644 --- a/embassy-stm32/CHANGELOG.md +++ b/embassy-stm32/CHANGELOG.md | |||
| @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 16 | - fix: STM32: Prevent dropped DacChannel from disabling Dac peripheral if another DacChannel is still in scope ([#4577](https://github.com/embassy-rs/embassy/pull/4577)) | 16 | - fix: STM32: Prevent dropped DacChannel from disabling Dac peripheral if another DacChannel is still in scope ([#4577](https://github.com/embassy-rs/embassy/pull/4577)) |
| 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 | 20 | ||
| 20 | ## 0.4.0 - 2025-08-26 | 21 | ## 0.4.0 - 2025-08-26 |
| 21 | 22 | ||
diff --git a/embassy-stm32/src/hspi/mod.rs b/embassy-stm32/src/hspi/mod.rs index 62bc0e979..3b73062a2 100644 --- a/embassy-stm32/src/hspi/mod.rs +++ b/embassy-stm32/src/hspi/mod.rs | |||
| @@ -116,7 +116,7 @@ pub struct TransferConfig { | |||
| 116 | 116 | ||
| 117 | /// Data width (DMODE) | 117 | /// Data width (DMODE) |
| 118 | pub dwidth: HspiWidth, | 118 | pub dwidth: HspiWidth, |
| 119 | /// Data buffer | 119 | /// Data Double Transfer rate enable |
| 120 | pub ddtr: bool, | 120 | pub ddtr: bool, |
| 121 | 121 | ||
| 122 | /// Number of dummy cycles (DCYC) | 122 | /// Number of dummy cycles (DCYC) |
| @@ -395,11 +395,6 @@ impl<'d, T: Instance, M: PeriMode> Hspi<'d, T, M> { | |||
| 395 | // Configure alternate bytes | 395 | // Configure alternate bytes |
| 396 | if let Some(ab) = command.alternate_bytes { | 396 | if let Some(ab) = command.alternate_bytes { |
| 397 | T::REGS.abr().write(|v| v.set_alternate(ab)); | 397 | T::REGS.abr().write(|v| v.set_alternate(ab)); |
| 398 | T::REGS.ccr().modify(|w| { | ||
| 399 | w.set_abmode(command.abwidth.into()); | ||
| 400 | w.set_abdtr(command.abdtr); | ||
| 401 | w.set_absize(command.absize.into()); | ||
| 402 | }) | ||
| 403 | } | 398 | } |
| 404 | 399 | ||
| 405 | // Configure dummy cycles | 400 | // Configure dummy cycles |
| @@ -411,14 +406,14 @@ impl<'d, T: Instance, M: PeriMode> Hspi<'d, T, M> { | |||
| 411 | if let Some(data_length) = data_len { | 406 | if let Some(data_length) = data_len { |
| 412 | T::REGS.dlr().write(|v| { | 407 | T::REGS.dlr().write(|v| { |
| 413 | v.set_dl((data_length - 1) as u32); | 408 | v.set_dl((data_length - 1) as u32); |
| 414 | }) | 409 | }); |
| 415 | } else { | 410 | } else { |
| 416 | T::REGS.dlr().write(|v| { | 411 | T::REGS.dlr().write(|v| { |
| 417 | v.set_dl((0) as u32); | 412 | v.set_dl((0) as u32); |
| 418 | }) | 413 | }); |
| 419 | } | 414 | } |
| 420 | 415 | ||
| 421 | // Configure instruction/address/data modes | 416 | // Configure instruction/address/alternate bytes/data modes |
| 422 | T::REGS.ccr().modify(|w| { | 417 | T::REGS.ccr().modify(|w| { |
| 423 | w.set_imode(command.iwidth.into()); | 418 | w.set_imode(command.iwidth.into()); |
| 424 | w.set_idtr(command.idtr); | 419 | w.set_idtr(command.idtr); |
| @@ -428,6 +423,10 @@ impl<'d, T: Instance, M: PeriMode> Hspi<'d, T, M> { | |||
| 428 | w.set_addtr(command.addtr); | 423 | w.set_addtr(command.addtr); |
| 429 | w.set_adsize(command.adsize.into()); | 424 | w.set_adsize(command.adsize.into()); |
| 430 | 425 | ||
| 426 | w.set_abmode(command.abwidth.into()); | ||
| 427 | w.set_abdtr(command.abdtr); | ||
| 428 | w.set_absize(command.absize.into()); | ||
| 429 | |||
| 431 | w.set_dmode(command.dwidth.into()); | 430 | w.set_dmode(command.dwidth.into()); |
| 432 | w.set_ddtr(command.ddtr); | 431 | w.set_ddtr(command.ddtr); |
| 433 | }); | 432 | }); |
diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs index 8384f4fc4..cbd6c8d35 100644 --- a/embassy-stm32/src/ospi/mod.rs +++ b/embassy-stm32/src/ospi/mod.rs | |||
| @@ -113,7 +113,7 @@ pub struct TransferConfig { | |||
| 113 | 113 | ||
| 114 | /// Data width (DMODE) | 114 | /// Data width (DMODE) |
| 115 | pub dwidth: OspiWidth, | 115 | pub dwidth: OspiWidth, |
| 116 | /// Data buffer | 116 | /// Data Double Transfer rate enable |
| 117 | pub ddtr: bool, | 117 | pub ddtr: bool, |
| 118 | 118 | ||
| 119 | /// Number of dummy cycles (DCYC) | 119 | /// Number of dummy cycles (DCYC) |
| @@ -451,11 +451,6 @@ impl<'d, T: Instance, M: PeriMode> Ospi<'d, T, M> { | |||
| 451 | // Configure alternate bytes | 451 | // Configure alternate bytes |
| 452 | if let Some(ab) = command.alternate_bytes { | 452 | if let Some(ab) = command.alternate_bytes { |
| 453 | T::REGS.abr().write(|v| v.set_alternate(ab)); | 453 | T::REGS.abr().write(|v| v.set_alternate(ab)); |
| 454 | T::REGS.ccr().modify(|w| { | ||
| 455 | w.set_abmode(PhaseMode::from_bits(command.abwidth.into())); | ||
| 456 | w.set_abdtr(command.abdtr); | ||
| 457 | w.set_absize(SizeInBits::from_bits(command.absize.into())); | ||
| 458 | }) | ||
| 459 | } | 454 | } |
| 460 | 455 | ||
| 461 | // Configure dummy cycles | 456 | // Configure dummy cycles |
| @@ -467,14 +462,14 @@ impl<'d, T: Instance, M: PeriMode> Ospi<'d, T, M> { | |||
| 467 | if let Some(data_length) = data_len { | 462 | if let Some(data_length) = data_len { |
| 468 | T::REGS.dlr().write(|v| { | 463 | T::REGS.dlr().write(|v| { |
| 469 | v.set_dl((data_length - 1) as u32); | 464 | v.set_dl((data_length - 1) as u32); |
| 470 | }) | 465 | }); |
| 471 | } else { | 466 | } else { |
| 472 | T::REGS.dlr().write(|v| { | 467 | T::REGS.dlr().write(|v| { |
| 473 | v.set_dl((0) as u32); | 468 | v.set_dl((0) as u32); |
| 474 | }) | 469 | }); |
| 475 | } | 470 | } |
| 476 | 471 | ||
| 477 | // Configure instruction/address/data/communication modes | 472 | // Configure instruction/address/alternate bytes/data/communication modes |
| 478 | T::REGS.ccr().modify(|w| { | 473 | T::REGS.ccr().modify(|w| { |
| 479 | w.set_imode(PhaseMode::from_bits(command.iwidth.into())); | 474 | w.set_imode(PhaseMode::from_bits(command.iwidth.into())); |
| 480 | w.set_idtr(command.idtr); | 475 | w.set_idtr(command.idtr); |
| @@ -484,6 +479,10 @@ impl<'d, T: Instance, M: PeriMode> Ospi<'d, T, M> { | |||
| 484 | w.set_addtr(command.addtr); | 479 | w.set_addtr(command.addtr); |
| 485 | w.set_adsize(SizeInBits::from_bits(command.adsize.into())); | 480 | w.set_adsize(SizeInBits::from_bits(command.adsize.into())); |
| 486 | 481 | ||
| 482 | w.set_abmode(PhaseMode::from_bits(command.abwidth.into())); | ||
| 483 | w.set_abdtr(command.abdtr); | ||
| 484 | w.set_absize(SizeInBits::from_bits(command.absize.into())); | ||
| 485 | |||
| 487 | w.set_dmode(PhaseMode::from_bits(command.dwidth.into())); | 486 | w.set_dmode(PhaseMode::from_bits(command.dwidth.into())); |
| 488 | w.set_ddtr(command.ddtr); | 487 | w.set_ddtr(command.ddtr); |
| 489 | 488 | ||
| @@ -491,7 +490,7 @@ impl<'d, T: Instance, M: PeriMode> Ospi<'d, T, M> { | |||
| 491 | w.set_sioo(command.sioo); | 490 | w.set_sioo(command.sioo); |
| 492 | }); | 491 | }); |
| 493 | 492 | ||
| 494 | // Set informationrequired to initiate transaction | 493 | // Set information required to initiate transaction |
| 495 | if let Some(instruction) = command.instruction { | 494 | if let Some(instruction) = command.instruction { |
| 496 | if let Some(address) = command.address { | 495 | if let Some(address) = command.address { |
| 497 | T::REGS.ir().write(|v| { | 496 | T::REGS.ir().write(|v| { |
diff --git a/embassy-stm32/src/xspi/mod.rs b/embassy-stm32/src/xspi/mod.rs index 60ccf3c97..5ae074a90 100644 --- a/embassy-stm32/src/xspi/mod.rs +++ b/embassy-stm32/src/xspi/mod.rs | |||
| @@ -110,7 +110,7 @@ pub struct TransferConfig { | |||
| 110 | 110 | ||
| 111 | /// Data width (DMODE) | 111 | /// Data width (DMODE) |
| 112 | pub dwidth: XspiWidth, | 112 | pub dwidth: XspiWidth, |
| 113 | /// Data buffer | 113 | /// Data Double Transfer rate enable |
| 114 | pub ddtr: bool, | 114 | pub ddtr: bool, |
| 115 | 115 | ||
| 116 | /// Number of dummy cycles (DCYC) | 116 | /// Number of dummy cycles (DCYC) |
| @@ -424,11 +424,6 @@ impl<'d, T: Instance, M: PeriMode> Xspi<'d, T, M> { | |||
| 424 | // Configure alternate bytes | 424 | // Configure alternate bytes |
| 425 | if let Some(ab) = command.alternate_bytes { | 425 | if let Some(ab) = command.alternate_bytes { |
| 426 | T::REGS.abr().write(|v| v.set_alternate(ab)); | 426 | T::REGS.abr().write(|v| v.set_alternate(ab)); |
| 427 | T::REGS.ccr().modify(|w| { | ||
| 428 | w.set_abmode(CcrAbmode::from_bits(command.abwidth.into())); | ||
| 429 | w.set_abdtr(command.abdtr); | ||
| 430 | w.set_absize(CcrAbsize::from_bits(command.absize.into())); | ||
| 431 | }) | ||
| 432 | } else { | 427 | } else { |
| 433 | T::REGS.ccr().modify(|w| { | 428 | T::REGS.ccr().modify(|w| { |
| 434 | // disable alternate bytes | 429 | // disable alternate bytes |
| @@ -445,14 +440,14 @@ impl<'d, T: Instance, M: PeriMode> Xspi<'d, T, M> { | |||
| 445 | if let Some(data_length) = data_len { | 440 | if let Some(data_length) = data_len { |
| 446 | T::REGS.dlr().write(|v| { | 441 | T::REGS.dlr().write(|v| { |
| 447 | v.set_dl((data_length - 1) as u32); | 442 | v.set_dl((data_length - 1) as u32); |
| 448 | }) | 443 | }); |
| 449 | } else { | 444 | } else { |
| 450 | T::REGS.dlr().write(|v| { | 445 | T::REGS.dlr().write(|v| { |
| 451 | v.set_dl((0) as u32); | 446 | v.set_dl((0) as u32); |
| 452 | }) | 447 | }); |
| 453 | } | 448 | } |
| 454 | 449 | ||
| 455 | // Configure instruction/address/data modes | 450 | // Configure instruction/address/alternate bytes/data modes |
| 456 | T::REGS.ccr().modify(|w| { | 451 | T::REGS.ccr().modify(|w| { |
| 457 | w.set_imode(CcrImode::from_bits(command.iwidth.into())); | 452 | w.set_imode(CcrImode::from_bits(command.iwidth.into())); |
| 458 | w.set_idtr(command.idtr); | 453 | w.set_idtr(command.idtr); |
| @@ -462,6 +457,10 @@ impl<'d, T: Instance, M: PeriMode> Xspi<'d, T, M> { | |||
| 462 | w.set_addtr(command.addtr); | 457 | w.set_addtr(command.addtr); |
| 463 | w.set_adsize(CcrAdsize::from_bits(command.adsize.into())); | 458 | w.set_adsize(CcrAdsize::from_bits(command.adsize.into())); |
| 464 | 459 | ||
| 460 | w.set_abmode(CcrAbmode::from_bits(command.abwidth.into())); | ||
| 461 | w.set_abdtr(command.abdtr); | ||
| 462 | w.set_absize(CcrAbsize::from_bits(command.absize.into())); | ||
| 463 | |||
| 465 | w.set_dmode(CcrDmode::from_bits(command.dwidth.into())); | 464 | w.set_dmode(CcrDmode::from_bits(command.dwidth.into())); |
| 466 | w.set_ddtr(command.ddtr); | 465 | w.set_ddtr(command.ddtr); |
| 467 | }); | 466 | }); |
