diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-04-22 16:05:29 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-04-22 16:05:29 +0200 |
| commit | 9907f5683bc3d2c436e03143b32c20c41251f457 (patch) | |
| tree | 12040127b0bbba86284c020fbde762ac47627722 | |
| parent | fb5ce05b26ae0c90a872a8e0787c9419178d475a (diff) | |
| parent | d8631f96d95b42cdf963b7a836f966570981d884 (diff) | |
Merge pull request #4121 from sebgab/reset_spi_when_applying_config_stm32
Fix STM32H7 SpiDeviceWithConfig does not properly apply the config
| -rw-r--r-- | embassy-stm32/src/spi/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs index 6578aa1aa..9e2ba093a 100644 --- a/embassy-stm32/src/spi/mod.rs +++ b/embassy-stm32/src/spi/mod.rs | |||
| @@ -284,6 +284,10 @@ impl<'d, M: PeriMode> Spi<'d, M> { | |||
| 284 | 284 | ||
| 285 | #[cfg(any(spi_v3, spi_v4, spi_v5))] | 285 | #[cfg(any(spi_v3, spi_v4, spi_v5))] |
| 286 | { | 286 | { |
| 287 | self.info.regs.cr1().modify(|w| { | ||
| 288 | w.set_spe(false); | ||
| 289 | }); | ||
| 290 | |||
| 287 | self.info.regs.cfg2().modify(|w| { | 291 | self.info.regs.cfg2().modify(|w| { |
| 288 | w.set_cpha(cpha); | 292 | w.set_cpha(cpha); |
| 289 | w.set_cpol(cpol); | 293 | w.set_cpol(cpol); |
| @@ -292,6 +296,10 @@ impl<'d, M: PeriMode> Spi<'d, M> { | |||
| 292 | self.info.regs.cfg1().modify(|w| { | 296 | self.info.regs.cfg1().modify(|w| { |
| 293 | w.set_mbr(br); | 297 | w.set_mbr(br); |
| 294 | }); | 298 | }); |
| 299 | |||
| 300 | self.info.regs.cr1().modify(|w| { | ||
| 301 | w.set_spe(true); | ||
| 302 | }); | ||
| 295 | } | 303 | } |
| 296 | Ok(()) | 304 | Ok(()) |
| 297 | } | 305 | } |
