diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-08-13 16:37:54 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-13 16:37:54 +0200 |
| commit | f689cd10000d3c5d608907d52c686abcc6c0971f (patch) | |
| tree | ab59a299fdbe100cf948d41034f253b067137e03 /embassy-stm32/src | |
| parent | 39e75bb02f0c566b08ba75133c9e67c8d71b5b01 (diff) | |
| parent | 55d9399ab85efc6250f60fd4440fc3cf97e506a5 (diff) | |
Merge pull request #4541 from mbrieske/fix_blocking_i2c
fix stm32 i2c: wait for STOP flag in blocking read to terminate read transaction
Diffstat (limited to 'embassy-stm32/src')
| -rw-r--r-- | embassy-stm32/src/i2c/v2.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs index 4d341bab1..aeb4c1c00 100644 --- a/embassy-stm32/src/i2c/v2.rs +++ b/embassy-stm32/src/i2c/v2.rs | |||
| @@ -408,6 +408,7 @@ impl<'d, M: Mode, IM: MasterMode> I2c<'d, M, IM> { | |||
| 408 | *byte = self.info.regs.rxdr().read().rxdata(); | 408 | *byte = self.info.regs.rxdr().read().rxdata(); |
| 409 | } | 409 | } |
| 410 | } | 410 | } |
| 411 | self.wait_stop(timeout)?; | ||
| 411 | Ok(()) | 412 | Ok(()) |
| 412 | } | 413 | } |
| 413 | 414 | ||
| @@ -463,11 +464,13 @@ impl<'d, M: Mode, IM: MasterMode> I2c<'d, M, IM> { | |||
| 463 | } | 464 | } |
| 464 | } | 465 | } |
| 465 | // Wait until the write finishes | 466 | // Wait until the write finishes |
| 466 | let result = self.wait_tc(timeout); | 467 | self.wait_tc(timeout)?; |
| 467 | if send_stop { | 468 | if send_stop { |
| 468 | self.master_stop(); | 469 | self.master_stop(); |
| 470 | self.wait_stop(timeout)?; | ||
| 469 | } | 471 | } |
| 470 | result | 472 | |
| 473 | Ok(()) | ||
| 471 | } | 474 | } |
| 472 | 475 | ||
| 473 | // ========================= | 476 | // ========================= |
