Skip to content

Commit

Permalink
Always stop after reading.
Browse files Browse the repository at this point in the history
For some reason suspending causes subsequent reads to overrun.
  • Loading branch information
qwandor committed Apr 15, 2024
1 parent f96389a commit 2001114
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions nrf-hal-common/src/twim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,10 @@ where
compiler_fence(SeqCst);
unsafe { self.set_rx_buffer(buffer)? };

// Set appropriate lastrx shortcut.
if next_operation_write.is_none() {
self.0.shorts.write(|w| w.lastrx_stop().enabled());
} else {
#[cfg(not(any(feature = "5340-app", feature = "5340-net", feature = "52832")))]
self.0.shorts.write(|w| w.lastrx_suspend().enabled());
}
// TODO: We should suspend rather than stopping if there are more operations to
// follow, but for some reason that results in an overrun error and reading bad
// data in the next read.
self.0.shorts.write(|w| w.lastrx_stop().enabled());

// Start read.
self.0.tasks_startrx.write(|w| unsafe { w.bits(1) });
Expand Down

0 comments on commit 2001114

Please sign in to comment.