SAI - Allow both blocks to be set to Sync::SLAVE and still remain synchronous#705
SAI - Allow both blocks to be set to Sync::SLAVE and still remain synchronous#705stephenhensley wants to merge 1 commit into
Conversation
…another daisy, etc.)
Test Results167 tests 167 ✅ 0s ⏱️ Results for commit 0d8ba8b. |
I tested a bit more, and haven't seen this happen again yet. However, I did look a little bit, and there are both ways at syncing the SAIs to one another, and the pin for "I2S_CKIN" is pin D3 on the seed. Anyway, for now I've shared a pair of demo programs in a repo for now with this PR checked out for testing. |
This adds handling for two SAI blocks with no master (e.g. daisy following another daisy, etc.).
The immediate use case for this is to be able to set up a second Daisy as a DSP for a primary Daisy, where the secondary Daisy would be configured with both channels set to
Sync::SLAVE.Now, the SAI peripheral driver will detect that, and still set the
SaiInitTypeDef::Synchrofor the B slot toSAI_ASYNCHRONOUSso that they can share a callback in the typical fashion.This has been working fine for me during an hour or so of testing with One daisy generating audio, sending it to the second to echo back to the first, and output on its SAI1 outputs.
However, I have noticed a few times where it seems like one of the streams is getting a bit off, before correcting itself.
I have a feeling this may be an issue with the SAI1 and SAI2 synchronization, which has come up a few times in the past, but has never been consistently reproducible.
I'll spend a little time looking at whether I can recreate that behavior, and possibly improve cross-SAI sync at the same time, but that may be something we take care of later if it isn't consistent.
I'll add a pair of examples, or share a new repo with programs for each side before merging this so others can use that as a jumping off point for multi-daisy projects 😄