mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-29 21:31:08 +00:00
Merge pull request #4634 from fwolter/fix-i2c-stop
stm32/i2c: fix failure of subsequent transmissions after NACK
This commit is contained in:
commit
2ef9dfb512
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- fix: Fixed STM32H5 builds requiring time feature
|
||||
- feat: Derive Clone, Copy for QSPI Config
|
||||
- fix: stm32/i2c in master mode (blocking): subsequent transmissions failed after a NACK was received
|
||||
|
||||
## 0.4.0 - 2025-08-26
|
||||
|
||||
|
@ -454,7 +454,8 @@ impl<'d, M: Mode, IM: MasterMode> I2c<'d, M, IM> {
|
||||
// (START has been ACKed or last byte when
|
||||
// through)
|
||||
if let Err(err) = self.wait_txis(timeout) {
|
||||
if send_stop {
|
||||
if send_stop && err != Error::Nack {
|
||||
// STOP is sent automatically if a NACK was received
|
||||
self.master_stop();
|
||||
}
|
||||
return Err(err);
|
||||
@ -548,7 +549,9 @@ impl<'d, M: Mode, IM: MasterMode> I2c<'d, M, IM> {
|
||||
(idx != last_slice_index) || (slice_len > 255),
|
||||
timeout,
|
||||
) {
|
||||
self.master_stop();
|
||||
if err != Error::Nack {
|
||||
self.master_stop();
|
||||
}
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
@ -561,7 +564,9 @@ impl<'d, M: Mode, IM: MasterMode> I2c<'d, M, IM> {
|
||||
(number != last_chunk_idx) || (idx != last_slice_index),
|
||||
timeout,
|
||||
) {
|
||||
self.master_stop();
|
||||
if err != Error::Nack {
|
||||
self.master_stop();
|
||||
}
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
@ -571,7 +576,9 @@ impl<'d, M: Mode, IM: MasterMode> I2c<'d, M, IM> {
|
||||
// (START has been ACKed or last byte when
|
||||
// through)
|
||||
if let Err(err) = self.wait_txis(timeout) {
|
||||
self.master_stop();
|
||||
if err != Error::Nack {
|
||||
self.master_stop();
|
||||
}
|
||||
return Err(err);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user