Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow SAI start without an initial write #3541

Merged
merged 2 commits into from
Nov 16, 2024

Conversation

elagil
Copy link
Contributor

@elagil elagil commented Nov 16, 2024

Previously, when starting the SAI (and its ring buffer + DMA channel), then writing data to the ring buffer later, the SAI DMA has already been running for some (undeterministic) amount of time. It only makes sense to start the DMA after there is already data in the transmit ring buffer present.

This PR disables start for SAI in transmit mode, and starts the DMA just after the transmit ring buffer was filled with an initial amount of data.

@@ -828,7 +828,6 @@ impl<'a, W: Word> ReadableRingBuffer<'a, W> {
/// You must call this after creating it for it to work.
pub fn start(&mut self) {
self.channel.start();
self.clear();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear on start conflicts with write_immediate. With clear in place, write_immediate would have no effect.

@Dirbaio Dirbaio added this pull request to the merge queue Nov 16, 2024
Merged via the queue into embassy-rs:main with commit 8d8cd78 Nov 16, 2024
7 checks passed
@elagil elagil deleted the avoid_sai_start_before_write branch November 16, 2024 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants