Skip to content

Commit 1b18152

Browse files
authored
Merge pull request #616 from buncram/cram-dev
modify i2c reset condition to have wait states
2 parents c733933 + dedf8c2 commit 1b18152

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

  • libs/cramium-hal/src/udma

libs/cramium-hal/src/udma/i2c.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,6 @@ impl<'a> I2c<'a> {
303303
}
304304

305305
pub fn reset(&mut self) {
306-
// reset the block
307-
self.udma_reset(Bank::Custom);
308-
self.udma_reset(Bank::Tx);
309-
self.udma_reset(Bank::Rx);
310306
// reset the block, if MPW. If NTO, this needs to be handled by the upper level code with a
311307
// reset to udma_global
312308
#[cfg(feature = "mpw")]
@@ -323,6 +319,19 @@ impl<'a> I2c<'a> {
323319
I2cChannel::Channel3 => PeriphId::I2c3,
324320
});
325321
}
322+
for _i in 0..20 {
323+
// dummy read
324+
let _ = self.csr.rf(utra::udma_i2c_0::REG_STATUS_R_BUSY);
325+
}
326+
// reset the block
327+
self.udma_reset(Bank::Custom);
328+
self.udma_reset(Bank::Tx);
329+
self.udma_reset(Bank::Rx);
330+
331+
for _i in 0..20 {
332+
// dummy read
333+
let _ = self.csr.rf(utra::udma_i2c_0::REG_STATUS_R_BUSY);
334+
}
326335

327336
self.send_cmd_list(&[I2cCmd::Config(self.divider)]);
328337
self.pending.take();

0 commit comments

Comments
 (0)