Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- move gpio, dma impls, adc pins in subdir, remove unused `From` impls [#658] [#664]
- Bump `embedded-hal` to `1.0.0-alpha.10`. See [their changelog][embedded-hal-1.0.0-alpha.10] for further details. Note that this included breaking changes to the previous alpha APIs. [#663]
- Fix race condition in sending start condition in I2C. [#662]

[#658]: https://github.com/stm32-rs/stm32f4xx-hal/pull/658
[#662]: https://github.com/stm32-rs/stm32f4xx-hal/pull/662
[#663]: https://github.com/stm32-rs/stm32f4xx-hal/pull/663
[#664]: https://github.com/stm32-rs/stm32f4xx-hal/pull/664
[embedded-hal-1.0.0-alpha.10]: https://github.com/rust-embedded/embedded-hal/blob/v1.0.0-alpha.10/embedded-hal/CHANGELOG.md
Expand Down
9 changes: 7 additions & 2 deletions src/i2c/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,14 @@ where

fn send_start(&mut self, read: bool) -> Result<(), super::Error> {
let i2c = &self.hal_i2c.i2c;
i2c.cr1.modify(|_, w| w.start().set_bit());

// Make sure the ack and start bit is set together in a single
// read-modify-write operation to avoid race condition.
// See PR: https://github.com/stm32-rs/stm32f4xx-hal/pull/662
if read {
i2c.cr1.modify(|_, w| w.ack().set_bit());
i2c.cr1.modify(|_, w| w.ack().set_bit().start().set_bit());
} else {
i2c.cr1.modify(|_, w| w.start().set_bit());
}

// Wait until START condition was generated
Expand Down