Skip to content

Commit ce6e44d

Browse files
committed
Fix incorrect I2C OA2 bit shift
Also fix comment about OA2 masks to match the reference manual
1 parent 5a94ad0 commit ce6e44d

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

embassy-stm32/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
<!-- next-header -->
99
## Unreleased - ReleaseDate
1010

11+
- fix: Fixed handling of secondary I2C addresses (`ADCn.OA2`); previously, they were incorrectly left-shifted, such that calling `configure_oa2(addr)` would actually create an I2C peripheral with address `addr`\*2. ([#4692](https://github.com/embassy-rs/embassy/pull/4692))
1112
- fix: Fixed STM32H5 builds requiring time feature
1213
- feat: Derive Clone, Copy for QSPI Config
1314
- fix: stm32/i2c in master mode (blocking): subsequent transmissions failed after a NACK was received

embassy-stm32/src/i2c/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub enum AddrMask {
2020
MASK4,
2121
/// OA2\[5:1\] are masked and don’t care. Only OA2\[7:6\] are compared.
2222
MASK5,
23-
/// OA2\[6:1\] are masked and don’t care. Only OA2\[7:6\] are compared.
23+
/// OA2\[6:1\] are masked and don’t care. Only OA2\[7\] is compared.
2424
MASK6,
2525
/// OA2\[7:1\] are masked and don’t care. No comparison is done, and all (except reserved) 7-bit received addresses are acknowledged
2626
MASK7,

embassy-stm32/src/i2c/v2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ impl<'d, M: Mode> I2c<'d, M, MultiMaster> {
963963
self.info.regs.oar2().write(|reg| {
964964
reg.set_oa2en(false);
965965
reg.set_oa2msk(oa2.mask.into());
966-
reg.set_oa2(oa2.addr << 1);
966+
reg.set_oa2(oa2.addr);
967967
reg.set_oa2en(true);
968968
});
969969
}

0 commit comments

Comments
 (0)